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
  • 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 examples (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,
    "scannedOn": "2023-01-31 06:54:06 UTC",
    "virusScanned": true
  },
  "type": "docs",
  "request": {
    "_id": "bbbBkrejSaJkHWwDE",
    "campaignId": "7gDq3XyLyixkhqoHa"
  }
}