Upload a file to attach to an email

POST
/v1/attachments

Send the file itself as the request body (any content type), with its name in the x-file-name header (URL-encoded). The answer's uploadId stands for the kept file for one hour: pass it as { "uploadId" } in attachments when you send, reply, forward or write a draft. A program or script is refused at once, and a file over the workspace's limit is refused with 413. Nothing is sent by uploading.

Requires an API key with the messages:send scope.

Authorization

apiKey
headerAuthorizationBearer <token>

A secret API key from the dashboard (Developers → API keys): vl_live_…, or vl_test_… for test mode. Each operation says which scope the key needs.

Response Body

The file is kept for one hour; use uploadId in attachments

application/json
  1. response
upload*
summary*string
Example Request
curl -X POST https://api.vlayers.ai/v1/attachments \  -H "Authorization: Bearer $VOICELAYER_API_KEY"
Example Response
{  "upload": {    "id": "upload",    "name": "quote.pdf",    "contentType": "application/pdf",    "sizeBytes": 48211,    "uploadId": "eyJ2IjoxLCJwIjoib3JnXzEifQ.3f2a",    "expiresAt": "2026-10-20T15:04:05.000Z"  },  "summary": "\"quote.pdf\" is ready to attach. It stays available for one hour."}