Skip to main content
POST
/
v0
/
usage
/
batch
Batch Create
curl --request POST \
  --url https://api.paygentic.io/v0/usage/batch \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "events": [
    {
      "customerId": "<string>",
      "entitlementId": "<string>",
      "idempotencyKey": "<string>",
      "merchantId": "<string>",
      "metadata": {},
      "properties": [
        {
          "billableMetricId": "<string>",
          "price": "<string>",
          "quantity": 123
        }
      ],
      "timestamp": "2023-11-07T05:31:56Z"
    }
  ]
}'
{
  "object": "batchUsageEvents",
  "failed": [],
  "successful": [
    {
      "id": "usg_a1b2c3d4e5f6g7h8",
      "object": "usageEvent",
      "billing": null,
      "consumerId": "org_y1z2a3b4c5d6e7f8",
      "createdAt": "2024-06-01T12:00:05Z",
      "customerId": "cus_q3r4s5t6u7v8w9x0",
      "description": "DALL-E image creation batch job",
      "entitlementId": null,
      "idempotencyKey": "usg_2024_06_01_event1",
      "merchantId": "org_y1z2a3b4c5d6e7f8",
      "metadata": {
        "generation_model": "stable-diffusion-xl",
        "image_resolution": "1024x1024"
      },
      "properties": [
        {
          "billableMetricId": "bm_o7p8q9r0s1t2u3v4",
          "price": null,
          "quantity": 10
        }
      ],
      "subscriptionId": "sub_g9h0i1j2k3l4m5n6",
      "timestamp": "2024-06-01T12:00:00Z"
    },
    {
      "id": "usg_b2c3d4e5f6g7h8i9",
      "object": "usageEvent",
      "billing": null,
      "consumerId": "org_y1z2a3b4c5d6e7f8",
      "createdAt": "2024-06-01T13:00:05Z",
      "customerId": "cus_q3r4s5t6u7v8w9x0",
      "description": "GPT-4 fine-tuning compute session",
      "entitlementId": "com_c1d2e3f4g5h6i7j8",
      "idempotencyKey": "usg_2024_06_01_event2",
      "merchantId": "org_y1z2a3b4c5d6e7f8",
      "metadata": {
        "model_size": "large",
        "training_hours": "8.5"
      },
      "properties": [
        {
          "billableMetricId": "bm_k9l0m1n2o3p4q5r6",
          "price": null,
          "quantity": 8.5
        }
      ],
      "subscriptionId": "sub_g9h0i1j2k3l4m5n6",
      "timestamp": "2024-06-01T13:00:00Z"
    }
  ],
  "summary": {
    "failed": 0,
    "successful": 2,
    "total": 2
  }
}

Authorizations

Authorization
string
header
required

API key authentication

Body

application/json
events
object[]
required

Response

Usage events created successfully

object
enum<string>
required
Available options:
batchUsageEvents
failed
object[]
required

Array of events that failed to be created with error details

successful
object[]
required

Array of successfully created usage events

summary
object
required

Summary of batch processing results