---
title: "Claim events to work on"
method: POST
path: "/v1/{account_id}/events/claim"
tags: ["Webhooks"]
---

# Claim events to work on

`POST /v1/{account_id}/events/claim`

## Request

- Base URL: `https://api.curviate.com`
- URL: `https://api.curviate.com/v1/{account_id}/events/claim`
- Auth: HTTP bearer

Leases up to limit unread events atomically; two agents never get the same one. consumer is free text, not checked, cooperative rather than access control. Finish with done or release, or it expires after lease_seconds. Retention is still 24h; an event can vanish while held.

## Path parameters

- `account_id` string, required

## Request body

- object
  - `consumer` string, required
  - `limit` integer: Max events to lease (1-100, default 10).
  - `lease_seconds` integer: Seconds to hold the lease (10-3600, default 300).

## Response `200`

The events now leased to you, oldest occurred_at first. Claiming when nothing is available returns an empty list and a 200, so an idle poll is not an error. Each event is handed to one caller only: a second claim running at the same instant gets different events, or none. The lease is cooperative and is not access control: it stops your own agents duplicating work, it does not stop anything from acting on an event it did not claim.

- object
  - `object` 'event_claim', required: Response type discriminator.
  - `consumer` string, required: The consumer name you sent, echoed as recorded on the claimed events. Like every echoed input on this API it passes the output filter on the way back, so a value containing a filtered term returns altered.
  - `lease_until` string, date-time, nullable, required: When this batch's lease expires. After this instant the events become claimable by anyone again, whether or not you finished. null when nothing was claimed.
  - `items` object[], required: The events now leased to you, oldest occurred_at first. [] when nothing was available, which is a success and not an error.
    - `object` 'event', required: Item type discriminator.
    - `id` string, required: The retained event's id. Also the value encoded in the next page's cursor.
    - `event` string, required: The canonical event name, the same name you subscribe a webhook to (for example message.received, account.connected).
    - `occurred_at` string, date-time, required: When the platform says the event happened. Events can arrive out of order, so do not treat this ordering as causal, establish ordering from the payload if you need it.
    - `received_at` string, date-time, required: When Curviate received the event. Retention is 24 hours from this instant, absolute.
    - `payload` object, required: Exactly the payload a registered webhook would have been delivered for this event, content included. It always carries account_id, event and occurred_at; the remaining fields depend on the event. This is the delivered payload itself, not a summary of it, and not the per-delivery envelope (there is no delivery when nothing is subscribed).
    - `state` 'unread' | 'claimed' | 'done', required: Queue state. unread: nobody holds it. claimed: leased to a consumer until lease_until, and an expired lease reads as unread again. done: handled, and it will never be handed out again. There is no failed state. Filter on it with the state query parameter, which is how you ask what your agents have already handled.
    - `claimed_by` string, nullable, required: The consumer name recorded by the last claim, or null. Free text, never verified, so treat it as a label rather than an identity.
    - `lease_until` string, date-time, nullable, required: When the current lease expires, or null when the event is not leased. A lease never extends the 24 hour retention.
    - `done_at` string, date-time, nullable, required: When the event was marked done, or null. Set once and never moved.
  - `safety_warning` SafetyWarning: Present on a successful response when this account crossed an account-safety ceiling while the affected budget row is on the default warn posture. The action still happened. Field-identical to the BUDGET_EXHAUSTED error body except that blocked is false and hint.message describes the outcome, so one branch handles both postures and switching the account to enforce is a configuration change rather than a client rewrite.
    - `row` string, nullable, required: The budget row that breached, for example profile_views or pending_invites. Null when the breach is not about a row: an activity_window warning on an action that spends no budget of its own (editing a message, dismissing a notification, a Recruiter or Sales Navigator admin action) is still governed by the hours the account works in. Read hint.parameter for what to change; whenever this is null it names posture, because the activity window edges are set per action type and this action has none, so the levers that reach it are the account timezone and posture.
    - `reset_at` string, nullable, required: The instant the refusal lifts: the window roll on a ceiling refusal, the next window open on an activity-window one. Null in the two cases no clock frees, the pending_invites gauge and InMail credits (row inmail).
    - `hint` object, required
      - `parameter` string, required: The settable parameter on PATCH /v1/{account_id}/safety-policy.
      - `message` string, required: What the condition is and what changing that parameter would do. This is the one field whose text differs from the BUDGET_EXHAUSTED refusal: here it says the action went through, and on a ceiling breach how far past the ceiling this row now stands, rather than telling you to set posture to warn when it already is. Branch on parameter, reason and blocked, never on this text.
    - `reason` 'ceiling' | 'activity_window', required: Which rule was crossed. ceiling means the row's configured limit is spent; activity_window means the account is outside the hours it works in, which is a different fact with a different remedy. hint.parameter names the right setting for each.
    - `blocked` boolean, required: Always false here. True on the BUDGET_EXHAUSTED refusal carrying the same payload.

## Other responses

- `400`: Invalid request, a missing consumer or an out-of-range limit or lease_seconds.
- `404`: The account_id does not belong to this tenant, or the account is unknown. An id whose connection was replaced or removed also stops resolving here, and it is already absent from the list, so re-read `GET /v1/accounts` for the current id.
- `413`: Payload too large, the request body exceeds the size limit.
- `429`: Rate limited, retry after the hinted delay.
- `500`: Internal error.
- `503`: Service unavailable.

---

[API](https://skmtc.dev/curviate/apis/curviate-api.md) · [All operations](https://skmtc.dev/curviate/apis/curviate-api/llms.txt) · [OpenAPI document](https://skmtc.dev/curviate/apis/curviate-api/revisions/eab848801d95?raw)
