Add Attachment
POST/attachment/add
Creates an attachment record and returns a pre-signed uploadUrl for the file. Use it to upload a file, such as an inspection PDF, and store it in an Attachment custom field. Requires the attachment:manage permission; if your API key is restricted to specific permissions, include attachment:manage. The authenticated user owns the attachment.
- Call this endpoint with the
filenameandcontentType(for exampleapplication/pdf). Optionally pass thesizein bytes and thelocationIdof the account the file belongs to. - Upload the file with an HTTP
PUTtouploadUrlwithin 1 hour. Send the file bytes as the raw body (not multipart form data) with aContent-Typeheader equal to thecontentTypeyou sent and anIf-None-Match: *header; the upload is rejected without them. Call this endpoint again for each file. - Store the returned
attachment.attachmentIdin the account's Attachment custom field with/account/update, for example"customFieldsPatch": { "CF.abc123": "Attachment.abc123" }. For a field that allows multiple files, set an array of attachment IDs.
The attachment starts with status pending. After the upload, Terros checks the file's type from its contents, or from the contentType you declared when the contents have no recognizable signature (as with plain text, CSV, and JSON). Accepted: PDF; JPEG, PNG, GIF, WebP, AVIF, HEIC, TIFF, and BMP images; MP4, MOV, WebM, MPEG, and 3GP video; MP3, OGG, WAV, and AAC audio; Word, Excel, and PowerPoint files in the modern .docx, .xlsx, and .pptx formats; OpenDocument text and spreadsheets; RTF, plain text, CSV, and JSON; and ZIP, RAR, and 7z archives. An accepted file's status becomes valid. Anything else, including legacy .doc, .xls, and .ppt files and AVI video, is marked corrupted and cannot be downloaded. An attachment that does not become valid within 1 hour, because no file was uploaded or the file was marked corrupted, expires and is deleted. Use /attachment/get to confirm the status is valid before relying on the attachment ID, and to get a fresh download URL.
Request
Responses
- 200
- default
- 4XX
Success
Error
Unauthorized