File Upload
Request Details
| Item | Value |
| Description | The File Upload API is used to send CrowdTwist a file |
| Method | POST |
| Endpoint | https://[environment]api[client_id].crowdtwist.com/v2/upload?api_key=[api_key] |
| Content Type | multipart/form-data |
Request
| Field Name | Sample Value | Required | Format | Notes |
| URL PARAMETERS – none | ||||
| QUERY STRING PARAMETERS | ||||
| api_key | QWERTYUIOP | Yes | String | |
Request Body
| Field Name | Sample Value | Required | Format | Notes |
| file | clip_image00455.jpg | Yes | .jpg / .jpeg / .png / .gif / .pdf | File under 6MB in size |
Response
Response Body
| Field Name | Sample Value | Required | Format | Description |
| file_id | 5123745558914880 | Yes | String | ID of the file stored in CrowdTwist’s datastore |
Error Responses
| Field Name | Sample Value | Required | Format | Description |
| error | input_error | yes | string | The type of rest API error. |
| message | Uploaded file is not an image or PDF | yes | string | A longer, descriptive sentence detailing the error. |
Error Response Codes
| Error | Error Code | Description | Reason |
| Input Error | 4xx | Returned whenever the request is missing required fields, including situations in which the body is malformed (e.g. HTTP method not supported, etc.). | -uploaded file is not an image or PDF -uploaded file too large -File upload failed. |
| Forbidden | 4xx | Returned whenever a request is attempting a forbidden action | -file in request not an uploaded file |
| Server Error | 5xx | HTTP error status code is returned due to an error that occurred in the backend. | – internal_error: unexpected error occurred in the CrowdTwist backend |
Samples
Sample Request
Sample Response Body
Sample Error Response: Status Code 400 – Incorrect File Type
Sample Error Response: Status Code 400 – File size too large
Sample Error Response: Status Code 400 – Incorrect Field Name