---
title: "[beta] Attach a file to a work order."
method: POST
path: "/maintenance/work-orders/attachments"
tags: ["Beta APIs"]
---

# \[beta\] Attach a file to a work order.

`POST /maintenance/work-orders/attachments`

## Request

- Base URL: `https://api.samsara.com`
- URL: `https://api.samsara.com/maintenance/work-orders/attachments`
- Auth: HTTP bearer

Attaches a PDF, JPEG or PNG file to an existing work order. Supply exactly one of file (base64, at most 7,864,320 decoded bytes) or upload (up to 40,000,000 bytes). For upload, PUT the declared file with matching Content-Type, Content-MD5 and Content-Length before uploadPut expires. Read GET /maintenance/work-orders for availability and the download URL after successful upload. Presigned uploads require the estimate REST rollout to be enabled.

 <b>Rate limit:</b> 100 requests/min (learn more about rate limits <a href="https://developers.samsara.com/docs/rate-limits" target="_blank">here</a>).

To use this endpoint, select **Write Work Orders** under the Work Orders category when creating or editing an API token. <a href="https://developers.samsara.com/docs/authentication#scopes-for-api-tokens" target="_blank">Learn More.</a>
 

 **Submit Feedback**: Likes, dislikes, and API feature requests should be filed as feedback in our <a href="https://forms.gle/zkD4NCH7HjKb7mm69" target="_blank">API feedback form</a>. If you encountered an issue or noticed inaccuracies in the API documentation, please <a href="https://www.samsara.com/help" target="_blank">submit a case</a> to our support team.

## Request body

- WorkOrdersPostWorkOrderAttachmentRequestBody: Work order attachment request
  - `file` WorkOrderAttachmentFileRequestBody: File to attach to a work order.
    - `base64Content` string, required: Base64 encoded file content. Maximum decoded size: 7,864,320 bytes (7.5 MiB).
    - `contentType` string, required: MIME type of the file. Supported types: application/pdf, image/jpeg, image/png.
  - `upload` MaintenanceAttachmentUploadRequestBody: Create a presigned PUT upload session. Send the declared Content-Type, Content-MD5 and Content-Length with the PUT before expiry.
    - `contentMd5` string, required: Standard base64 encoding of the file's 16-byte MD5 digest.
    - `contentType` 'application/pdf' | 'image/jpeg' | 'image/png', required: File MIME type. Valid values: `application/pdf`, `image/jpeg`, `image/png`
    - `fileSizeBytes` integer, required: Exact file length in bytes; at most 40 MB.
  - `workOrderId` string, required: ID of the work order to attach the file to.

## Response `200`

OK response.

- WorkOrdersPostWorkOrderAttachmentResponseBody
  - `data` WorkOrderAttachmentCreateResultResponseBody, required: Created attachment and optional upload session.
    - `id` string, required: ID of the attachment. Matches the id of the work order's attachments.
    - `uploadPut` FunctionsStorageSignedUrlOfTypeResponseBody: A presigned URL for a file in Functions storage.
      - `expiresAtTime` string, date-time, required: RFC 3339 timestamp when the presigned URL expires.
      - `url` string, required: The presigned URL.

## Other responses

- `401`: Unauthorized response.
- `404`: Not Found response.
- `405`: Method Not Allowed response.
- `413`: Content Too Large response.
- `429`: Too Many Requests response.
- `500`: Internal Server Error response.
- `501`: Not Implemented response.
- `502`: Bad Gateway response.
- `503`: Service Unavailable response.
- `504`: Gateway Timeout response.
- `default`: Bad Request response.

---

[API](https://skmtc.dev/samsara/apis/samsara-api.md) - [All operations](https://skmtc.dev/samsara/apis/samsara-api/llms.txt) - [OpenAPI document](https://skmtc.dev/samsara/apis/samsara-api/revisions/a9e35d4999be?raw)
