Events

Ingest events in batch

Submit up to 100 events in one request, each accepted or rejected on its own with an outcome in results and its own idempotency_key.

post/v1/events/batch

Request

  • Base URL: https://api.scrip.dev
  • URL: https://api.scrip.dev/v1/events/batch
  • Auth: HTTP bearer

Headers

Idempotency-Keystring

A key you choose to make this request safe to retry: 1 to 255 printable ASCII characters. Send the same key with the same request to get the first response again, marked Idempotent-Replayed: true. Routes that return a secret once, and claim links, do not replay a response. Event ingest uses the key as the event's identity.

Request body

Example request

{
  "events": [
    {
      "event_data": {
        "amount": 120,
        "type": "purchase"
      },
      "event_timestamp": "2027-01-15T10:30:00Z",
      "external_id": "user_123",
      "idempotency_key": "order-1001-completed",
      "participant_id": "f7a8b9c0-1d2e-4f3a-b4c5-d6e7f8a9b006",
      "program_id": "8f14e45f-ceea-4e70-9df8-2a7d1b3c9f01",
      "recipient_external_id": "user_xyz789",
      "recipient_id": "f7a8b9c0-1d2e-4f3a-b4c5-d6e7f8a9b007"
    }
  ]
}

Response

Batch accepted for async processing

error_countinteger

Number of events rejected before ingestion

success_countinteger

Number of events accepted for asynchronous processing

totalinteger

Number of submitted items, including accepted and rejected events

Example response

{
  "error_count": 1,
  "results": [
    {
      "error": {
        "code": "insufficient_funds",
        "doc_url": "https://docs.scrip.dev/errors#insufficient_funds",
        "fields": [
          {
            "reason": "required"
          }
        ],
        "message": "Insufficient funds",
        "request_id": "req_6f1c2d7e-4b7a-4c0e-9c1a-2f3e4d5c6b7a",
        "type": "unprocessable"
      },
      "event": {
        "event_timestamp": "2027-01-15T10:30:00Z",
        "external_id": "user_123",
        "id": "e5dc1b6a-7f3d-4e2a-8c1b-9a0f4d7e6c05",
        "idempotency_key": "order-1001-completed",
        "participant_id": "f7a8b9c0-1d2e-4f3a-b4c5-d6e7f8a9b006",
        "program_id": "8f14e45f-ceea-4e70-9df8-2a7d1b3c9f01",
        "status": "PENDING",
        "status_url": "/v1/events/e5dc1b6a-7f3d-4e2a-8c1b-9a0f4d7e6c05"
      },
      "status": "ACCEPTED"
    }
  ],
  "success_count": 9,
  "total": 10
}

Changes

No recorded changes to this operation across all 1 revision of this API.