POST v1/Upload-Session/End
POST
https://api.subworkflow.ai/v1/upload-session/end
Completes and finalises an existing Multipart Upload Session.
Summary
- Please ensure you've read this upload sessions readme.md before continuing.
- You must pass all collected
/appendresponses to this endpoint to complete the multipart upload successfully. - Once finalised, the job specified (initiated through
/startrequest), should executed immediately. - The response of this endpoint is therefore the
jobrecord which you can use to poll the status of the job.
Parameters
| name | type | location | required | description |
|---|---|---|---|---|
| content-type | string | header | required | You must set the request content type to multipart/form-data |
| key | string | body | required | The identifier for the upload session. This is obtained from the initial /start request. |
| parts | array<object> | body | required | All /append responses for this session. |
Responses
- Success
- 400 Error
- 404 Error
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"total": { "type": "number" },
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"datasetId": {
"type": "string"
},
"type": {
"type": "string",
"enum": ["datasets/extract","datasets/vectorize"]
},
"status": {
"type": "string",
"enum": ["NOT_STARTED","IN_PROGRESS","SUCCESS","ERROR"]
},
"statusText": {
"type": "string"
},
"startedAt": {
"type": "number"
},
"finishedAt": {
"type": "number"
},
"canceledAt": {
"type": "number"
},
"createdAt": {
"type": "number"
},
"updatedAt": {
"type": "number"
}
}
}
}
}
{
"success": { "type": "boolean" },
"error": { "type": "string" }
}
{
"success": { "type": "boolean" },
"error": { "type": "string" }
}
Example
- Curl
- JS/TS
curl -X POST https://api.subworkfow.ai/v1/upload-session/end \
--header 'x-api-key: <YOUR-API-KEY>' \
--header 'Content-Type: multipart/form-data' \
--form "key=tmp_xMX0GRh5Ifa3VrY7" \
--form "parts=[{\"etag\": "33a64df551425fcc55e4d42a148795d9f25f89d4",\"partNumber\":1, ... }]"
const formdata = new FormData();
formdata.append("key", "tmp_xMX0GRh5Ifa3VrY7");
formdata.append("parts", JSON.stringify([
{
"etag": "33a64df551425fcc55e4d42a148795d9f25f89d4",
"partNumber": 1
},
...
]));
const req = await fetch("https://api.subworkflow.ai/v1/upload-session/end", {
method: "POST",
headers: {
"Content-Type": "multipart/form-data",
"x-api-key": "<YOUR-API-KEY>"
},
body: formdata,
});
// note: you can poll https://api.subworkflow.ai/v1/jobs/<jobId> for updates
{
"success": true,
"total": 1,
"data": {
"id": "dsj_5fwR7qoMXracJQaf",
"datasetId": "ds_VV08ECeQBQgDoVn6",
"type": "datasets/extract",
"status": "IN_PROGRESS",
"statusText": null,
"startedAt": null,
"finishedAt": null,
"canceledAt": null,
"createdAt": 1761910647113,
"updatedAt": 1761910647113
}
}