Upload a file
POST
/upload
This endpoint allows you to upload a file to a doc element. You can upload a remote file using the url
parameter or a file encoded in base64 using the data
parameter.
Responses
-
• 200 object
-
• 400
Bad Request -- Your request is invalid.
-
• 401
Unauthorized -- Your API key is wrong.
-
• 403
Forbidden -- The object requested is hidden for administrators only.
-
• 404
Not Found -- The specified object could not be found.
-
• 429
Too Many Requests -- You're requesting too many objects! Slow down!
-
• 500
Internal Server Error -- We had a problem with our server. Try again later.
-
• 503
Service Unavailable -- We're temporarily offline for maintenance. Please try again later.
POST /upload
curl \
-X POST https://api.usecollect.com/v1/upload \
--user "username:password" \
-H "Content-Type: application/json" \
-d '{"elementId":"eEDJFD5unNQTHoSBZ","url":"https://randomremoteserver.com/whitepaper.pdf","name":"whitepaper.pdf"}'
Request example
{
"elementId": "eEDJFD5unNQTHoSBZ",
"url": "https://randomremoteserver.com/whitepaper.pdf",
"name": "whitepaper.pdf"
}
Response example (200)
{
"id": "eEDJFD5unNQTHoSBZ",
"itemId": "urRJfPK7CfyGBnHg8",
"name": "ID",
"order": 3,
"visibility": true,
"status": "open",
"mandatory": true,
"multipleupload": true,
"uploads": {
"id": "z2A3thsdGaLSidmQq",
"createdAt": "2023-01-31 06:53:36 UTC",
"name": "whitepaper.pdf",
"url": "https://collectuseast.s3.amazonaws.com/samples/business_plan_acme.pdf?AWSAccessKeyId=AKIAJTQD6LRBSTO25FSQ&Expires=1675693205&Signature=tS9MixgslTykB6fKE8aFTqArzek%3D",
"size": 344701
},
"type": "docs",
"request": {
"_id": "bbbBkrejSaJkHWwDE",
"campaignId": "7gDq3XyLyixkhqoHa"
}
}