Create an Attachment

POST /attachments

The attachment resource connects uploads on Arta to shipment or request resources. Attached uploads are visible in the Arta Dashobard under the "Documents" tab on the shipment and request detail pages.

Each upload may be attached to many requests or shipments. Each request or shipment may have many associated uploads.

To create an attachment via the API you can must send an authenticated request to the POST /attachments endpoint with a body that includes one of two different payload schema.

To attach an upload to a shipment, the attachment payload must include upload_id and shipment_id attributes. This payload must not include a request_id attribute. For example:

{
    "attachment": {
        "shipment_id": "506d79b6-1e5e-4e8c-a266-74658fdaf4ee",
        "upload_id": 5285
    }
}

To attach an upload to a request, the attachment payload must include upload_id and request_id attributes. This payload must not include a shipment_id attribute. For example:

{
    "attachment": {
        "request_id": "506d79b6-1e5e-4e8c-a266-74658fdaf4ee",
        "upload_id": 5285
    }
}

Headers

  • Authorization string Required

    Authorize your API calls with an Arta API token

application/json

Body

  • attachment object Required
    Hide attachment attributes Show attachment attributes object
    • request_id string

      The string ID of the request resource being associated to an upload. Do not include a request_id in the attachment parameters if you are associating a shipment

    • shipment_id string

      The string ID of the shipment resource being associated to an upload. Do not include a shipment_id in the attachment parameters if you are associating a shipment

    • upload_id integer Required

      The integer ID of the upload resource being attached

Responses

  • 201 application/json

    The created attachment

    Hide headers attributes Show headers attributes
    • content-type string
    • x-arta-request-id string

      A unique identifier for the Arta API call

    Hide response attributes Show response attributes object
    • created_at string
    • id integer
    • request_id string | null

      The string ID of the request resource associated to an upload via this attachment. Null if this attachment associate a shipment

    • shipment_id string | null

      The string ID of the shipment resource associated to an upload via this attachment. Null if this attachment associate a request

    • updated_at string
    • upload_id integer Required

      The integer ID of the Upload resource associated with either a shipment or request via this attachment

  • 400 application/json

    Bad Request

    Hide headers attributes Show headers attributes
    • content-type string
    • x-arta-request-id string

      A unique identifier for the Arta API call

    Hide response attribute Show response attribute object
    • errors object
      Hide errors attribute Show errors attribute object
      • detail string
POST /attachments
curl \
 --request POST 'https://api.arta.io/attachments' \
 --header "Content-Type: application/json" \
 --header "Authorization: ARTA_APIKey s0e1t2e3c4a5s6t7r8o9n10o11m12y" \
 --data '{"attachment":{"upload_id":4791,"request_id":"506d79b6-1e5e-4e8c-a266-74658fdaf4ee"}}'
Request example
{
  "attachment": {
    "upload_id": 4791,
    "request_id": "506d79b6-1e5e-4e8c-a266-74658fdaf4ee"
  }
}
Response examples (201)
{
  "id": 1942,
  "upload_id": 4791,
  "created_at": "2021-10-27T16:48:38.657228",
  "request_id": "506d79b6-1e5e-4e8c-a266-74658fdaf4ee",
  "updated_at": "2021-10-27T16:48:38.657228",
  "shipment_id": null
}
Response examples (400)
# Headers
content-type: application/json
x-arta-request-id: FkBjuxbwLLTx4RoAARkx

# Payload
{
  "errors": {
    "detail": "string"
  }
}