Docs Sign in Get a key

Docs / Guides

Events

Read every Hapti event of the last 30 days through the API, the same events webhooks send. Use it to catch up, reconcile or poll.

Every event Hapti sends by webhook is also stored for 30 days, and can be read through the API even if you have no webhook at all. Use it to catch up after downtime, to reconcile, or when your server cannot receive webhooks.

Terminal
curl "https://api.hapti.dev/v1/events?type=task.succeeded&since=2026-11-20" \
  -H "Authorization: Bearer $HAPTI_KEY"
JSON
{
  "object": "list",
  "data": [
    {
      "id": "evt_c3b9a22cc8666f754e930055",
      "object": "event",
      "type": "task.succeeded",
      "api_version": "2026-11-22",
      "created_at": "2026-11-22T18:40:56.191Z",
      "mode": "test",
      "data": {
        "id": "tsk_9a96d9052acef545",
        "object": "task",
        "batch": null,
        "schedule": null,
        "mode": "test",
        "status": "succeeded",
        "paused": null,
        "level": "standard",
        "price_cents": 0,
        "starting_price_cents": 10,
        "billed": false,
        "user": "customer_42",
        "url": "https://portal.example.com/claims",
        "goal": "Declare the water damage claim and give me the claim number.",
        "input": {
          "data": {
            "contract": "AX-4471",
            "date": "2026-11-20"
          },
          "files": []
        },
        "pending": null,
        "learn": true,
        "used_recipe": null,
        "template": null,
        "created_by": {
          "type": "key",
          "id": "key_d160ed300d0cf627",
          "hint": "hp_test_7eF…ZD9D",
          "name": "default test key",
          "owner_email": null
        },
        "recipe_chosen": null,
        "recipe": null,
        "dispute": null,
        "result": {
          "answer": "The claim is declared. Claim number SIN-2026-118.",
          "data": {
            "claim_number": "SIN-2026-118"
          }
        },
        "files": [],
        "usage": {
          "steps": 14
        },
        "created_at": "2026-11-22T18:40:56.170Z",
        "finished_at": "2026-11-22T18:40:56.190Z"
      }
    }
  ],
  "has_more": false,
  "next_cursor": null,
  "total": 1
}
ParameterWhat it does
typeOne event type, or a family such as task.*
objectOnly the events of this task or object id
sinceOnly the events from this date
limit, cursorPaging, see Pagination

An event is the same object as a webhook payload, with the same id, so you can mix both and handle each event once.

Polling with events

When you cannot receive webhooks, poll GET /v1/events with the created_at of the last event you handled as since, every few seconds. Events come newest first, and each one has a stable id.

Event types

EventWhen
task.createdA task was created.
task.pausedA live task waits for credit.
task.waitingThe agent asks a question or an approval.
task.succeededA task succeeded.
task.failedA task failed.
task.cancelledA task was cancelled.
batch.finishedEvery task of a batch is over.
email.receivedAn email reached a person's inbox.
sms.receivedA text reached a person's number.
user.account_connectedA person connected an account.
user.account_removedA person removed an account.
user.forward_startedA person started forwarding mail.
user.forward_stoppedA person stopped forwarding mail.
user.memory_forgottenA person erased what the agent kept.
pingA test sent from the console or the API.