Saltar al contenido principal

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: Bearer header
  • Scopes: at least one of attachments:write, messages:write
  • operationId: createAttachment

Parameters​

NameInTypeRequiredDescription
Idempotency-KeyheaderstringYesClient-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)​

FieldTypeRequiredDescription
filenamestringYesName of the file (1 to 255 characters).
mediaTypestringNoMedia type of the file (up to 127 characters).
bytesintegerYesExact size of the file; the upload is rejected if it differs.
sha256Sha256YesSHA-256 digest, lowercase hexadecimal.

Responses​

CodeDescriptionSchema
201Upload reserved.CreateAttachmentResponse
400The 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
401Missing or invalid API key.Problem
413Larger than api.message.maxBytes.Problem
422The request is well formed but cannot be accepted.Problem
429Rate limit or quota exceeded.Problem
503A dependency (storage, ledger, vault, renderer or mail service) is temporarily unavailable. Retry after the number of seconds in Retry-After when present.Problem