Claims
Exclusive, leased ownership of a named key inside a run.
All paths are relative to the API base URL (https://api.getrunstate.com) and require Authorization: Bearer <api key>. See the API overview for authentication, idempotency and the error envelope.
GET /claims
Section titled “GET /claims”GET /v1/spaces/{spaceId}/claimsRead-only claim list with optional key prefix filter.
- Key permission:
coordination_read
Path parameters
| Name | Type | Notes |
|---|---|---|
spaceId |
string (uuid) | required |
Responses
| Status | Meaning |
|---|---|
200 |
Claims |
curl -X GET "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/claims" \ -H "Authorization: Bearer $RUNSTATE_API_KEY"POST /claims
Section titled “POST /claims”POST /v1/spaces/{spaceId}/claimsClaim a named key.
- Key permission:
coordination_write - Idempotency-Key header: required
- TypeScript SDK:
run.claim(key).acquire() / .tryAcquire() / .run() - Python SDK:
run.claim(key).acquire() / .try_acquire() / .run()
Path parameters
| Name | Type | Notes |
|---|---|---|
spaceId |
string (uuid) | required |
Request body (JSON)
| Field | Type | Required | Notes |
|---|---|---|---|
key |
string | yes | length 1–512 |
scopeId |
string (uuid) | yes | |
holder |
string | yes | |
holderSession |
string | yes | |
leaseSeconds |
integer | no | 5–600; default 30 |
Responses
| Status | Meaning |
|---|---|
201 |
Claim held; fenced token returned |
409 |
Error envelope {"error":{"code","message","requestId"}} |
curl -X POST "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/claims" \ -H "Authorization: Bearer $RUNSTATE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"key":"<key>","scopeId":"<run id>","holder":"worker-1","holderSession":"<session id>"}'GET /claims/{key}
Section titled “GET /claims/{key}”GET /v1/spaces/{spaceId}/claims/{key}Current holder of a key.
- Key permission:
coordination_read
Path parameters
| Name | Type | Notes |
|---|---|---|
spaceId |
string (uuid) | required |
key |
string | required |
Responses
| Status | Meaning |
|---|---|
200 |
Claim row |
404 |
Error envelope {"error":{"code","message","requestId"}} |
curl -X GET "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/claims/<key>" \ -H "Authorization: Bearer $RUNSTATE_API_KEY"POST /claims/{key}/renew
Section titled “POST /claims/{key}/renew”POST /v1/spaces/{spaceId}/claims/{key}/renewRenew the current holder’s lease.
- Key permission:
coordination_write - TypeScript SDK:
lease.renew() (automatic while held) - Python SDK:
lease.renew() (automatic while held)
Path parameters
| Name | Type | Notes |
|---|---|---|
spaceId |
string (uuid) | required |
key |
string | required |
Request body (JSON)
| Field | Type | Required | Notes |
|---|---|---|---|
token |
string | yes | |
leaseSeconds |
integer | no | 5–600; default 30 |
Responses
| Status | Meaning |
|---|---|
200 |
New lease expiry |
409 |
Error envelope {"error":{"code","message","requestId"}} |
curl -X POST "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/claims/<key>/renew" \ -H "Authorization: Bearer $RUNSTATE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"token":"<lease token>"}'POST /claims/{key}/release
Section titled “POST /claims/{key}/release”POST /v1/spaces/{spaceId}/claims/{key}/releaseRelease with token; allowed after scope cancellation (safe cleanup)
- Key permission:
coordination_write - TypeScript SDK:
lease.release() - Python SDK:
lease.release()
Path parameters
| Name | Type | Notes |
|---|---|---|
spaceId |
string (uuid) | required |
key |
string | required |
Request body (JSON)
| Field | Type | Required | Notes |
|---|---|---|---|
token |
string | yes | |
observation |
any JSON | no |
Responses
| Status | Meaning |
|---|---|
200 |
Released |
409 |
Error envelope {"error":{"code","message","requestId"}} |
curl -X POST "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/claims/<key>/release" \ -H "Authorization: Bearer $RUNSTATE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"token":"<lease token>"}'