API referenceAttachments

Mint a branded, shareable link for an attachment

Identical response shape to the /url variant — the attachment metadata, a downloadUrl, a shareUrl, and expiresInSeconds — but always returns the branded, Dairo-hosted download link and its companion human share page, which is what you want for a link a person will click or that you'll paste into another app.

Endpoint
GET https://api.dairo.app/v1/attachments/{attachmentId}/link

Identical response shape to the /url variant — the attachment metadata, a downloadUrl, a shareUrl, and expiresInSeconds — but always returns the branded, Dairo-hosted download link and its companion human share page, which is what you want for a link a person will click or that you'll paste into another app. expiryHours behaves the same: an integer from 1 to 168 (up to 7 days), defaulting to 5 minutes when omitted, with 400 on an out-of-range or non-integer value. As with every attachment read, the call is scoped to the message that owns the attachment — an id your key can't reach returns 404 — and the links exist only once the file has passed its malware scan: before that the call answers 409, and a file the scan flagged is withheld with a 403. Requires the messages:read scope.

Scope: messages:read. Send the API key as a bearer token; Scopes lists what each one reaches.

Request

cURL
curl "https://api.dairo.app/v1/attachments/3fa85f64-5717-4562-b3fc-2c963f66afa6/link" \
  -H "Authorization: Bearer $DAIRO_API_KEY"

Path parameters

NameTypeRequiredDescription
attachmentIdstring (uuid)yesThe attachment's ID.

Query parameters

NameTypeRequiredDescription
expiryHoursintegernoSigned link expiry in hours. Defaults to about 5 minutes when omitted. Maximum is 168 hours / one week. (minimum 1, maximum 168)

Response

200 Success. Body: application/json, AttachmentDownloadUrlResponse.

FieldTypeRequiredDescription
attachmentMessageAttachmentyes
downloadUrlstring (uri)yes
expiresInSecondsintegeryes(minimum 1, maximum 604800)
shareUrlstring (uri)yesHuman branded Dairo share page URL for the attachment.
200
{
  "attachment": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "filename": null,
    "contentType": null,
    "sizeBytes": null,
    "contentId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "createdAt": "2026-10-19T09:30:00Z",
    "messageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "disposition": "attachment"
  },
  "downloadUrl": "https://example.com",
  "expiresInSeconds": 1,
  "shareUrl": "https://example.com"
}

Errors

Every error has the same body, {"error": {"type", "code", "message", "param"}}; branch on code. Errors lists every code.

StatusMeaning
400The request is malformed or a value is invalid (invalid_request, invalid_domain, idempotency_key_mismatch).
401The API key is missing or invalid.
403The key lacks the scope this endpoint needs (scope_missing) or may not do this (not_permitted).
404No such resource in this account (resource_not_found).
409The resource already exists or its state does not allow this (duplicate_resource or a condition-specific code).
422The request is well-formed but a field failed validation (validation_failed).
429Rate limit, plan limit, budget or spend cap reached (rate_limited, plan_limit_reached, budget_exceeded, spend_cap_reached).
500An unexpected error; retry with backoff, then contact support (internal_error).

On this page