Create an Upload
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,
'
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}}'
# 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
}
}
# Headers
content-type: application/json
x-arta-request-id: FkBjuxbwLLTx4RoAARkx
# Payload
{
"created_at": "2021-10-27T16:48:38.657228",
"document_type": "other",
"document_type_label": "Inventory List",
"download_url": "https://api.arta.io/downloads/kikhAFZ565BzbGooRqLZl",
"file_name": "inventory_list_27148_16.pdf",
"id": 1942,
"mime_type": "application/pdf",
"presigned_url": "https://api.arta.io/downloads/35fc1956-71fc-4b1c-846b-6ea963182a8c",
"size": 58550,
"status": "processed"
}
# Headers
content-type: application/json
x-arta-request-id: FkBjuxbwLLTx4RoAARkx
# Payload
{
"errors": {
"detail": "string"
}
}