Attachments
Upload large attachments before submitting a message.
POST /v1/attachments
Reserve an attachment and get a presigned upload
For attachments that do not fit inline. Upload the file with the returned
request, then reference attachmentId in POST /v1/messages. Unused uploads
are deleted after retention.staging.days.
- Authentication: API key in the
Authorization: Bearerheader - Scopes: at least one of
attachments:write,messages:write - operationId:
createAttachment
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | Yes | Client-generated key, scoped to the tenant. Repeating a request with the same key and the same body returns the original response with Idempotent-Replayed: true; the same key with a different body is rejected with 422 idempotency_key_reused. |
Request body (application/json)
| Field | Type | Required | Description |
|---|---|---|---|
filename | string | Yes | Name of the file (1 to 255 characters). |
mediaType | string | No | Media type of the file (up to 127 characters). |
bytes | integer | Yes | Exact size of the file; the upload is rejected if it differs. |
sha256 | Sha256 | Yes | SHA-256 digest, lowercase hexadecimal. |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Upload reserved. | CreateAttachmentResponse |
400 | The request is malformed. The body is not valid JSON or not a JSON object, a field is invalid (errors lists each one), a header or query parameter is invalid, or the Content-Type is not application/json where a JSON body is expected (unsupported_media on the control plane). | Problem |
401 | Missing or invalid API key. | Problem |
413 | Larger than api.message.maxBytes. | Problem |
422 | The request is well formed but cannot be accepted. | Problem |
429 | Rate limit or quota exceeded. | Problem |
503 | A dependency (storage, ledger, vault, renderer or mail service) is temporarily unavailable. Retry after the number of seconds in Retry-After when present. | Problem |