Some APIs accept file uploads only as multipart/form-data — a request whose body is split into named parts, one of which carries the file and the others any fields that go with it. Jira's attachment endpoint, QuickBooks attachments, and OpenAI's file upload all work this way. An HTTP import can build that request for you: you describe the parts in a short JSON form, and integrator.io assembles the multipart body, adds the boundary, and sends the file it stored earlier in the flow. This article explains how to set up the connection and the transfer step, how to write the request body form, and shows three worked examples.
Prerequisites: The flow needs a step earlier in the flow that retrieves the file as a BLOB and stores it in integrator.io — a file export, or a lookup with Look up additional files (per record) — with the blobKey that integrator.io returns mapped onto the record through response mapping. See Example file transfer: Salesforce to NetSuite and Add lookup, transfer, and other steps to a flow. Keep the destination API's documentation for the endpoint at hand: it names the part that must carry the file and any headers the endpoint requires.
Create the transfer step
The step needs an HTTP connection to the API; see Fundamentals of HTTP connections. The connection's Media type can stay JSON — the step overrides it for this request.
- Go to Build
> Flows, open the flow, and then select +
after the step that stored the file.
- Select Add destination / lookup, select HTTP as the Application, select Transfer files into destination application, select the connection, name the step, and then select Next.
- In Where would you like the files transferred?, set HTTP method to POST and enter the endpoint's path in Relative URI.
- If the endpoint requires headers, add them in Configure HTTP headers.
- Set Override request media type to Multipart / form-data.
- Next to HTTP request body, select Edit
to open the editor, enter the request body form described in Write the request body form, and then select Save.
- If the API answers in JSON, expand Non-standard API response patterns and set Override media type for success responses and Override media type for error responses to JSON, so integrator.io parses the response.
- Expand Advanced, and in Blob key path enter the path in the record where the stored file's key was mapped — for example,
blobKey. integrator.io uses it to fetch the file from its storage and send it. Turn on Purge blob data immediately? to delete the stored file once it's sent. - Select Save & close.
Run the flow and check the destination for the file; see Run a flow.
Write the request body form
The request body is a JSON array with one object per part of the multipart body. integrator.io turns it into the multipart request; you never write the boundary or the Content-Disposition lines yourself.
[
{
"name": "<part name>",
"value": "<content of the part>",
"type": "inline | attachment",
"filename": "<name.ext>",
"mime-headers": {
"<header name>": "<header value>"
}
}
]| Attribute | Required | What it does |
|---|---|---|
name |
Yes | The part's name — the name attribute of the form field the API expects, such as file. |
value |
Yes | The part's content. For the file, a handlebars reference to the stored file: {{blob}}. For a text field, the text or a handlebars expression. For a JSON object, the object serialized as a string: {{{jsonEncode (jsonSerialize field)}}} — see the QuickBooks example. |
type |
Yes |
attachment when the part carries the file; inline (the default) for any other part. |
filename |
No | The file name sent with the part. Include the extension — report.pdf, data.json. |
mime-headers |
No | Headers for the part, such as content-type or Content-Transfer-Encoding. Inline parts are UTF-8 by default. |
Rules:
- A request body can reference one file. To send several files, use one import per file.
- Don't include the boundary string; integrator.io adds it when it sends the request.
- Extra fields the API wants alongside the file are additional parts with
nameandvalue:
[
{ "name": "file", "value": "{{blob}}", "type": "attachment" },
{ "name": "customerName", "value": "John" },
{ "name": "phone", "value": "123456789" }
]The multipart request integrator.io sends isn't shown in the audit log. It looks like this:
--YOjcLaTlykb6OxfYJx4O07j1MweeMFem
Content-Disposition: form-data; name="file_metadata_01"; filename="attachment.json"
Content-Type: application/json; charset=UTF-8
Content-Transfer-Encoding: 8bit
{ "AttachableRef": [ { "EntityRef": { "type": "Invoice", "value": "95" } } ],
"FileName": "receipt_nov15.jpg", "ContentType": "image/jpg" }
--YOjcLaTlykb6OxfYJx4O07j1MweeMFem
Content-Disposition: form-data; name="file_content_01"; filename="receipt_nov15.jpg"
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
<base64-encoded file content>
--YOjcLaTlykb6OxfYJx4O07j1MweeMFem--Examples
Attach a file to a QuickBooks bill
QuickBooks expects two parts: JSON metadata that names the object the file attaches to, and the file. The metadata is a JSON object, so its value is serialized to a string; the bill ID comes from the parent record and the file name from the stored file's path.
[
{
"name": "file_metadata_0",
"value": "{\"AttachableRef\": [{\"EntityRef\": {\"type\": \"Bill\",\"value\": \"{{data._PARENT.Quickbooks_Bill_Id}}\"}}],\"ContentType\": \"image/jpg\",\"FileName\": \"{{split data.file '/' 5}}\"}",
"type": "inline",
"mime-headers": {
"Content-Transfer-Encoding": "8bit",
"content-type": "application/json; charset=UTF-8"
}
},
{
"name": "file_content_0",
"filename": "{{split data.file '/' 5}}",
"type": "attachment",
"mime-headers": {},
"value": "{{blob}}"
}
]Before serializing, the metadata is:
{
"AttachableRef": [
{ "EntityRef": { "type": "Bill", "value": "{{data._PARENT.Quickbooks_Bill_Id}}" } }
],
"ContentType": "image/jpg",
"FileName": "{{split data.file '/' 5}}"
}Attach a file to a Jira issue
Jira's attachment endpoint requires the header X-Atlassian-Token: no-check, and the part that carries the file must be named file.
On the transfer step, set HTTP method to POST, set Relative URI to the issue's attachment path, and in Configure HTTP headers add X-Atlassian-Token with the value no-check. The request body is a single attachment part:
[
{
"name": "file",
"value": "{{blob}}",
"type": "attachment",
"filename": "upload_attachment {{timestamp}}"
}
]In Advanced, enter the Blob key path, save the step, and run the flow.
Upload a document to OpenAI
OpenAI's /files endpoint takes the file and a purpose field. This example sends an HTML document inline rather than a stored file, so no blob is involved; it's shown as the import's definition in the integrator.io API.
{
"name": "open ai file import",
"http": {
"relativeURI": ["/files"],
"method": ["POST"],
"body": [
"[\n {\n \"name\": \"file\",\n \"value\": \"<!DOCTYPE html>\\n<html>\\n<head>\\n <title>Sample HTML Page</title>\\n</head>\\n<body>\\n <h1>Hello, World!</h1>\\n <p>This is a sample HTML page.</p>\\n</body>\\n</html>\",\n \"type\": \"inline\",\n \"mime-headers\": {\n \"Content-Disposition\": \"form-data\",\n \"content-type\": \"text/html\",\n \"filename\": \"My_File3\"\n }\n },\n {\n \"name\": \"purpose\",\n \"value\": \"assistants\",\n \"type\": \"inline\"\n }\n]"
],
"headers": [
{ "name": "content-type", "value": "multipart/form-data" }
],
"batchSize": 1,
"sendPostMappedData": true,
"formType": "http"
},
"adaptorType": "HTTPImport"
}