Skip to main content
POST
Create an attachment
  • Credential: an API key. A trial key returns 401 unauthorized. See Sending a file.
  • Line-scoped keys: the list of a line-scoped key is not applied: an attachment belongs to the account.
  • Idempotency-Key: honored. The key belongs to the account. While the attachment is awaiting_upload and before its deadline, a repeat returns the same id with a new upload_url. See Creating an attachment.
  • Events: none, also when the attachment becomes ready, failed or expired.
  • Personal data: filename is shown to the contact and can hold personal data, and upload_url is a credential until upload_expires_at. Do not copy them into logs, tickets or other tools.
  • Next steps: upload the file with one PUT to upload_url, with required_headers, before upload_expires_at. Then wait for status: ready before you send the attachment.

Errors

The errors that every operation shares are in Errors.

Authorizations

Authorization
string
header
required

An API key created in the iSnap dashboard, or a trial key, sent as Authorization: Bearer <key>. An API key starts with isnap_live_ or isnap_test_; both act on the same account, lines and billing. A trial key acts on its trial only.

Body

application/json

The file to register. iSnap does not check these values against the uploaded file.

filename
string
required

File name, 1 to 255 characters. It is returned on the attachment and on the messages that carry it.

Required string length: 1 - 255
content_type
string
required

Content type of the file, 1 to 100 characters, for example image/jpeg. Every value is accepted. A value that starts with audio/ makes iSnap convert the file before the attachment is ready.

Required string length: 1 - 100
size_bytes
integer
required

Size of the file in bytes: at least 1 and at most 5,368,709,120 (5 GiB). Above it the API returns 413 attachment_exceeds_storage_limit. Above 100,000,000 the call succeeds and warnings contains large_attachment_may_delay_delivery.

Required range: 1 <= x <= 5368709120

Response

The attachment, created and waiting for the upload.

success
enum<boolean>
required

Always true on a success response.

Available options:
true
data
object
required

The attachment created, with the URL to upload its file to.

trace_id
string
required

Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap.

request_id
string
required

Id of the request that produced this response: req_ followed by 25 letters or digits.