OhMyGPT
Files

Upload file

POST
/v1/files

Upload a JSONL file to use as Batch input. The upload is checked right away: the file must be UTF-8 and every line must be a JSON object, and an error names the line. Each request in the file is checked against the endpoint when you create the batch.

Authorization

ApiKeyAuth
headerAuthorization<token>

Request Body

multipart/form-data
  1. body
expires_after[anchor]?"created_at"
Value in"created_at"
expires_after[seconds]?integer

Seconds after upload until the file expires. Without expires_after, the file expires after 30 days.

Range3600 <= value <= 2592000
file*file

The batch input: JSONL with one request per line, each line a JSON object with custom_id, method, url, and body. At most 128 MB.

Formatbinary
purpose*"batch"

Only batch is accepted. Files are used as Batch input.

Value in"batch"

Response Body

The uploaded file

application/json
  1. response
bytes*integer
created_at*integer

Unix seconds.

expires_at?integer

Unix seconds. Absent on batch result files, which the provider keeps for its own retention period.

filename*string
id*string

file-… for an uploaded file; <batch_id>_output or <batch_id>_error for a batch result file.

object*"file"
Value in"file"
purpose*string
Value in"batch""batch_output"
status*"processed"
Value in"processed"
Example Request
curl -X POST 'https://api.ohmygpt.com/v1/files' \  -F 'file=string' \  -F 'purpose=batch'
Example Response
{  "bytes": 0,  "created_at": 0,  "expires_at": 0,  "filename": "string",  "id": "string",  "object": "file",  "purpose": "batch",  "status": "processed"}

Was this page helpful?

Still stuck? Live chat · [email protected] · Telegram group