POST v1/Upload-Session/Start
POST
https://api.subworkflow.ai/v1/upload-session/start
Starts a Multipart Upload Session for uploading files larger than 100mb
Summary
- Please ensure you've read this upload sessions readme.md before continuing.
- Initiates the upload session and returns a
key. Thiskeyis required for all subsequent calls. - If you lose the
key, you won't be able to complete the upload session. In which case, just start a new upload session.
Parameters
| name | type | location | required | description |
|---|---|---|---|---|
| content-type | string | header | required | You must set the request content type to multipart/form-data |
| fileName | string | body | required | The name of the file to use after all parts are combined at our end |
| fileExt | string | body | required | The file extension of the original file. Used to identify correct post-processing steps. |
| fileType | string | body | required | The file mimeType of the original file. Used to identify correct post-processing steps. |
| jobType | string | body | required | The job to execute after upload is successful. Can only be one of extract or vectorize. |
| expiryInDays | number | body | optional | Sets the data rentention limit in days for the file. Max depends on your subscription. Set to -1 to never expire. |
Responses
- Success
- 400 Error
- 404 Error
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"data": {
"type": "object",
"properties": {
"key": {
"type": "string"
}
}
}
}
}
{
"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/start \
--header 'x-api-key: <YOUR-API-KEY>' \
--header 'Content-Type: multipart/form-data' \
--form "fileName=myReport" \
--form "fileExt=pdf" \
--form "fileType=application/pdf" \
--form "jobType=extract"
--form "expiryInDays=30"
const formdata = new FormData();
formdata.append("fileName", "myReport");
formdata.append("fileExt", "pdf");
formdata.append("fileType", "application/pdf");
formdata.append("jobType", "extract");
formdata.append("expiryInDays", "30");
const req = await fetch("https://api.subworkflow.ai/v1/upload-session/start", {
method: "POST",
headers: {
"Content-Type": "multipart/form-data",
"x-api-key": "<YOUR-API-KEY>"
},
body: formdata,
});
{
"success": true,
"data": {
"key": "tmp_xMX0GRh5Ifa3VrY7"
}
}