> ## 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.

# Export devices as CSV

> Export the devices of your company as a paginated CSV (one row per device, first line is the header, up to 1000 devices per page). Each row contains the device attributes, its latest code of each type (recovery key, iCloud bypass code, unlock PIN, recovery OS password — see `getDeviceCodeHistory` for the full history), and one `customField.<label>` column per active custom field (SELECT / MULTI_SELECT values are resolved to their option labels). Iterate `page` until `totalPages` and concatenate the CSV pages (dropping the header line of subsequent pages) to rebuild the full export. The REST route responds with `text/csv` (pagination in the `X-Page`, `X-Per-Page`, `X-Total-Pages` and `X-Total-Elements` headers); the MCP tool returns the CSV in the `csv` field.

<span className="badge-read">Key: Read</span><span className="badge-company">Scope: Company</span>


## OpenAPI

````yaml https://api.getprimo.com/openapi.json get /devices/export
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/export:
    get:
      tags:
        - Devices
      summary: Export devices as CSV
      description: >-
        Export the devices of your company as a paginated CSV (one row per
        device, first line is the header, up to 1000 devices per page). Each row
        contains the device attributes, its latest code of each type (recovery
        key, iCloud bypass code, unlock PIN, recovery OS password — see
        `getDeviceCodeHistory` for the full history), and one
        `customField.<label>` column per active custom field (SELECT /
        MULTI_SELECT values are resolved to their option labels). Iterate `page`
        until `totalPages` and concatenate the CSV pages (dropping the header
        line of subsequent pages) to rebuild the full export. The REST route
        responds with `text/csv` (pagination in the `X-Page`, `X-Per-Page`,
        `X-Total-Pages` and `X-Total-Elements` headers); the MCP tool returns
        the CSV in the `csv` field.
      operationId: exportDevices
      parameters:
        - name: page
          required: false
          in: query
          description: Page of devices to export (1-indexed)
          schema:
            minimum: 1
            maximum: 9007199254740991
            default: 1
            type: number
        - name: perPage
          required: false
          in: query
          description: Number of devices per CSV page (default 500, max 1000)
          schema:
            minimum: 1
            maximum: 1000
            default: 500
            type: number
      responses:
        '200':
          description: >-
            CSV page, one row per device. Pagination is returned in the X-Page,
            X-Per-Page, X-Total-Pages and X-Total-Elements response headers.
          content:
            text/csv:
              schema:
                type: string
components:
  securitySchemes:
    apikey:
      scheme: bearer
      bearerFormat: API key
      type: http
      description: >-
        Use your Primo API key in the Authorization header as `Bearer
        <API_KEY>`.

````