# Ingest usage events in batch

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


Batch

This endpoint ingests a batch of usage events into Chargebee.

**Note** : - You can ingest **500** events in a batch ingestion.

**See also**

-   [Limits for Usage-based Billing in Chargebee](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/understanding-usages#usage-based-billing-limits)

## Sample Request

#### cURL

```bash
curl  https://{site}.ingest.chargebee.com/api/v2/batch/usage_events \
     -u {site_api_key}:\
     --header 'Content-Type: application/json;charset=UTF-8' \
     --data '{
     "events": [
          {
               "deduplication_id": "70bf7765-a0a6-457b-8786-9f20378b0t14",
               "subscription_id": "S-300000001",
               "usage_timestamp": "1736076560644",
               "properties": {
                    "input_tokens": 1340,
                    "output_tokens": 6800,
                    "token_ratio": 5.07,
                    "model_name": "gpt-4-turbo",
                    "prompt_type": "chat_completion",
                    "temperature": 0.7,
                    "top_p": 0.8,
                    "frequency_penalty": 0.3,
                    "presence_penalty": 0.2,
                    "fine_tuned": true,
                    "response_time_ms": 140,
                    "completion_success_rate_percent": 96.2,
                    "api_endpoints": "generateSummary",
                    "cpu_usage_percent": 72,
                    "memory_usage_mb": 1950,
                    "webhook_events_sent": 38
               }
          },
          {
               "deduplication_id": "70bf7765-a0a6-457b-8786-9f20378b0f09",
               "subscription_id": "S-300000007",
               "usage_timestamp": "1736076560644",
               "properties": {
                    "input_tokens": 1100,
                    "output_tokens": 7400,
                    "token_ratio": 6.73,
                    "model_name": "gpt-3.5",
                    "prompt_type": "code_completion",
                    "temperature": 0.6,
                    "top_p": 0.85,
                    "frequency_penalty": 0.4,
                    "presence_penalty": 0.15,
                    "fine_tuned": false,
                    "response_time_ms": 180,
                    "completion_success_rate_percent": 99.1,
                    "api_endpoints": "generateCompletion",
                    "cpu_usage_percent": 65,
                    "memory_usage_mb": 2200,
                    "webhook_events_sent": 45
               }
          }
     ]
}'
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;

ApiConfig.Configure("{site}","{site_api_key}");
var eventProperties1 = new Dictionary<string, object>();
eventProperties1.Add("input_tokens", 1340);
eventProperties1.Add("output_tokens", 6800);
eventProperties1.Add("token_ratio", 5.07);
eventProperties1.Add("model_name", "gpt-4-turbo");
eventProperties1.Add("prompt_type", "chat_completion");
eventProperties1.Add("temperature", 0.7);
eventProperties1.Add("top_p", 0.8);
eventProperties1.Add("frequency_penalty", 0.3);
eventProperties1.Add("presence_penalty", 0.2);
eventProperties1.Add("fine_tuned", true);
eventProperties1.Add("response_time_ms", 140);
eventProperties1.Add("completion_success_rate_percent", 96.2);
eventProperties1.Add("api_endpoints", "generateSummary");
eventProperties1.Add("cpu_usage_percent", 72);
eventProperties1.Add("memory_usage_mb", 1950);
eventProperties1.Add("webhook_events_sent", 38);
var eventProperties2 = new Dictionary<string, object>();
eventProperties2.Add("input_tokens", 1100);
eventProperties2.Add("output_tokens", 7400);
eventProperties2.Add("token_ratio", 6.73);
eventProperties2.Add("model_name", "gpt-3.5");
eventProperties2.Add("prompt_type", "code_completion");
eventProperties2.Add("temperature", 0.6);
eventProperties2.Add("top_p", 0.85);
eventProperties2.Add("frequency_penalty", 0.4);
eventProperties2.Add("presence_penalty", 0.15);
eventProperties2.Add("fine_tuned", false);
eventProperties2.Add("response_time_ms", 180);
eventProperties2.Add("completion_success_rate_percent", 99.1);
eventProperties2.Add("api_endpoints", "generateCompletion");
eventProperties2.Add("cpu_usage_percent", 65);
eventProperties2.Add("memory_usage_mb", 2200);
eventProperties2.Add("webhook_events_sent", 45);
var events = new List<UsageEvent.EventBatchIngestInputParams> {
  new UsageEvent.EventBatchIngestInputParamsBuilder().SetDeduplicationId("70bf7765-a0a6-457b-8786-9f20378b0t14").SetSubscriptionId("S-300000001").SetUsageTimestamp(1736076560644L).SetProperties(eventProperties1).Build(),
  new UsageEvent.EventBatchIngestInputParamsBuilder().SetDeduplicationId("70bf7765-a0a6-457b-8786-9f20378b0f09").SetSubscriptionId("S-300000007").SetUsageTimestamp(1736076560644L).SetProperties(eventProperties2).Build()
};
EntityResult result = UsageEvent.BatchIngest()
		.Events(events)
		.Request();
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    usageeventAction "github.com/chargebee/chargebee-go/v3/actions/usageevent"
    "github.com/chargebee/chargebee-go/v3/models/usageevent"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := usageeventAction.BatchIngest(&usageevent.BatchIngestRequestParams{
        Events : []*usageevent.BatchIngestEventParams{
            {
                DeduplicationId : "70bf7765-a0a6-457b-8786-9f20378b0t14",
                SubscriptionId : "S-300000001",
                UsageTimestamp : chargebee.Int64(1736076560644),
                Properties : map[string]interface{}{
    "input_tokens" : 1340,
    "output_tokens" : 6800,
    "token_ratio" : 5.07,
    "model_name" : "gpt-4-turbo",
    "prompt_type" : "chat_completion",
    "temperature" : 0.7,
    "top_p" : 0.8,
    "frequency_penalty" : 0.3,
    "presence_penalty" : 0.2,
    "fine_tuned" : true,
    "response_time_ms" : 140,
    "completion_success_rate_percent" : 96.2,
    "api_endpoints" : "generateSummary",
    "cpu_usage_percent" : 72,
    "memory_usage_mb" : 1950,
    "webhook_events_sent" : 38,
},
            },
            {
                DeduplicationId : "70bf7765-a0a6-457b-8786-9f20378b0f09",
                SubscriptionId : "S-300000007",
                UsageTimestamp : chargebee.Int64(1736076560644),
                Properties : map[string]interface{}{
    "input_tokens" : 1100,
    "output_tokens" : 7400,
    "token_ratio" : 6.73,
    "model_name" : "gpt-3.5",
    "prompt_type" : "code_completion",
    "temperature" : 0.6,
    "top_p" : 0.85,
    "frequency_penalty" : 0.4,
    "presence_penalty" : 0.15,
    "fine_tuned" : false,
    "response_time_ms" : 180,
    "completion_success_rate_percent" : 99.1,
    "api_endpoints" : "generateCompletion",
    "cpu_usage_percent" : 65,
    "memory_usage_mb" : 2200,
    "webhook_events_sent" : 45,
},
            },
        },
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(res)
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.UsageEventBatchIngestRequest{
    Events : []*chargebee.UsageEventBatchIngestEvent{
        {
            DeduplicationId : "70bf7765-a0a6-457b-8786-9f20378b0t14",
            SubscriptionId : "S-300000001",
            UsageTimestamp : chargebee.Int64(1736076560644),
            Properties : map[string]interface{}{
"input_tokens" : 1340,
"output_tokens" : 6800,
"token_ratio" : 5.07,
"model_name" : "gpt-4-turbo",
"prompt_type" : "chat_completion",
"temperature" : 0.7,
"top_p" : 0.8,
"frequency_penalty" : 0.3,
"presence_penalty" : 0.2,
"fine_tuned" : true,
"response_time_ms" : 140,
"completion_success_rate_percent" : 96.2,
"api_endpoints" : "generateSummary",
"cpu_usage_percent" : 72,
"memory_usage_mb" : 1950,
"webhook_events_sent" : 38,
},
        },
        {
            DeduplicationId : "70bf7765-a0a6-457b-8786-9f20378b0f09",
            SubscriptionId : "S-300000007",
            UsageTimestamp : chargebee.Int64(1736076560644),
            Properties : map[string]interface{}{
"input_tokens" : 1100,
"output_tokens" : 7400,
"token_ratio" : 6.73,
"model_name" : "gpt-3.5",
"prompt_type" : "code_completion",
"temperature" : 0.6,
"top_p" : 0.85,
"frequency_penalty" : 0.4,
"presence_penalty" : 0.15,
"fine_tuned" : false,
"response_time_ms" : 180,
"completion_success_rate_percent" : 99.1,
"api_endpoints" : "generateCompletion",
"cpu_usage_percent" : 65,
"memory_usage_mb" : 2200,
"webhook_events_sent" : 45,
},
        },
    },
}
  res, err := client.UsageEvent.BatchIngest(req)
      if err != nil {
        fmt.Println(err)
    } else {
        fmt.Println(res)
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.sql.Timestamp;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        List<UsageEvent.EventBatchIngestInputParams> events = new java.util.ArrayList<>();
        Map<String, Object> properties1 = new java.util.HashMap<String, Object>();
        properties1.put("input_tokens", 1340);
        properties1.put("output_tokens", 6800);
        properties1.put("token_ratio", 5.07);
        properties1.put("model_name", "gpt-4-turbo");
        properties1.put("prompt_type", "chat_completion");
        properties1.put("temperature", 0.7);
        properties1.put("top_p", 0.8);
        properties1.put("frequency_penalty", 0.3);
        properties1.put("presence_penalty", 0.2);
        properties1.put("fine_tuned", true);
        properties1.put("response_time_ms", 140);
        properties1.put("completion_success_rate_percent", 96.2);
        properties1.put("api_endpoints", "generateSummary");
        properties1.put("cpu_usage_percent", 72);
        properties1.put("memory_usage_mb", 1950);
        properties1.put("webhook_events_sent", 38);
        UsageEvent.EventBatchIngestInputParams event0 = new UsageEvent.EventBatchIngestInputParamsBuilder()
                .setDeduplicationId("70bf7765-a0a6-457b-8786-9f20378b0t14")
                .setSubscriptionId("S-300000001")
                .setUsageTimestamp(1736076560644L)
                .setProperties(properties1)
                .build();
        events.add(event0);
        Map<String, Object> properties2 = new java.util.HashMap<String, Object>();
        properties2.put("input_tokens", 1100);
        properties2.put("output_tokens", 7400);
        properties2.put("token_ratio", 6.73);
        properties2.put("model_name", "gpt-3.5");
        properties2.put("prompt_type", "code_completion");
        properties2.put("temperature", 0.6);
        properties2.put("top_p", 0.85);
        properties2.put("frequency_penalty", 0.4);
        properties2.put("presence_penalty", 0.15);
        properties2.put("fine_tuned", false);
        properties2.put("response_time_ms", 180);
        properties2.put("completion_success_rate_percent", 99.1);
        properties2.put("api_endpoints", "generateCompletion");
        properties2.put("cpu_usage_percent", 65);
        properties2.put("memory_usage_mb", 2200);
        properties2.put("webhook_events_sent", 45);
        UsageEvent.EventBatchIngestInputParams event1 = new UsageEvent.EventBatchIngestInputParamsBuilder()
                .setDeduplicationId("70bf7765-a0a6-457b-8786-9f20378b0f09")
                .setSubscriptionId("S-300000007")
                .setUsageTimestamp(1736076560644L)
                .setProperties(properties2)
                .build();
        events.add(event1);
        Result result = UsageEvent.batchIngest()
            .events(events)
            .request();

        UsageEvent usageEvent = result.usageEvent();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.usageEvent.params.UsageEventBatchIngestParams;
import com.chargebee.v4.models.usageEvent.responses.UsageEventBatchIngestResponse;
import java.util.List;
import java.util.Map;

public class UsageEventBatchIngest {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        Map<String, Object> properties0 = new java.util.HashMap<String, Object>();
        properties0.put("input_tokens", 1340);
        properties0.put("output_tokens", 6800);
        properties0.put("token_ratio", 5.07);
        properties0.put("model_name", "gpt-4-turbo");
        properties0.put("prompt_type", "chat_completion");
        properties0.put("temperature", 0.7);
        properties0.put("top_p", 0.8);
        properties0.put("frequency_penalty", 0.3);
        properties0.put("presence_penalty", 0.2);
        properties0.put("fine_tuned", true);
        properties0.put("response_time_ms", 140);
        properties0.put("completion_success_rate_percent", 96.2);
        properties0.put("api_endpoints", "generateSummary");
        properties0.put("cpu_usage_percent", 72);
        properties0.put("memory_usage_mb", 1950);
        properties0.put("webhook_events_sent", 38);
        
        Map<String, Object> properties1 = new java.util.HashMap<String, Object>();
        properties1.put("input_tokens", 1100);
        properties1.put("output_tokens", 7400);
        properties1.put("token_ratio", 6.73);
        properties1.put("model_name", "gpt-3.5");
        properties1.put("prompt_type", "code_completion");
        properties1.put("temperature", 0.6);
        properties1.put("top_p", 0.85);
        properties1.put("frequency_penalty", 0.4);
        properties1.put("presence_penalty", 0.15);
        properties1.put("fine_tuned", false);
        properties1.put("response_time_ms", 180);
        properties1.put("completion_success_rate_percent", 99.1);
        properties1.put("api_endpoints", "generateCompletion");
        properties1.put("cpu_usage_percent", 65);
        properties1.put("memory_usage_mb", 2200);
        properties1.put("webhook_events_sent", 45);
        
        UsageEventBatchIngestParams.EventsParams event0 =
            UsageEventBatchIngestParams.EventsParams.builder()
                .deduplicationId("70bf7765-a0a6-457b-8786-9f20378b0t14")
                .subscriptionId("S-300000001")
                .usageTimestamp(1736076560644L)
                .properties(properties0)
                .build();
        
        UsageEventBatchIngestParams.EventsParams event1 =
            UsageEventBatchIngestParams.EventsParams.builder()
                .deduplicationId("70bf7765-a0a6-457b-8786-9f20378b0f09")
                .subscriptionId("S-300000007")
                .usageTimestamp(1736076560644L)
                .properties(properties1)
                .build();
        
        List<UsageEventBatchIngestParams.EventsParams> eventsList = List.of(event0, event1);

        UsageEventBatchIngestParams params = UsageEventBatchIngestParams.builder()
            .events(eventsList)
            .build();

        UsageEventBatchIngestResponse response = client.usageEvents().batchIngest(params);

        System.out.println(response);
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.usageEvent.batchIngest({
        events: [
            {
                deduplication_id: "70bf7765-a0a6-457b-8786-9f20378b0t14",
                subscription_id: "S-300000001",
                usage_timestamp: 1736076560644,
                properties: {
                    input_tokens: 1340,
                    output_tokens: 6800,
                    token_ratio: 5.07,
                    model_name: "gpt-4-turbo",
                    prompt_type: "chat_completion",
                    temperature: 0.7,
                    top_p: 0.8,
                    frequency_penalty: 0.3,
                    presence_penalty: 0.2,
                    fine_tuned: true,
                    response_time_ms: 140,
                    completion_success_rate_percent: 96.2,
                    api_endpoints: "generateSummary",
                    cpu_usage_percent: 72,
                    memory_usage_mb: 1950,
                    webhook_events_sent: 38
                }
            },
            {
                deduplication_id: "70bf7765-a0a6-457b-8786-9f20378b0f09",
                subscription_id: "S-300000007",
                usage_timestamp: 1736076560644,
                properties: {
                    input_tokens: 1100,
                    output_tokens: 7400,
                    token_ratio: 6.73,
                    model_name: "gpt-3.5",
                    prompt_type: "code_completion",
                    temperature: 0.6,
                    top_p: 0.85,
                    frequency_penalty: 0.4,
                    presence_penalty: 0.15,
                    fine_tuned: false,
                    response_time_ms: 180,
                    completion_success_rate_percent: 99.1,
                    api_endpoints: "generateCompletion",
                    cpu_usage_percent: 65,
                    memory_usage_mb: 2200,
                    webhook_events_sent: 45
                }
            }
        ]
    });

    console.log(result);
    const usageEvent = result.usage_event;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->usageEvent()->batchIngest([
    "events" => [
        [
            "deduplication_id" => "70bf7765-a0a6-457b-8786-9f20378b0t14",
            "subscription_id" => "S-300000001",
            "usage_timestamp" => 1736076560644,
            "properties" => [
                "input_tokens" => 1340,
                "output_tokens" => 6800,
                "token_ratio" => 5.07,
                "model_name" => "gpt-4-turbo",
                "prompt_type" => "chat_completion",
                "temperature" => 0.7,
                "top_p" => 0.8,
                "frequency_penalty" => 0.3,
                "presence_penalty" => 0.2,
                "fine_tuned" => true,
                "response_time_ms" => 140,
                "completion_success_rate_percent" => 96.2,
                "api_endpoints" => "generateSummary",
                "cpu_usage_percent" => 72,
                "memory_usage_mb" => 1950,
                "webhook_events_sent" => 38
            ]
        ],
        [
            "deduplication_id" => "70bf7765-a0a6-457b-8786-9f20378b0f09",
            "subscription_id" => "S-300000007",
            "usage_timestamp" => 1736076560644,
            "properties" => [
                "input_tokens" => 1100,
                "output_tokens" => 7400,
                "token_ratio" => 6.73,
                "model_name" => "gpt-3.5",
                "prompt_type" => "code_completion",
                "temperature" => 0.6,
                "top_p" => 0.85,
                "frequency_penalty" => 0.4,
                "presence_penalty" => 0.15,
                "fine_tuned" => false,
                "response_time_ms" => 180,
                "completion_success_rate_percent" => 99.1,
                "api_endpoints" => "generateCompletion",
                "cpu_usage_percent" => 65,
                "memory_usage_mb" => 2200,
                "webhook_events_sent" => 45
            ]
        ]
    ]
]);
$usageEvent = $result->usage_event;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.UsageEvent.batch_ingest(
    cb_client.UsageEvent.BatchIngestParams(
        events=[
            cb_client.UsageEvent.BatchIngestEventParams(
              deduplication_id="70bf7765-a0a6-457b-8786-9f20378b0t14",
              subscription_id="S-300000001",
              usage_timestamp="1736076560644",
              properties={
    "input_tokens": 1340,
    "output_tokens": 6800,
    "token_ratio": 5.07,
    "model_name": "gpt-4-turbo",
    "prompt_type": "chat_completion",
    "temperature": 0.7,
    "top_p": 0.8,
    "frequency_penalty": 0.3,
    "presence_penalty": 0.2,
    "fine_tuned": True,
    "response_time_ms": 140,
    "completion_success_rate_percent": 96.2,
    "api_endpoints": "generateSummary",
    "cpu_usage_percent": 72,
    "memory_usage_mb": 1950,
    "webhook_events_sent": 38
}
            ),
            cb_client.UsageEvent.BatchIngestEventParams(
              deduplication_id="70bf7765-a0a6-457b-8786-9f20378b0f09",
              subscription_id="S-300000007",
              usage_timestamp="1736076560644",
              properties={
    "input_tokens": 1100,
    "output_tokens": 7400,
    "token_ratio": 6.73,
    "model_name": "gpt-3.5",
    "prompt_type": "code_completion",
    "temperature": 0.6,
    "top_p": 0.85,
    "frequency_penalty": 0.4,
    "presence_penalty": 0.15,
    "fine_tuned": False,
    "response_time_ms": 180,
    "completion_success_rate_percent": 99.1,
    "api_endpoints": "generateCompletion",
    "cpu_usage_percent": 65,
    "memory_usage_mb": 2200,
    "webhook_events_sent": 45
}
            )
        ]
    )
)
print(response)
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::UsageEvent.batch_ingest({
  :events => [{:deduplication_id => "70bf7765-a0a6-457b-8786-9f20378b0t14",:subscription_id => "S-300000001",:usage_timestamp => 1736076560644,:properties => {:input_tokens => 1340,:output_tokens => 6800,:token_ratio => 5.07,:model_name => "gpt-4-turbo",:prompt_type => "chat_completion",:temperature => 0.7,:top_p => 0.8,:frequency_penalty => 0.3,:presence_penalty => 0.2,:fine_tuned => true,:response_time_ms => 140,:completion_success_rate_percent => 96.2,:api_endpoints => "generateSummary",:cpu_usage_percent => 72,:memory_usage_mb => 1950,:webhook_events_sent => 38}},{:deduplication_id => "70bf7765-a0a6-457b-8786-9f20378b0f09",:subscription_id => "S-300000007",:usage_timestamp => 1736076560644,:properties => {:input_tokens => 1100,:output_tokens => 7400,:token_ratio => 6.73,:model_name => "gpt-3.5",:prompt_type => "code_completion",:temperature => 0.6,:top_p => 0.85,:frequency_penalty => 0.4,:presence_penalty => 0.15,:fine_tuned => false,:response_time_ms => 180,:completion_success_rate_percent => 99.1,:api_endpoints => "generateCompletion",:cpu_usage_percent => 65,:memory_usage_mb => 2200,:webhook_events_sent => 45}}]
})
```

## Sample Response

```json
{
  "usage_timestamp": "179506024062",
  "subscription_id": "SUB-1",
  "deduplication_id": "usage-301513005",
  "properties": {
    "input_tokens": 1100,
    "output_tokens": 7400,
    "token_ratio": 6.73,
    "model_name": "gpt-3.5",
    "prompt_type": "code_completion",
    "temperature": 0.6,
    "top_p": 0.85,
    "frequency_penalty": 0.4,
    "presence_penalty": 0.15,
    "fine_tuned": false,
    "response_time_ms": 180,
    "completion_success_rate_percent": 99.1,
    "api_endpoints": "generateCompletion",
    "cpu_usage_percent": 65,
    "memory_usage_mb": 2200,
    "webhook_events_sent": 45
  }
}
```

## URL Format

**POST** https://[site].ingest.chargebee.com/api/v2/batch/usage_events

## Input Parameters

- `events` (optional, array)
  Parameters for batch usage events
  - `deduplication_id` (required, string, max chars=36)
    An identifier used by the Chargebee's customer to distinguish between multiple events generated at the same timestamp for a single `subscription_id`.  
    The combination of `usage_timestamp`, `subscription_id`, and `deduplication_id` uniquely identifies each event.
    
    **Example**: If 3 events are generated for `subscription_id` = `sub-1` at `2025-04-01T00:00:00.000Z`, each event must have a distinct `deduplication_id`.
  - `subscription_id` (required, string, max chars=50)
    The unique identifier of a subscription.
    
    **Note:**
    
    -   If an existing `subscription_id` is provided, usage data is recorded against it.
    -   If the subscription does not exist yet in Chargebee, a new `subscription_id` can be used, and the subscription can be imported later, once the usage is successfully recorded.
    -   During invoice generation, recorded usage linked to the `subscription_id` will be applied to the invoice.
  - `usage_timestamp` (required, long)
    The timestamp indicating when this usage occurred, represented as [Epoch](https://en.wikipedia.org/wiki/Unix_time) time in **milliseconds** . Example: `1738732394123` represents the timestamp for February 5, 2025, at 05:13:14.123 UTC.
    
    **Note**: The timestamp must be within the last **12 hours** .
  - `properties` (required, jsonobject)
    A schema-less field that accepts any JSON-formatted data to define the attributes of the ingested event. It is a requirement to structure the data in a flat format wherever possible for better compatibility with downstream processing. We strongly encourage using unique field names-particularly for fields intended for metering purposes. This approach enhances clarity and maintainability in the future. For example, a field named `status`,
    
    -   Can represent `string` values such as `accepted` or `processing` in one context.
        
    -   In another scenario, it might hold numeric values, such as HTTP response codes like `200`, `300`, or `400`.
        
    
    **Note**:
    
    -   Learn more about [field naming guidelines](/docs/api/usage_files).

## Returns

- `batch_id` (required, string, max chars=36)
  The unique identifier for the batch of usage events processed.

- `failed_events` (always returned)
