Event Ingestion Endpoint API

URL: https://dev.client-events.runonatlas.com

Method: POST

Authentication: The API requires authentication using an API key, which should be included in the request headers.

  • Header: x-api-key
  • Value: Provided by Atlas

Request Body: The request body should be formatted in JSON and include the following fields:

{
    "customerId": "3421111123",  // ID of the customer sending the event (REQUIRED)
    "eventName": "AI Function Called",  // Name of the event (REQUIRED)
    "idempotencyKey": "9TPt1VM2C5JKaICVCT23450Lim5p9lu4",  // Unique key to ensure idempotency 
    "timestamp": "2024-09-24T20:09:19Z",  // (OPTIONAL; will be generated if not provided)
    "payload": {  
        "status": "success",  // Status of the event (100% OPTIONAL) // these are just examples can use 
        "total_token": "236",  // Number of tokens used (100% OPTIONAL) //any key : value
        "cpu_time": "79"  // CPU time consumed (100% OPTIONAL)
    }

Required Fields:

  • customerId: The ID of the customer responsible for the event (required for event tracking and billing).
  • eventName: The ID of the customer responsible for the event (required for event tracking and billing).

Optional Fields:

  • idempotencyKey: A unique key to ensure the event is processed only once. This is recommended, especially for events that might be retried.
  • timestamp: The time the event occurred. If not provided, a timestamp will be generated automatically.
  • payload: A flexible section for any additional data about the event. While the fields in the payload are entirely optional, they allow you to include information like:
  • status: Outcome of the event (e.g. success, failure)
  • total_token: Total number of tokens consumed, which may affect billing.
  • cpu_time: CPU time used, potentially relevant for resource-based billing.

Add anything you want or may want to use to bill your customers, even if you don’t have use for the field right now, but may in the future, add it! If these optional fields are left out, Atlas will assume default values, and charges may only be based on the submission of the event itself, not on resource usage.

curl -X POST https://dev.client-events.runonatlas.com \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key-here" \
-d '{
    "customerId": "3421111123",
    "eventName": "AI Function Called",
    "idempotencyKey": "9TPt1VM2C5JKaICVCT23450Lim5p9lu4",
    "timestamp": "2024-09-24T20:09:19Z",
    "payload": {
        "status": "success",
        "total_token": "236",
        "cpu_time": "79"
    }
}'

Response: The API will return the following status codes:

  • 200 OK: Event successfully processed.
  • 400 Bad Request: Missing or invalid fields.
  • 401 Unauthorized: Invalid or missing API key.
  • 500 Internal Server Error: Server issues.

Idempotency: Ensure the same event isn’t processed multiple times by using an idempotencyKey. This key ensures retries don’t duplicate charges or event records.

Notes:

  • Use the x-api-key header to authenticate.
  • Only the customerId and eventName fields are required, but adding fields in the payload (like total_token and cpu_time) may be essential if your charges are usage-based.