Skip to main content

Endpoint

GET /cases/{id}/attachments/{attachmentId}

Purpose

Returns a fresh AgentMail download link for an attachment already stored on the case.

Authentication

x-api-key: your-api-key

Path Parameters

ParameterTypeRequiredNotes
idstringYesCase ID
attachmentIdstringYesAttachment ID from attachments on the case or webhook payload

Example Request

curl -H "x-api-key: $OFFLOAD_API_KEY" \
  "$OFFLOAD_BASE_URL/cases/4fc5904d-0e44-4ed3-aa57-c4a47ad0ae4f/attachments/63016fee-124b-46d8-a3e5-616f187a6c41"

Example Response

{
  "ok": true,
  "data": {
    "attachmentId": "63016fee-124b-46d8-a3e5-616f187a6c41",
    "name": "vendor-w9.pdf",
    "size": 904860,
    "type": "application/pdf",
    "messageId": "<message-id@example.com>",
    "inboxId": "dev-test@agentmail.to",
    "receivedAt": 1774131900000,
    "downloadUrl": "https://cdn.agentmail.to/attachments/63016fee-124b-46d8-a3e5-616f187a6c41?...",
    "expiresAt": "2026-03-21T16:42:00.000Z"
  }
}

Notes

  • downloadUrl is temporary.
  • expiresAt is an ISO 8601 timestamp.
  • Request the file URL only when you are ready to fetch the file.

Errors

StatusCodeMeaning
400INVALID_REQUESTMissing case ID or attachment ID
401UNAUTHORIZEDMissing or invalid API key
403FORBIDDENInactive API key or case belongs to another user
404CASE_NOT_FOUNDNo case exists for that ID
404ATTACHMENT_NOT_FOUNDAttachment is not stored on the case
500INTERNAL_ERRORAttachment lookup against AgentMail failed