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

# Chain of Custody by Identifier

> Retrieve asset custody history using an EZYiD, serial number, custom ID, or APK ID.

Use an API key generated in **Admin → My Preferences → API Key Configuration**. The subscriber is stored against the key and is resolved automatically; do not pass a subscriber ID.

Supply exactly one selector: `ezyid`, `serialNumber`, `customId`, or `apkId`. Identifiers use exact matches within the key's subscriber, with surrounding input whitespace trimmed. Matching follows the database's collation rules. If multiple assets match, the API returns **409 Conflict**; use a unique identifier or the asset's APK ID.

### Request examples

```bash theme={null}
curl --get 'https://api-external.ezyid.io/api/assets/chain-of-custody' \
  --data-urlencode 'apiKey=YOUR_API_KEY' \
  --data-urlencode 'serialNumber=SN123' \
  --data-urlencode 'fromDate=2026-10-01' \
  --data-urlencode 'toDate=2026-10-26' \
  --data-urlencode 'sortColumn=date' \
  --data-urlencode 'sortDesc=true'
```

To use another selector, replace `serialNumber=SN123` with `ezyid=EZ123`, `customId=MY-ASSET-123`, or `apkId=123`. URL-encode identifier values containing spaces or special characters.

### Filtering and response

`fromDate` and `toDate` use `yyyy-MM-dd` and include both boundary dates. Optional filters include `search`, `performedBy` (comma-separated names), and `custodyMovementTypes` (comma-separated event type substrings such as `transfer,checkout`). `sortColumn` defaults to `date`; `sortDesc` defaults to `false`.

The response contains `data`, `totalCount`, `page`, and `pageSize`. It uses the existing inventory custody report, including purchase and create rows when available. The current report returns at most **10,000 rows**, with `page: 1` and `pageSize: 10000`. This endpoint does not expose paging parameters.

> [!NOTE]
>
> This GET endpoint retrieves history. It does not perform a transfer or update inventory.

For the path-based APK ID route, see [Chain of Custody by APK ID](https://help.ezyid.io/api-reference/endpoint/chain-of-custody-by-apk-id.md).


## OpenAPI

````yaml GET /api/assets/chain-of-custody
openapi: 3.0.1
info:
  title: EZYiD API
  version: '1.0'
servers:
  - url: https://api-external.ezyid.io
security: []
tags:
  - name: EZYiD.External.API
paths:
  /api/assets/chain-of-custody:
    get:
      tags:
        - Assets
      summary: Retrieve chain of custody by asset identifier
      description: >-
        Authenticates with the My Preferences API key and resolves the asset
        within its subscriber. No subscriberId parameter is required. Supply
        exactly one selector: apkId, ezyid, serialNumber, or customId. Lookup
        uses exact matches under the database collation and returns 409 for
        ambiguous identifiers. Retrieves history only; it does not transfer
        assets or update inventory.
      operationId: GetAssetChainOfCustodyByIdentifier
      parameters:
        - name: apiKey
          in: query
          required: true
          description: >-
            API key generated in Admin > My Preferences > API Key Configuration.
            The subscriber is read from this key; do not supply subscriberId.
          schema:
            type: string
        - name: apkId
          in: query
          required: false
          description: Internal asset APK ID. Supply exactly one asset selector.
          schema:
            type: integer
            format: int32
            minimum: 1
        - name: ezyid
          in: query
          required: false
          description: >-
            Exact EZYiD match within the key's subscriber. Surrounding
            whitespace is trimmed. Supply exactly one asset selector.
          schema:
            type: string
        - name: serialNumber
          in: query
          required: false
          description: >-
            Exact serial number match within the key's subscriber. Surrounding
            whitespace is trimmed. Duplicate matches return 409.
          schema:
            type: string
        - name: customId
          in: query
          required: false
          description: >-
            Exact custom ID match within the key's subscriber. Surrounding
            whitespace is trimmed. Duplicate matches return 409.
          schema:
            type: string
        - name: fromDate
          in: query
          required: false
          description: >-
            Inclusive start date. Must be on or before toDate when both are
            supplied.
          schema:
            type: string
            format: date
        - name: toDate
          in: query
          required: false
          description: Inclusive end date.
          schema:
            type: string
            format: date
        - name: search
          in: query
          required: false
          description: Search text for the chain of custody report.
          schema:
            type: string
        - name: performedBy
          in: query
          required: false
          description: Comma-separated names to filter the report.
          schema:
            type: string
        - name: custodyMovementTypes
          in: query
          required: false
          description: >-
            Comma-separated, case-insensitive substrings of event type names,
            for example transfer,checkout.
          schema:
            type: string
        - name: sortColumn
          in: query
          required: false
          description: >-
            Column to sort by. Defaults to date. Supported canonical keys: date,
            assetname, category, assetid, partnumber, serialnumber, customid,
            site, movementtype, performedby, details, eventid.
          schema:
            type: string
            default: date
        - name: sortDesc
          in: query
          required: false
          description: Use true for descending order.
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: >-
            Chain of custody report. Returns at most 10,000 rows with page 1 and
            pageSize 10000; these endpoints do not expose paging parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChainOfCustodyReport'
        '400':
          description: >-
            Missing apiKey, invalid input, no asset selector, multiple asset
            selectors, or invalid date range. Input binding errors may use the
            framework validation error format.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '401':
          description: API key is revoked or expired.
        '404':
          description: >-
            API key is unknown, or the selected asset does not exist in the
            key's subscriber. Assets belonging to other subscribers are not
            exposed.
        '409':
          description: >-
            The identifier matches multiple assets in the key's subscriber. Use
            a unique identifier or the APK ID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '502':
          description: The inventory service could not return the chain of custody report.
          content:
            application/problem+json:
              schema:
                type: object
                properties:
                  title:
                    type: string
                    example: The chain of custody report is unavailable.
                  status:
                    type: integer
                    example: 502
components:
  schemas:
    ChainOfCustodyReport:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ChainOfCustodyRow'
        totalCount:
          type: integer
          format: int32
          description: Total count reported by the inventory service.
        page:
          type: integer
          example: 1
        pageSize:
          type: integer
          example: 10000
          description: >-
            The internal report row limit. No page or pageSize query parameters
            are exposed.
    ApiError:
      type: object
      properties:
        error:
          type: string
          description: >-
            What was wrong with the request, naming the field or operator at
            fault.
    ChainOfCustodyRow:
      type: object
      description: >-
        A custody history row. Uses the existing inventory movement row shape;
        ledger-specific values can be empty or zero.
      properties:
        id:
          type: integer
          format: int32
        date:
          type: string
          format: date-time
        siteId:
          type: integer
          format: int32
        siteName:
          type: string
        inventoryRegisterId:
          type: integer
          format: int32
        itemName:
          type: string
        category:
          type: string
        assetId:
          type: string
        partNumber:
          type: string
        serialNumber:
          type: string
        customId:
          type: string
        movementType:
          type: string
        eventTypeId:
          type: integer
          format: int32
        eventCode:
          type: string
          description: Display event reference, for example E-6483139.
        jobCardCode:
          type: string
          description: Material order or consignment reference when present.
        direction:
          type: string
        stockIn:
          type: number
        stockOut:
          type: number
        balanceAfter:
          type: number
        contractorEmail:
          type: string
        activityCreatedBy:
          type: string
        checkoutToDisplay:
          type: string
        performedBy:
          type: string
        details:
          type: string
          description: >-
            Custody event details, including transfer from/to information when
            available.
        trackingType:
          type: string
        referenceId:
          type: integer
          format: int32
        adjustmentMode:
          type: integer
          format: int32

````

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