Skip to main content
POST
/
api
/
v1
/
usage
/
ingest-async
Asynchronously Ingest Usage Data
curl --request POST \
  --url https://api.justpaid.io/api/v1/usage/ingest-async \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "events": [
    {
      "customer_id": "123e4567-e89b-12d3-a456-426614174000",
      "event_name": "purchase_made",
      "timestamp": "2023-10-01T12:00:00Z",
      "idempotency_key": "unique-key-1",
      "event_value": 49.99,
      "properties": {
        "item_id": "A100",
        "quantity": 2
      }
    },
    {
      "customer_id": "123e4567-e89b-12d3-a456-426614174001",
      "event_name": "subscription_started",
      "timestamp": "2023-10-02T15:30:00Z",
      "idempotency_key": "unique-key-2",
      "event_value": 0,
      "properties": {
        "plan": "premium",
        "duration": "12_months"
      }
    }
  ]
}'
{
  "job_id": "a4f8e9be-3d5b-4f8e-8b4d-9b4e5c9f5a2d",
  "status": "PENDING",
  "total_events": 2,
  "created_at": "2023-10-10T10:00:00Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Represents a list of customer events.

Attributes: events (list[CustomerEvent]): A list of customer events. Each event should be a dictionary with at-least the following keys: event_name, timestamp, idempotency_key.

events
CustomerEvent · object[]

Response

Successfully submitted the usage data for asynchronous processing.

job_id
string<uuid>
required

The UUID of the created batch job.

status
string
required

The status of the created batch job.

total_events
integer
required

The total number of events in the batch job.

created_at
string<date-time>
required

The timestamp when the batch job was created.