Skip to main content

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.

  1. Call this endpoint with the filename and contentType (for example application/pdf). Optionally pass the size in bytes and the locationId of the account the file belongs to.
  2. Upload the file with an HTTP PUT to uploadUrl within 1 hour. Send the file bytes as the raw body (not multipart form data) with a Content-Type header equal to the contentType you sent and an If-None-Match: * header; the upload is rejected without them. Call this endpoint again for each file.
  3. Store the returned attachment.attachmentId in 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​

Success