> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getprimo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Attach a ticket file to a device

> Attach a file someone sent on a ticket (an erasure certificate, a repair report, an invoice) to the device, among its documents. `fileId` is the id of a file of a ticket comment, as `getTicket` lists it. The file must be a PDF, JPEG, PNG or PKCS #7 file of 4 MB at most: any other is refused with 422, and a file whose content does not match its type too.

Key: WriteScope: Company


## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /devices/{deviceId}/documents
openapi: 3.1.1
info:
  title: Public API - BETA
  description: Read docs on https://docs.getprimo.com/
  version: '1.0'
  contact: {}
servers:
  - url: https://api.getprimo.com
security:
  - apikey: []
tags: []
paths:
  /devices/{deviceId}/documents:
    post:
      tags:
        - Devices
      summary: Attach a ticket file to a device
      description: >-
        Attach a file someone sent on a ticket (an erasure certificate, a repair
        report, an invoice) to the device, among its documents. `fileId` is the
        id of a file of a ticket comment, as `getTicket` lists it. The file must
        be a PDF, JPEG, PNG or PKCS #7 file of 4 MB at most: any other is
        refused with 422, and a file whose content does not match its type too.
      operationId: uploadDeviceDocument
      parameters:
        - name: deviceId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadDeviceDocumentBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadDeviceDocument_Output'
components:
  schemas:
    UploadDeviceDocumentBody:
      type: object
      properties:
        fileId:
          description: >-
            Id of a file attached to a ticket comment, as `files[].id` of the
            comment in `getTicket` returns it
          type: string
      required:
        - fileId
    UploadDeviceDocument_Output:
      type: object
      properties:
        success:
          type: boolean
          const: true
        fileName:
          type: string
          description: The name the document carries on the device
      required:
        - success
        - fileName
      additionalProperties: false
  securitySchemes:
    apikey:
      scheme: bearer
      bearerFormat: API key
      type: http
      description: >-
        Use your Primo API key in the Authorization header as `Bearer
        <API_KEY>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.