---
title: "Search for a list of device(s)"
url: "https://stg.developer.mla.com.au/apis/device-public-staging/versions/51bbd5df-9d52-4e96-8fab-3c0fd2f54a36/operations/searchDevice"
---

> Full API specification: https://stg.developer.mla.com.au/apis/device-public-staging/versions/51bbd5df-9d52-4e96-8fab-3c0fd2f54a36.md

# Search for a list of device(s)

`POST` `/public/device/v1/search`

Operation ID: `searchDevice`

This API allows the invoker to get a list of devices that the invoker has access to. The route takes a request containing filter metadata and returns Device metadata that fulfils the search filter as a response. The response only returns the required Device data in a sorted order, specified in the header.

## Header parameters

- `correlationId` (string, required) - UUID used to track the API call from the invoker's perspective. Sender is required to include the correlationId in the request to use it as a tracker for asynchronous responses.
- `outputFields` (string, required) - A comma-separated list of the Device data fields to return from the search. If blank, it will return all Device data.
- `sortBy` (string, optional) - The field to sort the output list by.
- `sortOrder` (string, optional) - The order to return the list based on sortBy i.e. ascend means alphabetical/numerical.

## Request body

Content types: `application/json`

## Responses

- `200`
- `404`
- `422`

## OpenAPI definition

```yaml
openapi: 3.1.0
info:
  title: Device Public
  version: v1.0.0
servers:
  - url: https://6dc8806175.gateways.konggateway.com
paths:
  /public/device/v1/search:
    post:
      summary: Search for a list of device(s)
      deprecated: false
      description: This API allows the invoker to get a list of devices that the
        invoker has access to. The route takes a request containing filter
        metadata and returns Device metadata that fulfils the search filter as a
        response. The response only returns the required Device data in a sorted
        order, specified in the header.
      operationId: searchDevice
      tags:
        - Device
      parameters:
        - name: correlationId
          in: header
          description: UUID used to track the API call from the invoker's perspective.
            Sender is required to include the correlationId in the request to
            use it as a tracker for asynchronous responses.
          required: true
          example: ""
          schema:
            type: string
        - name: outputFields
          in: header
          description: A comma-separated list of the Device data fields to return from the
            search. If blank, it will return all Device data.
          required: true
          example: devices.EID.rfid
          schema:
            type: string
        - name: sortBy
          in: header
          description: The field to sort the output list by.
          required: false
          example: ""
          schema:
            type: string
        - name: sortOrder
          in: header
          description: The order to return the list based on sortBy i.e. ascend means
            alphabetical/numerical.
          required: false
          example: ""
          schema:
            type: string
            enum:
              - asc
              - desc
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                manufacturerCode:
                  type: string
                deviceType:
                  type: object
                  properties:
                    code:
                      type: string
                    colorCode:
                      type: string
                  description: Optional if object is a non-NLIS device
                EID:
                  type: array
                  description: >
                    An array of EID objects, where each object contains either:
                    - `rfid`: A 15–16 digit number - `nlisId`: A 16-character
                    alphanumeric value
                  items:
                    oneOf:
                      - type: object
                        properties:
                          rfid:
                            type: string
                            description: |
                              The RFID is 16 character number
                            minLength: 15
                            maxLength: 16
                      - type: object
                        properties:
                          nlisId:
                            type: string
                            description: The NLISID is 16 character alphanumeric value. Optional if object
                              is a non-NLIS device
                            minLength: 16
                            maxLength: 16
                productCode:
                  type: string
                  description: Product codes uniquely identify the type of identification device,
                    including its specific characteristics such as type, colour,
                    and usage.
                currentPic:
                  type: string
                  pattern: ^[A-Z0-9]{8}$
                picOfIssue:
                  type: string
                  pattern: ^[A-Z0-9]{8}$
                species:
                  type: array
                  items:
                    type: string
                lifetimeTraceability:
                  type: boolean
                issueDate:
                  type: array
                  items:
                    type: string
                  minItems: 2
                  maxItems: 2
                managementEarTagId:
                  type: string
                isNLISDevice:
                  type: boolean
                  description: True if device object is an NLIS device. False if device object is
                    a non NLIS device.
                statuses:
                  type: array
                  items:
                    type: object
                    properties:
                      status:
                        type: string
                      statusCode:
                        type: string
                      category:
                        type: string
                      programCode:
                        type: string
                      effectiveDate:
                        type: string
                      expiryDate:
                        type: string
                      lastAuditDate:
                        type: string
                      auditFrequency:
                        type: string
            example:
              currentPic: QZ222336
      responses:
        "200":
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties:
                  receiptId:
                    type: string
                  devices:
                    type: array
                    items:
                      $ref: "#/components/schemas/DeviceSearch"
                required:
                  - receiptId
                  - devices
              example:
                receiptId: 8734wy9r83wieuh
                devices:
                  - EID:
                      rfid: 982 123489467678
                  - EID:
                      rfid: 982 234567891234
                  - EID:
                      rfid: 982 345678912345
          headers:
            correlationId:
              example: ""
              required: true
              description: UUID used to track the API call from the invoker's perspective.
                Sender is required to include the correlationId in the request
                to use it as a tracker for asynchronous responses.
              schema:
                type: string
        "404":
          description: ""
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
        "422":
          description: ""
          content:
            application/json:
              schema:
                title: ""
                type: object
                properties:
                  error:
                    type: string
                  details:
                    items:
                      $ref: "#/components/schemas/ValidationError"
                    type: array
                    title: Detail
                required:
                  - error
                  - details
          headers: {}
      security: []
security: []
components:
  schemas:
    DeviceSearch:
      type: object
      additionalProperties: false
      properties:
        manufacturerCode:
          type: string
        deviceType:
          type: object
          additionalProperties: false
          properties:
            code:
              type: string
            colorCode:
              type: string
        EID:
          type: array
          description: >
            An array of EID objects, where each object contains either: -
            `rfid`: A 15–16 digit number - `nlisId`: A 16-character alphanumeric
            value
          items:
            oneOf:
              - type: object
                properties:
                  rfid:
                    type: string
                    description: |
                      The RFID is 16 character number
                    minLength: 15
                    maxLength: 16
              - type: object
                properties:
                  nlisId:
                    type: string
                    description: The NLISID is 16 character alphanumeric value. Optional if object
                      is a non-NLIS device
                    minLength: 16
                    maxLength: 16
        productCode:
          type: string
          description: |-
            Product codes uniquely identify the type of identification
                device, including its specific characteristics such as
                type, colour, and usage.
        currentPIC:
          type: string
        picOfIssue:
          type: string
        species:
          type: array
          items:
            type: string
        lifetimeTraceability:
          type: boolean
        issueDate:
          type: array
          items:
            type: string
            minItems: 2
            maxItems: 2
        managementEarTagId:
          type: string
        isNLISDevice:
          type: boolean
          description: True if device object is an NLIS device. False if device object is
            a non NLIS device.
        statuses:
          type: array
          items:
            type: object
            additionalProperties: false
            properties:
              status:
                type: string
              statusCode:
                type: string
              category:
                type: string
              programCode:
                type: string
              effectiveDate:
                type: string
              expiryDate:
                type: string
              lastAuditDate:
                type: string
              auditFrequency:
                type: string
    ValidationError:
      properties:
        field:
          type: string
          title: Message
        message:
          type: string
          title: Error Type
      type: object
      required:
        - field
        - message
      title: ValidationError
```
