Easymailing
Email composing

Upload a file to attach to an email

PUT /email_attachments/{uuid}

PUT/email_attachments/{uuid}

Uploads one file and stores it under the UUID you choose, ready to be listed in attachment_ids of a draft or a send. The body is the raw file; nothing is sent to anyone.

When to use: Before create_email_draft, update_email_draft, send_email, schedule_email or send_email_batch when the email carries a file.

When not to use: To forward the attachments of a received email, do not upload them: send forwarded_attachment_ids with mode forward. There is no operation to attach a file of the CRM Files directly: download it and upload it here.

Side effects: Stores the file for the user. An uploaded file that no draft or send uses is deleted after 24 hours. While it belongs to a draft it counts against the CRM Files storage of the account. Repeating the same upload (same id, same bytes) is safe and returns the same attachment.

Permissions: Requires a CRM seat and the crm.contacts_companies.write capability.

Authorization

X-Auth-Token<token>

Value for the X-Auth-Token header parameter.

In: header

Path Parameters

uuid*string

A UUID you generate for this attachment. Use it later in attachment_ids.

Formatuuid

Header Parameters

X-Attachment-Name*string

File name, UTF-8 percent-encoded (never put it in the URL).

Lengthlength <= 1024
Content-Type*string

Must be application/octet-stream.

Request Body

application/octet-stream

The raw bytes of the file (not JSON, not multipart). Up to 20 MiB (20,971,520 bytes), the limit of the public API host; empty files and file types that Gmail blocks (executables and similar) are refused.

TypeScript Definitions

Use the request body type in TypeScript.

body*file
Formatbinary

Response Body

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

curl -X PUT "https://api.easymailing.com/email_attachments/3a9e1f5b-0000-4000-8000-6c474d08b1ac" \  -H "X-Auth-Token: YOUR_API_KEY" \  -H "X-Attachment-Name: proposal.pdf" \  -H "Content-Type: application/octet-stream" \  -H "Content-Type: application/octet-stream" \  -d 'string'
{  "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",  "name": "string",  "size_bytes": 1,  "mime_type": "string"}