Timers
Durable wakeups.
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 /timers
Section titled “GET /timers”GET /v1/spaces/{spaceId}/timersRead-only timer list with optional state filter.
- Key permission:
coordination_read
Path parameters
| Name | Type | Notes |
|---|---|---|
spaceId |
string (uuid) | required |
Responses
| Status | Meaning |
|---|---|
200 |
Timers |
curl -X GET "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/timers" \ -H "Authorization: Bearer $RUNSTATE_API_KEY"POST /timers
Section titled “POST /timers”POST /v1/spaces/{spaceId}/timersArm a durable wakeup.
- Key permission:
coordination_write - Idempotency-Key header: required
- TypeScript SDK:
run.timers.create() - Python SDK:
run.timers.create()
Path parameters
| Name | Type | Notes |
|---|---|---|
spaceId |
string (uuid) | required |
Request body (JSON)
| Field | Type | Required | Notes |
|---|---|---|---|
scopeId |
string (uuid) | yes | |
at |
string (date-time) | no | |
afterSeconds |
integer | no | min 0 |
Responses
| Status | Meaning |
|---|---|
201 |
Timer id and fireAt |
curl -X POST "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/timers" \ -H "Authorization: Bearer $RUNSTATE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"scopeId":"<run id>"}'POST /timers/{id}/ack
Section titled “POST /timers/{id}/ack”POST /v1/spaces/{spaceId}/timers/{id}/ackAcknowledge firing (idempotent)
- Key permission:
coordination_write - TypeScript SDK:
timer.wait() (acks when fired) - Python SDK:
timer.wait() (acks when fired)
Path parameters
| Name | Type | Notes |
|---|---|---|
spaceId |
string (uuid) | required |
id |
string (uuid) | required |
Request body (JSON)
| Field | Type | Required | Notes |
|---|---|---|---|
token |
string | yes |
Responses
| Status | Meaning |
|---|---|
200 |
Acked |
409 |
Error envelope {"error":{"code","message","requestId"}} |
curl -X POST "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/timers/<id>/ack" \ -H "Authorization: Bearer $RUNSTATE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{"token":"<lease token>"}'POST /timers/{id}/cancel
Section titled “POST /timers/{id}/cancel”POST /v1/spaces/{spaceId}/timers/{id}/cancelDisarm before firing.
- Key permission:
coordination_write - TypeScript SDK:
timer.cancel() - Python SDK:
timer.cancel()
Path parameters
| Name | Type | Notes |
|---|---|---|
spaceId |
string (uuid) | required |
id |
string (uuid) | required |
Responses
| Status | Meaning |
|---|---|
200 |
Cancelled |
409 |
Error envelope {"error":{"code","message","requestId"}} |
curl -X POST "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/timers/<id>/cancel" \ -H "Authorization: Bearer $RUNSTATE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)"POST /timers/poll
Section titled “POST /timers/poll”POST /v1/spaces/{spaceId}/timers/pollPull-mode firing for customers without destinations.
- Key permission:
coordination_write - TypeScript SDK:
timer.wait() - Python SDK:
timer.wait()
Path parameters
| Name | Type | Notes |
|---|---|---|
spaceId |
string (uuid) | required |
Request body (JSON)
| Field | Type | Required | Notes |
|---|---|---|---|
scopeId |
string (uuid) | no |
Responses
| Status | Meaning |
|---|---|
200 |
FIRED timers with wakeup tokens |
curl -X POST "$RUNSTATE_BASE_URL/v1/spaces/$RUNSTATE_SPACE_ID/timers/poll" \ -H "Authorization: Bearer $RUNSTATE_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{}'