Skip to main content

When to Use Batch

Use batch endpoints when:
  • Settling multiple bets after a game concludes (e.g., 100 bets on a football match)
  • Importing historical data from a legacy system
  • Catch-up ingestion after downtime or network issues
  • High-frequency scenarios where individual calls would exceed rate limits
Batch endpoints accept up to 500 events per request. For more than 500 events, split them into multiple batch calls.

Batch Endpoints

Each domain has a batch variant:

Batch Request Format

All batch endpoints use the same envelope:
Each event in the array has the same schema as the single-event endpoint.

Example — Batch Sport Updates

Sending one open and two results (win and lose):

Batch Response

Full Success — 202 Accepted

All events were accepted and published to Kafka:

Partial Failure — 207 Multi-Status

Some events failed (e.g., Kafka publish error for specific events):

Validation Failure — 422 Unprocessable Entity

The entire batch is rejected if any event fails struct validation:
A 422 error means no events were processed. Fix the validation error and resubmit the entire batch. This is different from a 207 where partial events succeed.

Error Handling Pattern

Performance Tips

Optimal batch size: 100–200 events per call balances throughput and failure isolation. Larger batches (up to 500) increase efficiency but mean more events to retry on partial failure.

Deduplication

Atlas deduplicates events using the bet_id / round_id / transaction_id fields within each domain. Sending the same event twice will result in only one being processed.
Deduplication is eventual (within a few seconds). In high-throughput scenarios, avoid sending the same event in rapid succession as the dedup window may not have closed.