Download an attachment
GET
/attachments/{key}
const url = 'https://api.clearance.rest/emails/attachments/1783459025000_1_invoice.pdf';const options = {method: 'GET', headers: {'X-API-Key': '<X-API-Key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.clearance.rest/emails/attachments/1783459025000_1_invoice.pdf \ --header 'X-API-Key: <X-API-Key>'Serves an attachment stored with an email. key is the last path segment of an attachment’s full_url in the get-email response.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”key
required
string
Attachment key, the last segment of full_url.
Responses
Section titled “Responses”The attachment bytes, with the content type it was stored with.
Media typeapplication/octet-stream
string format: binary
The X-API-Key header is missing or invalid.
Media typeapplication/json
Error envelope returned with a non-2xx status.
object
success
required
boolean
error
required
Human-readable error message.
string
Example
{ "success": false, "error": "geçersiz API anahtarı"}No attachment with this key.
Media typetext/plain
string