Attachments
Upload files to AgentSend and attach them to outgoing messages. Retrieve presigned URLs to download or share attachment content.
Upload an attachment first, then reference its id in the attachmentIds field when sending a message. Attachments are stored securely and accessible via time-limited presigned URLs.
Upload Attachment
Uploads a file and returns an Attachment object. Use the returned id to attach the file to a message. The request must use multipart/form-data encoding.
Request Body
Content-Type: multipart/form-data
| Field | Type | Description |
|---|---|---|
file obrigatório |
file | The file to upload. The filename and content type are inferred from the uploaded part. |
Example Request
curl -X POST https://api.agentsend.io/attachments \ -H "x-api-key: $AGENTSEND_API_KEY" \ -F "file=@/path/to/report.pdf"
const form = new FormData(); form.append("file", fileBlob, "report.pdf"); const res = await fetch("https://api.agentsend.io/attachments", { method: "POST", headers: { "x-api-key": process.env.AGENTSEND_API_KEY }, body: form, }); const attachment = await res.json(); console.log(attachment.id); // use this id when sending a message
Response — 201 Created
{
"id": "att_01j9zxkp4qbc7n3m8td5e6fvg2",
"filename": "report.pdf",
"contentType": "application/pdf",
"size": 204800,
"url": "https://storage.agentsend.io/att_01j9zxkp4qbc7n3m8td5e6fvg2/report.pdf?token=...",
"createdAt": "2025-11-10T08:15:00Z"
}Get Attachment
Retrieves metadata and a short-lived presigned download URL for an attachment. Use the url field to download or display the file content directly.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id obrigatório |
uuid | The ID of the attachment to retrieve. |
Example Request
curl https://api.agentsend.io/attachments/att_01j9zxkp4qbc7n3m8td5e6fvg2 \
-H "x-api-key: $AGENTSEND_API_KEY"Response — 200 OK
{
"id": "att_01j9zxkp4qbc7n3m8td5e6fvg2",
"filename": "report.pdf",
"contentType": "application/pdf",
"size": 204800,
"url": "https://storage.agentsend.io/att_01j9zxkp4qbc7n3m8td5e6fvg2/report.pdf?token=...",
"createdAt": "2025-11-10T08:15:00Z"
}Attachment Object
| Field | Type | Description |
|---|---|---|
id |
string | Unique identifier for the attachment. |
filename |
string | Original filename as provided at upload time. |
contentType |
string | MIME type of the file (e.g. application/pdf, image/png). |
size |
number | File size in bytes. |
url |
string | Presigned URL to download the file. This URL is time-limited; fetch a fresh one by calling this endpoint again if it expires. |
createdAt |
string | ISO 8601 timestamp when the attachment was uploaded. |
Presigned URLs expire after a short period. If you need to share or re-download an attachment, call GET /attachments/{id} again to obtain a fresh URL.