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.

application/json

Body

  • ID of the doc element you want to upload the file to

  • url string

    URL of the remote file. The file size is limited to 20Mb.

  • data string

    Base64 encoded file. The file size is limited to 20Mb.

  • name string

    Name of the file with the file extension.

Responses

  • 200 application/json
    Hide response attributes Show response attributes object
  • Bad Request -- Your request is invalid.

  • Unauthorized -- Your API key is wrong.

  • Forbidden -- The object requested is hidden for administrators only.

  • Not Found -- The specified object could not be found.

  • Too Many Requests -- You're requesting too many objects! Slow down!

  • Internal Server Error -- We had a problem with our server. Try again later.

  • Service Unavailable -- We're temporarily offline for maintenance. Please try again later.

POST /upload
curl \
 -X POST https://api.usecollect.com/v1/upload \
 -H "Content-Type: application/json" \
 -d '{"url":"https://randomremoteserver.com/whitepaper.pdf","name":"whitepaper.pdf","elementId":"eEDJFD5unNQTHoSBZ"}'
Request example
{
  "url": "https://randomremoteserver.com/whitepaper.pdf",
  "name": "whitepaper.pdf",
  "elementId": "eEDJFD5unNQTHoSBZ"
}
Response examples (200)
{
  "id": "eEDJFD5unNQTHoSBZ",
  "name": "ID",
  "type": "docs",
  "order": 3,
  "itemId": "urRJfPK7CfyGBnHg8",
  "status": "open",
  "request": {
    "_id": "bbbBkrejSaJkHWwDE",
    "campaignId": "7gDq3XyLyixkhqoHa"
  },
  "uploads": {
    "id": "z2A3thsdGaLSidmQq",
    "url": "https://collectuseast.s3.amazonaws.com/samples/business_plan_acme.pdf?AWSAccessKeyId=AKIAJTQD6LRBSTO25FSQ&Expires=1675693205&Signature=tS9MixgslTykB6fKE8aFTqArzek%3D",
    "name": "whitepaper.pdf",
    "size": 344701,
    "createdAt": "2023-01-31T06:53:36Z",
    "scannedOn": "2023-01-31T06:54:06Z",
    "virusScanned": true
  },
  "mandatory": true,
  "visibility": true,
  "multipleupload": true
}