Add an element

POST /elements

This endpoint allows you to add an element to an existing request. You can currently add docs, text and pages. form will come later.

application/json

Body object

One of:
  • requestId string Required
  • type string Required

    Type of the element. Can be docs, text and pages.

    Values are docs, text, or pages.

  • name string

    Name of the element.

  • order integer

    Order of the element on the portal. Order should be an integer and starts at 0.

    Minimum value is 0.

  • Description of the document that needs to be uploaded.

  • nickname string

    A nickname for this element. Can be useful to classify your uploaded docs.

  • path string

    A path for this element. Can be useful to classify your uploaded docs.

  • mandatory boolean

    Is the document mandatory or not. Default is true.

  • extensions array[string]

    A list of document extensions that are accepted. By default, all type of documents are accepted. Must be formated as a string like ['xls','xslx'].

  • Specify if you are accepting multi documents for the same element. Default is true.

Responses

  • 200 application/json
    One of:
    Hide attributes Show attributes
    • 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 /elements
curl \
 --request POST 'https://api.usecollect.com/v1/elements' \
 --header "Content-Type: application/json" \
 --data '{"name":"ID","type":"docs","order":3,"requestId":"bbbBkrejSaJkHWwDE"}'
Request examples
{
  "name": "ID",
  "type": "docs",
  "order": 3,
  "requestId": "bbbBkrejSaJkHWwDE"
}
{
  "text": "Hello World!",
  "type": "text",
  "order": 4,
  "requestId": "GTonevwqoPPJ2PYEy"
}
{
  "name": "More details",
  "type": "page",
  "order": 2,
  "requestId": "GTonevwqoPPJ2PYEy"
}
Response examples (200)
{
  "id": "eEDJFD5unNQTHoSBZ",
  "name": "ID",
  "type": "docs",
  "order": 3,
  "itemId": "urRJfPK7CfyGBnHg8",
  "status": "open",
  "request": {
    "_id": "bbbBkrejSaJkHWwDE",
    "campaignId": "7gDq3XyLyixkhqoHa"
  },
  "uploads": [],
  "mandatory": true,
  "visibility": true,
  "multipleupload": true
}
{
  "id": "BKJ95xmpHSyo7KuRC",
  "name": "Text block",
  "text": "Hello World!",
  "type": "text",
  "order": 4,
  "itemId": "7LBBC8LwnBnQoz8ae",
  "request": {
    "_id": "GTonevwqoPPJ2PYEy",
    "campaignId": "3ya2sjN9GYwYAHeSi"
  },
  "visibility": true
}
{
  "id": "XigRzPs4N5vwX3Rks",
  "name": "More details",
  "type": "page",
  "order": 2,
  "itemId": "L3uAmzDRJjWTm2TMR",
  "request": {
    "_id": "GTonevwqoPPJ2PYEy",
    "campaignId": "3ya2sjN9GYwYAHeSi"
  },
  "visibility": true
}