Create an Upload

POST /uploads

Uploading a file to Arta via API is a two step process.

The first step is to make an authenticated HTTP request to the POST /uploads endpoint described here. Successful requests to this endpoint will create an upload resource with a "pending" status as well as a presigned_url attribute.

The second step is to create a PUT HTTP request to the URL defined in the presigned_url field of the successful create response. This second request must include the raw data of the file as the request body and a content-type header. The content-type header must match the mime_type provided in your initial request. The size of the raw data must match the size param provided in your initial request.

For example, if you provided a mime_type of text/csv and a size of 13 bytes in the initial request to create the resource and if it successfully responded with a presigned_url value of https://cdn.arta.io/uploads/my-file.csv, your second request will look something like the following:

curl --location --request PUT 'https://cdn.arta.io/uploads/my-file.csv' \
--header 'Content-Type: text/csv' \
--data-raw 'hello,world,
'

Headers

  • Authorization string Required

    Authorize your API calls with an Arta API token

application/json

Body

  • upload object Required
    Hide upload attributes Show upload attributes
    • document_type string Required

      The document type of the file being uploaded

      Values are bill_of_lading, certificate_of_insurance, certificate_of_insurance_template, condition_report, condition_check, image, instructions, airway_bill, commercial_invoice, power_of_attorney, proof_of_export, proof_of_delivery, quote, shipping_label, or other.

    • document_type_label string | null

      A brief label providing additional context about the document_type. Required when "other" is the "document_type"

    • file_name string Required

      The name of the file being uploaded

    • mime_type string Required

      The mime-type for the file being uploaded

      Values are application/pdf, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.openxmlformats-officedocument.wordprocessingml.document, image/jpeg, image/png, text/csv, video/mp4, video/quicktime, or application/msword.

    • size integer Required

      The size of the file being uploaded in bytes

Responses

  • 201 application/json

    response

    Hide headers attributes Show headers attributes
    Hide response attributes Show response attributes object
    • document_type string Required

      The document type of the uploaded file

      Values are bill_of_lading, certificate_of_insurance, certificate_of_insurance_template, condition_report, condition_check, image, instructions, airway_bill, commercial_invoice, power_of_attorney, proof_of_export, proof_of_delivery, quote, shipping_label, or other.

    • document_type_label string | null

      A brief label providing additional context about the document_type. Required when "other" is the document_type

    • download_url string | null
    • file_name string Required

      The name of the uploaded file

    • id integer
    • mime_type string Required

      The mime-type of the uploaded file

      Values are application/pdf, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.openxmlformats-officedocument.wordprocessingml.document, image/jpeg, image/png, text/csv, video/mp4, video/quicktime, or application/msword.

    • A pre-signed and secure URL to use to send the file to Arta via a PUT HTTP request within 20 seconds of the upload resource being created

    • size integer Required

      The size of the uploaded file in bytes

    • status string

      Values are pending, processed, or failed.

  • 400 application/json

    Bad Request

    Hide response attribute Show response attribute object

    Basic Error

POST /uploads
curl \
 -X POST https://api.arta.io/uploads \
 -H "Content-Type: application/json" \
 -H "Authorization: ARTA_APIKey s0e1t2e3c4a5s6t7r8o9n10o11m12y" \
 -d '{"upload":{"document_type":"bill_of_lading","document_type_label":"string","file_name":"my-file.csv","mime_type":"text/csv","size":22}}'
Request examples
# Headers
Authorization: ARTA_APIKey s0e1t2e3c4a5s6t7r8o9n10o11m12y

# Payload
{
  "upload": {
    "document_type": "bill_of_lading",
    "document_type_label": "string",
    "file_name": "my-file.csv",
    "mime_type": "text/csv",
    "size": 22
  }
}
Response examples (201)
{
  "id": 1942,
  "size": 58550,
  "status": "pending",
  "file_name": "inventory_list_27148_16.pdf",
  "mime_type": "application/pdf",
  "created_at": "2021-10-27T16:48:38.657228",
  "download_url": null,
  "document_type": "bill_of_lading",
  "presigned_url": "https://api.arta.io/downloads/35fc1956-71fc-4b1c-846b-6ea963182a8c",
  "document_type_label": null
}
Response examples (400)
{
  "errors": {
    "detail": "string"
  }
}