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

# Get custom fields for multiple devices

> Return all Active custom field definitions for MULTIPLE devices in one call, each paired with the current stored value (or null when unset), grouped by device id. Provide a list of `deviceIds` (up to 500 per call). Prefer this over calling `getDeviceCustomFields` once per device.

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


## OpenAPI

````yaml https://api.getprimo.com/openapi.json post /devices/custom-fields
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/custom-fields:
    post:
      tags:
        - Devices
      summary: Get custom fields for multiple devices
      description: >-
        Return all Active custom field definitions for MULTIPLE devices in one
        call, each paired with the current stored value (or null when unset),
        grouped by device id. Provide a list of `deviceIds` (up to 500 per
        call). Prefer this over calling `getDeviceCustomFields` once per device.
      operationId: getDevicesCustomFields
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetDevicesCustomFieldsBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetDevicesCustomFields_Output'
components:
  schemas:
    GetDevicesCustomFieldsBody:
      type: object
      properties:
        deviceIds:
          description: Device ids to fetch custom fields for. Up to 500 per call.
          minItems: 1
          maxItems: 500
          type: array
          items:
            type: string
      required:
        - deviceIds
    GetDevicesCustomFields_Output:
      type: object
      properties:
        items:
          type: array
          description: >-
            Custom fields grouped by device id, in the same order as the input
            `deviceIds`.
          items:
            type: object
            properties:
              deviceId:
                type: string
              customFields:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: object
                      properties:
                        id:
                          description: CustomField id (MongoDB ObjectId string).
                          type: string
                        label:
                          type: string
                        fieldType:
                          description: Type of data this field holds.
                          type: string
                          enum:
                            - SELECT
                            - MULTI_SELECT
                            - CHECKBOX
                            - TEXT
                            - DATE
                            - NUMBER
                            - URL
                        applyTo:
                          type: array
                          items:
                            type: string
                            enum:
                              - DEVICE
                              - ACCESSORY
                              - EMPLOYEE
                              - ORDER
                        options:
                          description: >-
                            Option catalog. Non-empty only for SELECT /
                            MULTI_SELECT fields. Use option `id` when writing
                            values.
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                description: >-
                                  Stable UUID of the option. Use this id for
                                  SELECT / MULTI_SELECT value writes.
                                type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                              value:
                                description: >-
                                  Display label of the option (mutable — ids are
                                  the stable identity).
                                type: string
                            required:
                              - id
                              - value
                            additionalProperties: false
                      required:
                        - id
                        - label
                        - fieldType
                        - applyTo
                        - options
                      additionalProperties: false
                    value:
                      description: >-
                        Current stored value for this field on this device, or
                        null when unset. For SELECT / MULTI_SELECT the value is
                        the option id (or array of ids). For CHECKBOX it is a
                        boolean. For DATE it is an ISO date string.
                      anyOf:
                        - type: boolean
                        - type: number
                        - type: string
                        - type: array
                          items:
                            type: string
                        - type: 'null'
                  required:
                    - field
                    - value
                  additionalProperties: false
            required:
              - deviceId
              - customFields
            additionalProperties: false
      required:
        - items
      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>`.

````