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

  • elementId string

    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

    • multipleupload boolean

      Whether multiple uploads are allowed

    • uploads array[object]

      A document upload within a request. When the upload is downloadable, url is present. When the upload is not downloadable (archived, expired, or in quarantine), url is omitted. Sensitive documents may include restricted: true and still have a url with access restrictions.

      Hide uploads attributes Show uploads attributes object
      • id string

        Unique identifier of the upload

      • createdAt string(date-time)

        Timestamp of when the upload was created

      • name string

        Upload name

      • url string

        Temporary URL to download the file. Present only when the document is downloadable. Omitted when status is archived or expired, or when the file is in quarantine. Validity period can be set via the expires query parameter (default 15 minutes, max 1 hour).

      • status string

        When present, indicates why the document is not downloadable. archived — file has been archived; expired — file or link has expired. When status is archived or expired, url is not included.

        Values are archived or expired.

      • size integer

        Upload size in bytes

      • quarantine boolean

        When true, the file failed virus scan or policy check; url is not included.

      • restricted boolean

        When true, the document is sensitive and access may be restricted.

      • virusScanned boolean

        Whether the upload has been virus-scanned

      • scannedOn string(date-time)

        Timestamp of the last virus scan

    • type string

      Element type

    • request object
      Hide request attributes Show request attributes object
      • _id string

        Request ID

      • campaignId string

        Campaign ID

  • 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 \
 --request POST 'https://api.usecollect.com/v1/upload' \
 --user "username:password" \
 --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=1735689600&Signature=tS9MixgslTykB6fKE8aFTqArzek%3D",
    "name": "whitepaper.pdf",
    "size": 344701,
    "createdAt": "2024-01-31T06:53:36Z",
    "scannedOn": "2024-01-31T06:54:06Z",
    "virusScanned": true
  },
  "mandatory": true,
  "visibility": true,
  "multipleupload": true
}