Create an upload
POST/v1/agents/:agentId/uploads
x-scope: "uploads:write"
x-rate-limit-per-minute: 10
Stages one file for 24 hours, so it can be used anywhere a media link is taken. Two ways:
- Send the bytes yourself. Give
file_nameand the exactsize_bytes. The upload comes backpending, withupload: the URL, method (PUT) and headers to send the file with, valid for 15 minutes. Send the whole file as the request body with those headers (putUploadContent), for examplecurl -X PUT -H "X-Upload-Token: …" -H "Content-Type: application/octet-stream" --data-binary @photo.png "$UPLOAD_URL", withupload.urlasUPLOAD_URL. - Hand over a file as a link. Give
file, as ChatGPT passes a file the user attached (download_url,file_id, and maybemime_typeandfile_name). Mojeeb downloads it in this call, within 20 seconds, from a public https address (following up to 3 redirects, each to a public https address too), and the upload comes backready.
An upload holds a JPEG, PNG or WebP image, an MP4 or MOV video, or a PDF or DOCX
document, up to 20 MB, its type read from its bytes. Each feature that then reads it checks
it against its own types and sizes. Use its url in the media field you need, within 24
hours. A member of the agent can create one; using it needs that feature's own scope. It
spends a budget of 10 requests a minute per key.
Request
Responses
- 201
- 401
- 403
- 404
- 413
- 422
- 429
- 500
- 503
The upload, pending until its bytes are sent, or ready when it was downloaded.
Response Headers
Correlation id for this request — paste into support tickets.
Authentication failed. Single code (invalid_api_key) covers every
sub-case: missing header, wrong scheme, malformed, unknown, revoked or
expired key. The message field disambiguates for humans debugging.
One exception: when the key could not be checked because of a server-side
fault, the status is still 401 but type is internal_error and code
is internal_server_error; retry with backoff.
Response Headers
Correlation id for this request — paste into support tickets.
Authenticated, but not allowed: insufficient_scope (the key lacks the scope in this
operation's x-scope) or agent_not_authorized (the key is limited to other agents).
Response Headers
Correlation id for this request — paste into support tickets.
agent_not_found when the agent is not one of your company's agents (the API never confirms
whether another company's agent exists); endpoint_not_found for a path or method no
endpoint serves, including an id that is not a UUID.
Response Headers
Correlation id for this request — paste into support tickets.
The request body is larger than 1 MB.
Response Headers
Correlation id for this request — paste into support tickets.
invalid_request_body when the body breaks its schema (send file, or file_name with
size_bytes, not both); upload_too_large for a size of 0 or over 20 MB;
upload_size_mismatch when the bytes sent aren't exactly size_bytes;
upload_type_not_allowed when the bytes aren't a JPEG, PNG or WebP image, an MP4 or MOV
video, or a PDF or DOCX document; upload_url_invalid when file.download_url can't
be downloaded.
Response Headers
Correlation id for this request — paste into support tickets.
Per-key rate limit hit. Default is 60/min/key; an endpoint with an
x-rate-limit-per-minute of its own counts in a budget of its own
(today the WhatsApp template endpoints, sendBroadcast, retryBroadcast, inviteMember,
resendInvitation, uploadAttachmentMedia, importAttachmentMedia, createUpload and
importSavedReplyMedia, which share one that allows 10/min/key,
sendConversationMessage, which allows 20/min/key; putUploadContent takes no key and
allows the default 60/min per IP address), and its 429
reports that limit in X-RateLimit-Limit. Retry-After tells you when to retry;
X-RateLimit-Reset is the Unix timestamp of the next window.
Per-success-response
X-RateLimit-*headers are a known gap; on 2xx responses these headers are NOT currently emitted. Customers should rely on 429 +Retry-Afterfor backoff signals.
Response Headers
Correlation id for this request — paste into support tickets.
Seconds to wait before retrying.
The per-minute request limit of the endpoint called. Every key has the same limits today.
Remaining requests in the current window. 0 on rejection.
Unix timestamp at which the current window resets.
Unexpected server-side failure. Retry with exponential backoff. If
the failure persists, send us the correlation_id.
Response Headers
Correlation id for this request — paste into support tickets.
Mojeeb couldn't check access because of a temporary fault: the key's,
or on assignLead and assignConversation the teammate's. Nothing was
changed. Retry with backoff.
Response Headers
Correlation id for this request — paste into support tickets.