Skip to main content

How to Upload Attachments via Workflow or API


You can upload attachments to a worksheet via workflows or APIs.
Workflows only support URL-based uploads, while APIs support both URL and Base64 formats.

1. Upload Attachments via Workflow​

You can use a Webhook-triggered workflow to receive external data and either add new records to a worksheet or update existing records—including uploading attachments.

In the Add Record or Update Record node of the workflow, the value passed into a file field must be a JSON string composed of one or more downloadable file URLs.

  • To upload a single file, the value can be either:
    url1 or ["url1"]
    e.g., https://help.mingdao.com/logo/logo.png or ["https://help.mingdao.com/logo/logo.png"]

  • To upload multiple files, use the following format:
    ["url1", "url2"]
    e.g., ["https://help.mingdao.com/logo/logo.png", "https://help.mingdao.com/file/crm.xlsx"]
    For more files, continue adding URLs separated by commas.

Workflow Configuration​

Use either the Add Record or Update Record node to upload attachments to a record.

In the example below, the file download URLs are first saved to a text field named Download Link, and then a workflow automatically downloads and saves the file to the Attachment field.

1. Configure the Trigger Node​

3. Test​

You can test this workflow using the following sample (including the square brackets):

["https://help.mingdao.com/logo/logo.png", "https://help.mingdao.com/file/crm.xlsx"]

2. Upload Attachments via API​

Check out the API documentation below:

Parameter Description

{
controlId: //ID of the attachment control;
"value": //External file URLs, separated by commas if multiple;
"editType":0 //Data update type: 0 = overwrite existing files, 1 = append new files (Default is 0. This parameter is optional when creating a new record, but required when updating a record);
"valueType":1//Upload method: 1 = external file URLs (default) — use the `value` parameter, 2 = base64 encoded file stream — use the `controlFiles` parameter below;

"controlFiles":[{
"baseFile":"QABAAQQQAAG9nCwAAAA==", //base64-encoded file content;
"fileName":"Filename with extension.xlsx" //Filename with extension;
}]
}

Example: Upload via URL​

Upload a single file: "url1"

Example: "https://help.mingdao.com/logo/logo.png"

Upload two files: "url1,url2"

Example: "https://help.mingdao.com/logo/logo.png,https://help.mingdao.com/logo/logo.png"

For more files, continue adding URLs separated by commas.

{
"appKey": "0a265**3a155de01",
"sign": "ZmFkZjExMmNlY***NDA4ZjI5N2YxZDEwMjlkZWNkOTRkNTg5NjBkYWQzOTYxYjgwMWM4ZDg5NzYwOGMxZjZmOA==",
"worksheetId": "61111f2eb94**ac37d7d6e",
"controls": [
{
"controlId": "61111f2eb94aac37d7d6f",
"value": "Test"
},
{
"controlId":"61111f2eb10caac37d7d71",
"value":"https://help.mingdao.com/logo/logo.png",
"editType":0,
"valueType":1//Setting 1
}
]
}

Example: Upload via Base64 File Stream​

{
"appKey": "0a265**3a155de01",
"sign": "ZmFkZjExMmNlY***NDA4ZjI5N2YxZDEwMjlkZWNkOTRkNTg5NjBkYWQzOTYxYjgwMWM4ZDg5NzYwOGMxZjZmOA==",
"worksheetId": "61111f2eb94**ac37d7d6e",
"controls": [
{
"controlId": "61111f2eb94aac37d7d6f",
"value": "Test"
},
{
"controlId":"61111f2eb10caac37d7d71",
"editType":0,
"valueType":2,//Setting 1
"controlFiles":[
{
"baseFile":"QABAAQQQAAG9nCwAAAA==",
"fileName":"Filename with extension.xlsx"
}]
}
]
}

Timeout Issues to Note​

If you're using the batch add record API and attempting to upload attachments at the same time, you may experience timeouts—since the system waits for all file uploads to complete before returning a success response.

Recommended Approach: Write the attachment URLs to a text field first, allowing the core data to be saved quickly. Then, use a workflow to upload attachments asynchronously (see previous examples).

3. Comparison: Upload via API vs. Workflow​

The main difference lies in the format of the file URLs:

Workflow: expects ["url1","url2"]

API: expects "url1,url2"

4. Requirements for File URLs​

To ensure successful upload, all attachment URLs must meet the following criteria:

  • The URL must be publicly accessible by the platform's server

  • The file should be directly downloadable

  • The URL must end with a valid file extension

Was this document helpful?