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

# Resolve a scanned string

> Scope `inventory:read`. Accepts GS1 DataMatrix / GS1-128 (with or without group separators and the bracketed form),
SKU codes, UPC/EAN and NDC (derived from a GTIN-14 starting 003 or a UPC-A starting 3). Returns the product and any
lot, expiry and serial in the code, or `match: unknown_code` with what could be parsed.




## OpenAPI

````yaml /pharmacy-api/inventory-openapi.yaml post /inventory/scan/resolve
openapi: 3.1.0
info:
  title: Pharmacy Inventory API
  version: 1.0.0
  description: >
    Read stock, scan-resolve barcodes, post movements, reserve stock for orders
    and subscribe to stock events.


    **Authentication.** `Authorization: Bearer vr_live_...`. A key belongs to
    your pharmacy and carries `inventory:read`

    and/or `inventory:write`. Test keys (`vr_test_...`) can read but never
    change stock.


    **Idempotency.** Every write needs an `Idempotency-Key` header (8 to 100
    visible characters). A retry with the same key

    returns the first result (HTTP 200, `idempotent: true`) and posts once.


    **Rules enforced for you.** On-hand never goes negative; orders draw only
    from released, unexpired, unreserved lots,

    first to expire first; every change is one permanent ledger entry. Rule
    failures return a machine-readable `error.code`

    and a plain-English `error.message`: `insufficient_stock` (409);
    `lot_expired`, `lot_not_released`, `lot_expiry_mismatch`,

    `expiry_required` (422); `product_not_found`, `location_not_found`,
    `lot_not_found` (404); `invalid_movement`,

    `lot_required`, `validation_error` (400).


    **Events.** Webhooks are signed: `X-Webhook-Signature: sha256=<hex
    HMAC-SHA256 of the exact request body, keyed with your

    endpoint secret>`. Headers `X-Webhook-Event`, `X-Webhook-Delivery` and
    `X-Webhook-Timestamp` accompany every request.

    Delivery is at least once with exponential backoff for about a day, then
    parked for replay. Deduplicate on

    `X-Webhook-Delivery`. Events: `stock.changed`, `stock.low`,
    `lot.status_changed`, `lot.expiring`, `sku.created`,

    `sku.updated`, `count.approved`, `temperature.excursion`.
servers:
  - url: https://vitarelay.com/api/public/v1
    description: Production
security:
  - bearer: []
paths:
  /inventory/scan/resolve:
    post:
      summary: Resolve a scanned string
      description: >
        Scope `inventory:read`. Accepts GS1 DataMatrix / GS1-128 (with or
        without group separators and the bracketed form),

        SKU codes, UPC/EAN and NDC (derived from a GTIN-14 starting 003 or a
        UPC-A starting 3). Returns the product and any

        lot, expiry and serial in the code, or `match: unknown_code` with what
        could be parsed.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - code
              properties:
                code:
                  type: string
                  maxLength: 400
      responses:
        '200':
          description: Resolution
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScanResolution'
components:
  schemas:
    ScanResolution:
      type: object
      properties:
        match:
          type: string
          enum:
            - sku
            - barcode
            - gtin
            - ndc
            - location
            - unknown_code
        product_id:
          type: string
        sku_code:
          type: string
        lot_number:
          type:
            - string
            - 'null'
        expiry_date:
          type:
            - string
            - 'null'
        serial:
          type:
            - string
            - 'null'
  securitySchemes:
    bearer:
      type: http
      scheme: bearer

````

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