---
title: "Send up to 500 usage events"
description: "One result for each event, in order."
canonical_url: "https://twominutebilling.com/help/developers/api-reference/usage/send-up-to-500-usage-events"
---
# Send up to 500 usage events

> One result for each event, in order.

<api-operation method="POST" path="/v1/businesses/{biz}/usage_events/batch">
<template v-slot:docs="">

A refused event does not stop the others. The batch counts as one request against the rate limit. 400 only for a malformed body or more than 500 events.

## Path parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        biz
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The business's id (biz_…).
    </td>
  </tr>
</tbody>
</table>

## Body

The request body is **required**.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        events
      </code>
    </td>
    
    <td>
      <code>
        array of object
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The usage event batch's events.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        events.key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      Your idempotency key for this event, unique per business.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        events.customer
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      A usage key of the customer, or the customer id (cus_…).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        events.event_name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The usage event's event name.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        events.timestamp
      </code>
    </td>
    
    <td>
      <code>
        string · ISO-8601
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      RFC 3339 with <code>
        Z
      </code>
      
       or an offset. From 35 days in the past to 5 minutes in the future. Default: now.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        events.properties
      </code>
    </td>
    
    <td>
      <code>
        object
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Flat, up to 50 keys and 8 KB. A meter's value property must be a number from -10^12 to 10^12 with at most 12 decimal places; a number is read from its exact text.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        events.amount
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Major units, from -10^12 to 10^12. A decimal string with at most 12 decimal places and no exponent, for example <code>
        "0.000125"
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        events.cost
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Your cost, major units, from -10^12 to 10^12. A decimal string with at most 12 decimal places and no exponent, for example <code>
        "0.000125"
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        events.currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Default: the price's currency.
    </td>
  </tr>
</tbody>
</table>

## Response

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        results
      </code>
    </td>
    
    <td>
      <code>
        array of object
      </code>
    </td>
    
    <td>
      The usage event batch result's results.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        created
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      The usage event batch result's created.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        duplicates
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      The usage event batch result's duplicates.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        errors
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      The usage event batch result's errors.
    </td>
  </tr>
</tbody>
</table>

## Status codes

<table>
<thead>
  <tr>
    <th>
      Status
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        200
      </code>
    </td>
    
    <td>
      A result for each event.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        400
      </code>
    </td>
    
    <td>
      The body is not correct, or it has more than 500 events.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        429
      </code>
    </td>
    
    <td>
      Your organization sent more usage requests in one second than its limit. Send again after <code>
        Retry-After
      </code>
      
       seconds.
    </td>
  </tr>
</tbody>
</table>
</template>

<template v-slot:request="">

```bash [Request]
curl -X POST "$TMBILLING_URL/v1/businesses/biz_XXXXXXXXXXXX01/usage_events/batch" \
  -H "Authorization: Bearer $TMBILLING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "events": [
      {
        "key": "resp_XXXXXXXXXXXX01:input",
        "customer": "workspace-4821",
        "event_name": "ai_tokens",
        "currency": "USD"
      }
    ]
  }'
```

</template>

<template v-slot:response="">
<code-group>

```json [200 OK]
{
  "results": [
    {
      "index": 0,
      "key": "seats",
      "status": "created"
    }
  ],
  "created": 1,
  "duplicates": 1,
  "errors": 1
}
```

```json [400 Bad Request]
{
  "error": {
    "type": "invalid_request_error",
    "message": "The body is not correct, or it has more than 500 events."
  }
}
```

```json [429 Too Many Requests]
{
  "error": {
    "type": "rate_limit_error",
    "message": "Your organization sent more usage requests in one second than its limit."
  }
}
```

</code-group>
</template>
</api-operation>


## Sitemap

See the full [sitemap](https://twominutebilling.com/sitemap.md) for all pages.
