This document describes how each type of object in the batch gateway is created and deleted, following the OpenAI Batch API behavior.
- Creation: Created when the user calls
POST /v1/batches. Exists in database only, no physical files. - Deletion: Never deleted — retained for audit and history. OpenAI does not expose a
DELETE /batchesendpoint either.
- Creation: Created by batch gateway service. Exists in events queue.
- Deletion: Automatically deleted after the TTL expires (default: 30 days, configurable via
batch_event_ttl_seconds).
- Creation: Created when the user calls
POST /v1/fileswithpurpose=batch. - Deletion: Deleted by two triggers, both resulting in a full deletion (physical file + database record):
-
User calls
DELETE /v1/files/{file_id}— deleted immediately. -
Cleanup service removes the file on expiration.
Expiration is resolved in this order:
- User-provided
expires_afterwhen callingPOST /v1/files(secondsmust be between 3600 (1 hour) and 2592000 (30 days)):
-F expires_after[anchor]="created_at" -F expires_after[seconds]=86400- Otherwise, falls back to configuration
default_file_expiration_seconds(default: 90 days).
Deletion Rules:
- If expiration > 0, the cleanup service deletes the input file after that many seconds.
- If expiration <= 0, input files are never deleted.
- User-provided
-
- Creation: Created by the batch processor after a batch job completes. If a batch is cancelled, partial results from requests that completed before cancellation are also written to the output file.
- Deletion: Deleted by two triggers, both resulting in a full deletion (physical file + database record):
-
User calls
DELETE /v1/files/{file_id}— deleted immediately. -
Cleanup service removes the file on expiration.
Expiration is resolved in this order:
- User-provided
output_expires_afterwhen creating the batch viaPOST /v1/batches(anchoris the output/error file creation time, not the batch creation time;secondsmust be between 3600 (1 hour) and 2592000 (30 days)):
"output_expires_after": { "anchor": "created_at", "seconds": 3600 }
- Otherwise, falls back to configuration
default_output_expiration_seconds(default: 90 days).
Deletion Rules:
- If expiration > 0, the cleanup service deletes the output and error file after that many seconds.
- If expiration <= 0, output and error files are never deleted.
- User-provided
-