Uploads one or more file attachments to a specific field on a record.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Note:The record field must be configured to allow attachments for this action to be permitted.
How the Attachment API Process Works
- Retrieve the Record: Our system retrieves the record based on the Record ID provided in the API request.
- Validate the Record and Field: It verifies that the record exists and that the specified Field ID supports attachments.
- Upload the Attachment(s): If validation succeeds, the system begins uploading the attachment(s) through a backend API using the Record ID and Field ID. This is how the backend API is designed to operate.
- Retrieve Attachment Metadata and Submit the Edit: Once the attachments have been uploaded, our system retrieves the associated metadata from the backend Attachments API, builds an EditRecord request containing the attachments and their metadata, and submits it as an EditRecord request.
Attachment Limits
Supported file types: doc, docx, odt, rtf, gdoc, txt, csv, xls, xlsx, ods, pdf, xps, png, jpg, jpeg, gif, tiff, tif, svg. Files of any other type are rejected.
Maximum size: the total size of all attachments in a single request must not exceed 25 MB. If your attachments together are larger than 25 MB, split them across multiple requests and submit those requests one after another, as described below.
Potential Timing IssueIf the client is submitting a separate API request for each attachment to the same Record ID and Field ID in rapid succession, without waiting for the preceding request to complete, there is a potential timing issue that cause issues.
During Step 1, our system retrieves the record in its current state. If the previous attachment request has not yet completed the process of updating the record with the attachment, the record retrieved will not yet reflect the previously submitted attachment(s).
As a result, the subsequent EditRecord request may be built using a version of the record that does not include the attachment(s) from the previous request. It would then include only the attachment associated with the current API request. When that EditRecord request is submitted, it could effectively overwrite the previous update, leaving only the attachment included in the current request.
This creates a potential race condition in which multiple attachment requests are being processed before the preceding request has fully completed the record update. Depending on the timing of the back end processing, attachments from earlier requests may be omitted from subsequent EditRecord submissions.
Recommended ApproachTo avoid this potential timing issue, there are two approaches:
Submit all attachments in a single API request: This is the preferred approach, as all attachments can be processed together within a single record update. (There are size limitations and this can fail if the sum size of the attachments is large -be discretionary in approach.)
Submit attachments sequentially: If attachments must be submitted individually, the client should wait for each attachment to be fully processed and reflected on the record before submitting the next request. For example, submit the first attachment and verify that it has been successfully attached to the record before submitting the second. Repeat this process for each subsequent attachment.
Submitting individual attachment requests in rapid succession without waiting for the previous record update to complete could result in attachments being overwritten or omitted from the final record.
To verify that attachments have been successfully associated with the appropriate Record ID and Field ID, use the GetRecordById API to retrieve the record and review the response. The response includes the attached files and their respective file sizes (in bytes), allowing you to confirm that the attachments were uploaded and associated with the record as expected.
