Attachment

Authentication: All endpoints require an Authorization: Bearer <access token> header.

Most endpoints require an X-Company-ID: <company_id> header to scope requests to a specific company. This is the recommended header for most API operations.

Some endpoints require an X-Location-ID: <location_id> header when the query doesn't accept a locationId parameter.

See Authentication for details on how to obtain and use these headers.

Add Attachment

GraphQL Mutation

mutation AddAttachment($input: AddAttachmentInput!) {
  addAttachment(input: $input) {
    id
    filename
    url
  }
}

Multipart Request Structure

When making the request, you need to send multipart/form-data with three parts:

1. operations (text field):

{
  "query": "mutation AddAttachment($input: AddAttachmentInput!) { addAttachment(input: $input) { id filename url }}",
  "variables": {
    "input": {
      "file": null
    }
  }
}

2. map (text field):

{
  "1": ["variables.input.file"]
}

3. 1 (file field):

<actual file data>

Example cURL Request

curl -X POST "https://graphql.au.staging.roubler.net/graphql" \
  -H "Authorization: Bearer <access_token>" \
  -H "X-Company-ID: <company_id>" \
  -F 'operations={"query":"mutation AddAttachment($input: AddAttachmentInput!) { addAttachment(input: $input) { id filename url }}","variables":{"input":{"file":null}}}' \
  -F 'map={"1":["variables.input.file"]}' \
  -F '1=@/path/to/your/file.pdf'

Example Response

{
  "data": {
    "addAttachment": {
      "id": "251779",
      "filename": "file.pdf",
      "url": "https://roubler-staging-storage.s3.ap-southeast-2.amazonaws.com/attachments/251779?AWSAccessKeyId=...&Expires=1717996392&Signature=..."
    }
  }
}