Upload a file to a lead
Adds a file to a lead, such as a signed quotation or an ID proof. The file shows up on the lead's timeline as added by telecrm.
It takes two requests:
- Request an upload link. Send the file's name, type and size to this endpoint.
- Upload the file. Send the file to the link you got back, within 15 minutes.
Step 1: Request an upload link
| Field | Value |
|---|---|
| Method | POST |
| URL | https://next.telecrm.in/autoupdate/v2/enterprise/{enterpriseId}/lead/{leadId}/file |
| Auth | Bearer token (Sync-typed). See Authentication. |
json
{
"file_name": "quotation.pdf",
"content_type": "application/pdf",
"file_size": 87645,
"note": "Signed quotation"
}| Field | Type | Required | Description |
|---|---|---|---|
file_name | string | yes | The name shown on the lead, with its extension, such as quotation.pdf. Can't contain ? or /. |
content_type | string | yes | The file's type, such as application/pdf or image/jpeg. Send the same value in step 2. |
file_size | number | yes | The file's exact size in bytes. Up to 26214400 (25 MB). |
note | string | no | A note shown next to the file on the timeline. |
Response
201 Created
json
{
"presigned_url": "https://s3.ap-south-1.amazonaws.com/..."
}presigned_url is your upload link.
Step 2: Upload the file
Send the file to the upload link with a PUT request:
bash
curl -X PUT "PASTE_THE_PRESIGNED_URL_HERE" \
-H "Content-Type: application/pdf" \
--data-binary @quotation.pdf- Use the same
Content-Typeyou sent ascontent_typein step 1. - Send exactly
file_sizebytes. If the size doesn't match, the upload is rejected.curl --data-binarysets the size for you. - Leave out your telecrm token. The link carries its own permission, so don't add an
Authorizationheader. - Upload within 15 minutes. After that the link stops working.
If the upload fails
The file is added to the lead as soon as step 1 succeeds, before you upload anything. If step 2 fails, the timeline shows the file but it can't be opened.
To fix it, upload again to the same link while it still works. Once the link has expired, start over from step 1. This adds a new file to the timeline, and the first entry stays without a file.
Errors
| Status | Cause |
|---|---|
400 | A field is missing or invalid, the file is larger than 25 MB, or its file type is blocked. |
401 | The token is missing or invalid. |
404 | There's no lead with this ID in the workspace. |