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
    • id string

      Element ID

    • itemId string

      Reference of the element in the campaign

    • name string

      Element name

    • order integer

      Element order

    • status string

      Element status

    • mandatory boolean

      Whether element is mandatory

    • Whether multiple uploads are allowed

    • uploads array[object]
      Hide uploads attributes Show uploads attributes object
      • createdAt string(date-time)

        Timestamp of when the upload was created

      • name string

        Upload name

      • url string

        Upload URL

      • size integer

        Upload size

    • type string

      Element type

    • request object

      Additional properties are allowed.

      Hide request attributes Show request 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 \
 --request POST https://api.usecollect.com/v1/upload \
 --header "Content-Type: application/json" \
 --data '{"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
}