Skip to content

Respond to a swap request

POST
/v1/rotations/{rotationId}/swap-requests/{requestId}/{responseAction}
curl --request POST \
--url https://api.roundrobinbot.eu/v1/rotations/example/swap-requests/example/example \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--header 'If-Match: example' \
--data '{ "operationId": "example", "expectedRevision": 1, "acknowledgedConflictIds": [ "example" ], "acknowledgedStartedLegKeys": [ "example" ] }'

Requires a Slack member access token, the current expectedRevision and If-Match. Use an action offered by the request capability. Actions are accept, decline and cancel. Acceptance exchanges both remaining duty intervals together. Cancelling accepted duty preserves completed service. Reuse operationId and the same body when retrying an uncertain result. A missing If-Match returns 428. On 412, refresh the preview before retrying.

rotationId
required
string
requestId
required
string
responseAction
required
string
/^(accept|decline|cancel)$/
If-Match
required
string

The ETag from your last read of this resource, sent back exactly as you received it, quotes included. The write happens only if nothing changed in between: a stale validator is answered 412 and nothing is written. Send * to write against whatever is current on purpose. Omitting the header is 428, never an unconditional write. https://docs.roundrobinbot.eu/api/conventions/#conditional-writes

The reviewed request revision, conflict acknowledgments and remaining-time consent for a swap response.

object
operationId

A caller-generated identifier of at most 128 characters. Reuse it only for an identical retry. A repeated operation id is recognised for 30 days; after that it is treated as a new request.

string
expectedRevision

The request revision reviewed by the caller.

integer format: int64
acknowledgedConflictIds

Current conflict identifiers acknowledged for the interval this caller would receive.

Array<string>
acknowledgedStartedLegKeys

Keys of started intervals whose remaining time the recipient agrees to exchange. Include every preview leg with hasStarted set to true when accepting.

Array<string>
Examplegenerated
{
"operationId": "example",
"expectedRevision": 1,
"acknowledgedConflictIds": [
"example"
],
"acknowledgedStartedLegKeys": [
"example"
]
}

OK

Media typeapplication/json

The saved result. deliveryState reports publication progress, not confirmed Slack receipt.

object
operationId
required
string
rotationVersion
required
integer format: int64
effectiveFrom
required
string format: date-time
request
required

A swap request, its rotation name and the actions available to this caller.

object
request
required

The request.

object
id
required

The request identifier.

string
rotationId
required

The rotation identifier.

string
requesterUserId
required

The user who made the request.

string
recipientUserId
required

The user asked to swap.

string
legs
required

The offered intervals.

Array<object>

An offered duty interval and its accepted assignment identifier, when present. phase is upcoming, running or ended for this leg at the time the response is built.

object
key
required

The key of this leg within the request.

string
rotationId
required

The rotation identifier.

string
cellId
required

The identifier of the lane in a window.

string
holderUserId
required

The user who holds the interval.

string
from
required

The inclusive interval start.

string format: date-time
to
required

The exclusive interval end.

string format: date-time
arrangementId
required

The accepted assignment identifier. Absent until the request is accepted.

null | string
phase
required

upcoming, running or ended for this leg at the instant the response is built.

string
reason
required

The reason given with the request.

string
revision
required

The revision of the request.

integer format: int64
state
required

The lifecycle state of the request.

string
phase
required

upcoming before the earliest leg starts, ended once the latest leg has ended, running between, at the instant the response is built.

string
capability
required

The actions available to the caller.

object
canAccept
required

Whether the caller may accept the request.

boolean
canDecline
required

Whether the caller may decline the request.

boolean
canCancel
required

Whether the caller may cancel the request.

boolean
reason
required

The reason the actions are unavailable. Absent when they are available.

null | string
reasonCode
required

The same word as reason, or null when the actions are available.

null | string
rotationName
required

The name of the rotation.

string
asOfUtc
required

The instant the state, phase and capabilities were evaluated.

string format: date-time
active
required

True while the request is pending or accepted.

boolean
actionable
required

True when the caller may accept, decline or cancel the request.

boolean
changesAtUtc
required

The earliest later instant at which the state, a phase, active or actionable changes by the clock alone. Null when none will.

null | string format: date-time
arrangements
required
Array<object>

An interval assignment. Its recorded terms remain distinct from actual served history.

object
id
required

The arrangement identifier.

string
rotationId
required

The rotation identifier.

string
cellId
required

The identifier of the lane in a window.

string
userId
required

The assigned person’s Slack user identifier.

string
from
required

The inclusive UTC start.

string format: date-time
to
required

The exclusive UTC end.

string format: date-time
revision
required

The arrangement revision used when changing or ending it.

integer format: int64
state
required

active or cancelled. An active record can describe an interval that has already ended.

string
kind
required

directAssignment, acceptedCover or swapLeg. Direct-assignment writes change or end only directAssignment.

string
phase
required

upcoming, running or ended, from from and to at the time the response is built.

string
changesAtUtc
required

The next instant at which phase changes, or null once it has ended.

null | string format: date-time
origin
One of:
null
originalSnapshot
One of:
null
turnSelection
One of:
null
deliveryState
required
string
Examplegenerated
{
"operationId": "example",
"rotationVersion": 1,
"effectiveFrom": "2026-04-15T12:00:00Z",
"request": {
"request": {
"id": "example",
"rotationId": "example",
"requesterUserId": "example",
"recipientUserId": "example",
"legs": [
{
"key": "example",
"rotationId": "example",
"cellId": "example",
"holderUserId": "example",
"from": "2026-04-15T12:00:00Z",
"to": "2026-04-15T12:00:00Z",
"arrangementId": "example",
"phase": "example"
}
],
"reason": "example",
"revision": 1,
"state": "example",
"phase": "example"
},
"capability": {
"canAccept": true,
"canDecline": true,
"canCancel": true,
"reason": "example",
"reasonCode": "example"
},
"rotationName": "example",
"asOfUtc": "2026-04-15T12:00:00Z",
"active": true,
"actionable": true,
"changesAtUtc": "2026-04-15T12:00:00Z"
},
"arrangements": [
{
"id": "example",
"rotationId": "example",
"cellId": "example",
"userId": "example",
"from": "2026-04-15T12:00:00Z",
"to": "2026-04-15T12:00:00Z",
"revision": 1,
"state": "example",
"kind": "example",
"phase": "example",
"changesAtUtc": "2026-04-15T12:00:00Z",
"origin": {
"userIds": [
"example"
],
"complete": true
},
"originalSnapshot": {
"asOfUtc": "2026-04-15T12:00:00Z",
"from": "2026-04-15T12:00:00Z",
"to": "2026-04-15T12:00:00Z",
"complete": true,
"segments": [
{
"from": "2026-04-15T12:00:00Z",
"to": "2026-04-15T12:00:00Z",
"userIds": [
"example"
],
"resolved": true
}
]
},
"turnSelection": {
"kind": "example",
"from": "2026-04-15T12:00:00Z",
"to": "2026-04-15T12:00:00Z"
}
}
],
"deliveryState": "example"
}