Saltar al contenido
SendIt está en desarrollo y todavía no opera comercialmente · SendIt is in development and not yet commercially available.
SendItdocs
English
Esc
↑↓navigate↵open⌘Jpreview
En esta página

Event history

Read your organization's events from the last 7 days and emit test events against your endpoint.

GET /v1/events returns your organization’s event history, whether or not an endpoint is subscribed. Use it for replay, auditing, and recovery after your receiver is down. POST /v1/test/events emits a synthetic event in test mode to exercise your handler.

Read the history

An API key with the webhooks:read scope reads the history. The key’s mode scopes the result: sk_test_... sees test events and sk_live_... sees LIVE events. ?livemode= is not accepted.

Parameter Meaning
after Pass nextCursor for the next page or resumeCursor to poll for later events.
types Comma-separated event types (see event types). An unknown name returns 400.
limit Integer from 1 to 100. Default is 100.
curl "https://api.sendit.mx/v1/events?types=shipment.tracking.updated&limit=50" \
  -H "X-API-Key: sk_test_..."
{
  "success": true,
  "data": {
    "data": [
      {
        "id": "evt_1a2b3c4d5e",
        "type": "shipment.tracking.updated",
        "created": "2026-07-17T12:00:00.000Z",
        "livemode": false,
        "data": {
          "object": {
            "id": "clxq1w2e3r4t5y6u7i8o9p0a",
            "status": "DELIVERED",
            "trackingNumber": "TEST-9384756201",
            "carrierCode": "DHL"
          }
        }
      }
    ],
    "nextCursor": "eyJjcmVhdGVkQXQiOiIyMDI2LTA3LTE3VDEyOjAwOjAwLjAwMFoiLCJpZCI6ImV2dF8xYTJiM2M0ZDVlIn0",
    "resumeCursor": "eyJjcmVhdGVkQXQiOiIyMDI2LTA3LTE3VDEyOjAwOjAwLjAwMFoiLCJpZCI6ImV2dF8xYTJiM2M0ZDVlIn0",
    "hasMore": true
  }
}
  • Pages arrive oldest-first, ordered by createdAt and id.
  • nextCursor is null on the last page. hasMore reports whether another page exists.
  • Each item uses the same logical envelope as a webhook delivery: { id, type, created, livemode, data: { object } }. Do not require byte-identical JSON to the delivered payload.
  • Retention is 7 days. Older events are simply absent.

Resume with cursors

Process each page and save its resumeCursor. While hasMore is true, fetch the next page with nextCursor. After the last page, pass the saved resumeCursor as after on your next poll. An empty page preserves the after you supplied. The first request for an empty history returns null for both cursors.

Concurrent events can become visible in a different order from their creation times. To reconcile all events, periodically read the seven-day history without after and deduplicate by event ID.

Emit a test event

POST /v1/test/events generates a synthetic event through the normal delivery path: it reaches your subscribed test endpoints and appears in GET /v1/events like a real one. It does not accept arbitrary payloads.

It requires a TEST key with webhooks:write. A non-TEST credential returns 400 INVALID_INPUT.

Body parameters

PropType
typestring

The event type to emit. Currently only `shipment.tracking.updated`.

Typestring
resourceIdstring

A TEST shipment owned by your organization. A missing, LIVE, deleted, or foreign one returns `404`.

Typestring
scenariostring

`delivered`, `failed`, or `returned`. Sets the `status` of the emitted `shipment.tracking.updated`.

Typestring
curl -X POST https://api.sendit.mx/v1/test/events \
  -H "X-API-Key: sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "shipment.tracking.updated",
    "resourceId": "shp_test_9f8e7d6c",
    "scenario": "delivered"
  }'
{
  "success": true,
  "data": {
    "id": "evt_5e4d3c2b1a",
    "type": "shipment.tracking.updated",
    "livemode": false,
    "createdAt": "2026-07-17T12:05:00.000Z"
  }
}

The emitted event’s data.object is a minimal shipment projection: id, externalId, carrier and service fields, trackingNumber, status, previousStatus, and timestamps. Do not code your handler against the full shipment projection for these test events.

Errors

Code When it happens How to resolve it
400 INVALID_INPUT Invalid or expired cursor, or a LIVE key on /test/events Restart without a cursor and deduplicate by event ID. To emit an event, use a TEST key.
400 BAD_REQUEST Unknown event type, invalid limit or body, or a livemode parameter Check the documented fields. The key sets the mode.
403 INSUFFICIENT_SCOPE The key lacks webhooks:read or webhooks:write Issue a key with the required scope
404 The resourceId does not identify a TEST shipment in your organization Use the ID of an existing TEST shipment. A draft works.

¿Te ha resultado útil esta página?