Docs
API · emails

List attachments

List the attachment metadata for a message. The bytes are never inlined — download each file with an authenticated GET on its url.

GET/v1/emails/{id}/attachments

Works for both directions: for an inbound message the attachments are parsed from the received MIME; for an outbound message they're the files you sent. Each entry includes a url you fetch with your bearer token to stream the bytes.

01 Path parameters

idstringRequired
The message id.

02 Request

# List metadata
curl https://api.drin.run/v1/emails/msg_01HZX9K3T2QF7P0M4N8B6C5D/attachments \
  -H "Authorization: Bearer $DRIN_API_KEY"

# Download the bytes — authenticate the GET on each url
curl -L -o invoice.pdf \
  "https://api.drin.run/v1/emails/msg_01HZX9K3T2QF7P0M4N8B6C5D/attachments/att_01HZX7" \
  -H "Authorization: Bearer $DRIN_API_KEY"

03 Response

200 OK — a data array of attachment metadata. The array is empty when the message has no attachments.

200 OK
{
  "data": [
    {
      "id": "att_01HZX7M9P2",
      "filename": "invoice.pdf",
      "contentType": "application/pdf",
      "size": 48213,
      "url": "https://api.drin.run/v1/emails/msg_01HZX9K3T2QF7P0M4N8B6C5D/attachments/att_01HZX7M9P2"
    }
  ]
}

Fields

idstringOptional
The attachment identifier.
filenamestringOptional
The file name.
contentTypestringOptional
The MIME type, e.g. application/pdf.
sizeintegerOptional
The size in bytes.
urlstringOptional
The authenticated download URL. GET it with your Authorization: Bearer header to stream the bytes.
The url needs your keyThe download url isn't a public link — it requires the same Authorization: Bearer header as every other request. Don't hand it to a browser or embed it where the key would leak.