Skip to content

Upload files to a custom action ​

Custom actions are the activities your workspace sets up under Settings → Custom Actions, such as a site visit. A custom action can have file fields, like a "Site photo" field. Use this endpoint to fill those fields on a custom action that's already on a lead.

File fields can't be filled when you create a custom action. Create the custom action first, then upload its files here. This works even if a file field is mandatory.

It takes two requests:

  1. Request upload links. Tell this endpoint which file fields you're filling, and give the name, type and size of each file.
  2. Upload the files. Send each file to its own link, within 15 minutes.

Before you start ​

You need:

  • The custom action's ID. It's the action_id returned when you create the custom action. You can also find it with Search actions.
  • The API name of each file field. Get a custom action lists every field with its apiName. For a file field, it also shows which extensions the field accepts (allowedExtensions).
FieldValue
MethodPOST
URLhttps://next.telecrm.in/autoupdate/v2/enterprise/{enterpriseId}/lead/{leadId}/action/{actionId}/file
AuthBearer token (Sync-typed). See Authentication.

Add one entry for each file field you want to fill, keyed by the field's API name. You can fill one field or several in the same request:

json
{
  "site_photo": {
    "file_name": "site-front.jpg",
    "content_type": "image/jpeg",
    "file_size": 245760
  },
  "signed_form": {
    "file_name": "visit-form.pdf",
    "content_type": "application/pdf",
    "file_size": 42100
  }
}

Each entry takes:

FieldTypeRequiredDescription
file_namestringyesThe file's name, with its extension, such as site-front.jpg. Can't contain ? or /.
content_typestringyesThe file's type, such as image/jpeg or application/pdf. Send the same value in step 2.
file_sizenumberyesThe file's exact size in bytes. Up to 26214400 (25 MB).

Rules for each field ​

  • It must be a file field on this custom action, and it can't be hidden.
  • The file's extension must be one the field accepts. A field set to accept images only rejects a .pdf.
  • If the field is locked after creation, you can upload to it once. After that it can't be replaced.

If any entry breaks a rule, the whole request is rejected and nothing on the custom action changes.

Response ​

200 OK

json
{
  "presigned_urls": {
    "site_photo": "https://s3.ap-south-1.amazonaws.com/...",
    "signed_form": "https://s3.ap-south-1.amazonaws.com/..."
  }
}

There's one upload link for each field, under the same API name you sent.

Step 2: Upload the files ​

Send each file to its own link with a PUT request:

bash
curl -X PUT "PASTE_THE_SITE_PHOTO_URL_HERE" \
  -H "Content-Type: image/jpeg" \
  --data-binary @site-front.jpg

curl -X PUT "PASTE_THE_SIGNED_FORM_URL_HERE" \
  -H "Content-Type: application/pdf" \
  --data-binary @visit-form.pdf
  • Match each file to its field. The file for site_photo goes to the site_photo link.
  • Use the same Content-Type you sent for that file in step 1.
  • Send exactly file_size bytes. If the size doesn't match, the upload is rejected. curl --data-binary sets the size for you.
  • Leave out your telecrm token. Each link carries its own permission, so don't add an Authorization header.
  • Upload within 15 minutes. After that the links stop working.

If an upload fails

The fields are filled as soon as step 1 succeeds, before you upload anything. Each upload succeeds or fails on its own. If one fails, that field shows a file that can't be opened, and the other files are still saved.

To fix it, upload again to the same link while it still works. Once the link has expired, repeat step 1 for that field. The new file replaces the old one in the field.

This doesn't work for a field that's locked after creation. Step 1 already counts as its one upload, so it can't be requested again. Upload files for locked fields straight away.

Errors ​

StatusCause
400A file detail is missing or invalid, the file is larger than 25 MB, or its type is blocked. Also returned when the action isn't a custom action, a field isn't a file field or is hidden, the extension doesn't match what the field accepts, or the field is locked.
401The token is missing or invalid.
404There's no lead with this ID, or the action isn't on this lead.