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

# Redeem a Device Code

> Poll with your device code until the owner approves, then receive the live API key exactly once.

Poll this with the `device_code` from [`POST /device/code`](/docs/v2/api-reference/device/start-device-code) every `interval` seconds. On approval it returns the live key — **once**. Persist it immediately.

```bash theme={null}
curl -X POST https://api.zinc.com/device/token \
  -H "Content-Type: application/json" \
  -d '{"device_code": "DE_..."}'
```

## Polling states

| Status | `error.code`            | What to do                                                  |
| ------ | ----------------------- | ----------------------------------------------------------- |
| `400`  | `authorization_pending` | The human has not decided yet. Poll again after `interval`. |
| `400`  | `slow_down`             | You are polling too fast. Back off, then continue.          |
| `400`  | `expired_token`         | The code aged out. Start over with a new one.               |
| `403`  | `access_denied`         | The owner declined. Stop; do not mint another code.         |
| `200`  | —                       | Approved. Read `api_key` and stop polling.                  |

## What arrives with the key

* `wallet_balance_cents` — spendable balance of the account the key belongs to.
* `sandbox` — what the sandbox claim moved, when a `zn_test_` key was attached.
* `starter_credit` — credit granted alongside the key, if the account earned one, with a few orderable picks it covers.

<Warning>
  `key` and `api_key` are returned on this response only. Nothing stores the plaintext afterwards, so write it to your credential store before doing anything else.
</Warning>


## OpenAPI

````yaml versions/latest.json POST /device/token
openapi: 3.1.0
info:
  title: Zinc
  summary: >-
    Zinc lets you search, buy, and return items from top online retailers with a
    single API.
  description: >-
    Search, buy, and return items from top online retailers with a single API.
    Supports AI agent ordering via MPP (HTTP 402) — no account required.
    Supported retailers include 1-800-Flowers, Ace Hardware, Amazon, Amazon DE,
    Barnes & Noble, Best Buy, Chewy, Gap, IBS, Lowe's, Macys, Partstown, and 12
    more. Ships to the US and 2 other countries (DE, IT).
  version: '2026-08-21'
  x-logo:
    url: https://mintlify.s3.us-west-1.amazonaws.com/zinc/logo/light.png
  contact:
    name: Zinc API Support
    email: support@zinc.com
    url: https://zinc.com/docs
  x-guidance: >-
    Zinc lets AI agents buy products from online retailers via a single API. Use
    POST /agent/orders to place an order — no Zinc account needed, payment is
    handled via MPP (HTTP 402 flow). Provide a product URL from a supported
    retailer, a shipping address, and max_price in cents. The API charges
    max_price + $1 API fee upfront and refunds the difference on completion. To
    find products first, the /agent/* data endpoints (search, products/search,
    products/offers, products/details) are MPP-paid at $0.01 per call;
    /agent/search returns orderable URLs to feed straight into /agent/orders.
    GET /retailers lists supported retailers for free (no payment or account).
    Authenticated equivalents (orders, products, managed-accounts) require a
    Bearer token (API key prefixed zn_); those orders are paid from a prefunded
    wallet — GET /wallet/me returns the spendable balance and per-order fee, so
    check it before POST /orders to avoid a 402. Docs: https://zinc.com/docs
    Supported retailers include 1-800-Flowers, Ace Hardware, Amazon, Amazon DE,
    Barnes & Noble, Best Buy, Chewy, Gap, IBS, Lowe's, Macys, Partstown, and 12
    more, shipping to the US and 2 other countries (DE, IT).
  x-supported-retailers:
    - 1-800-Flowers
    - Ace Hardware
    - Amazon
    - Amazon DE
    - Barnes & Noble
    - Best Buy
    - Chewy
    - Gap
    - IBS
    - Lowe's
    - Macys
    - Partstown
    - Pokémon Center
    - Sephora
    - Target
    - The Home Depot
    - TikTok
    - Uniqlo
    - Walmart
    - Wayfair
    - Zinc
    - eBay
    - libraccio
    - zazzle
  x-supported-countries:
    - US
    - DE
    - IT
servers:
  - url: https://api.zinc.com
    description: Production
security:
  - BearerAuth: []
paths:
  /device/token:
    post:
      tags:
        - device
      summary: Poll for the key (returns it exactly once)
      operationId: redeem_device_code_device_token_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceTokenRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyExchangeResponse'
        '400':
          description: >-
            `authorization_pending` (keep polling), `slow_down` (poll less
            often), or `expired_token` (start over).
        '403':
          description: '`access_denied` — the owner declined; stop.'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    DeviceTokenRequest:
      properties:
        device_code:
          type: string
          maxLength: 128
          minLength: 16
          title: Device Code
      type: object
      required:
        - device_code
      title: DeviceTokenRequest
    ApiKeyExchangeResponse:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        key:
          type: string
          title: Key
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        is_active:
          type: boolean
          title: Is Active
        is_test:
          type: boolean
          title: Is Test
        created_at:
          type: string
          format: date-time
          title: Created At
        wallet_balance_cents:
          type: integer
          title: Wallet Balance Cents
          description: Spendable wallet balance of the account the key belongs to.
        sandbox:
          anyOf:
            - $ref: '#/components/schemas/SandboxClaimSummary'
            - type: 'null'
          description: What the sandbox claim moved, when `sandbox_key` was sent.
        starter_credit:
          anyOf:
            - $ref: '#/components/schemas/StarterCredit'
            - type: 'null'
          description: >-
            Wallet credit granted alongside this key, if the account earned one,
            with a few items it is known to cover.
        api_key:
          type: string
          title: Api Key
          readOnly: true
      type: object
      required:
        - id
        - key
        - name
        - is_active
        - is_test
        - created_at
        - wallet_balance_cents
        - api_key
      title: ApiKeyExchangeResponse
      description: The issued key, plus what the agent needs to act on it right away.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SandboxClaimSummary:
      properties:
        orders_moved:
          type: integer
          title: Orders Moved
        keys_moved:
          type: integer
          title: Keys Moved
        note:
          type: string
          title: Note
          default: >-
            Your sandbox order history and its key now belong to this account.
            The sandbox key keeps working for test mode; use the live key for
            real orders.
      type: object
      required:
        - orders_moved
        - keys_moved
      title: SandboxClaimSummary
      description: What claiming the agent's sandbox moved onto the approving account.
    StarterCredit:
      properties:
        cents:
          type: integer
          title: Cents
          description: >-
            Starter credit added to the wallet by this approval; 0 when none
            was.
        reason:
          type: string
          title: Reason
          description: >-
            `granted`; `already_granted` (the account received its one starter
            credit earlier); `no_sandbox_order` (no proven sandbox was
            attached).
        wallet_balance_cents:
          type: integer
          title: Wallet Balance Cents
          description: Spendable wallet balance right now.
        max_price_cents:
          type: integer
          title: Max Price Cents
          description: >-
            Largest `max_price` an order can carry on the wallet alone (balance
            minus the per-order fee).
        message:
          type: string
          title: Message
          description: Plain-language version of the above, for the operator.
        picks:
          items:
            $ref: '#/components/schemas/StarterPick'
          type: array
          title: Picks
          description: Suggested first purchases (a bag of coffee).
      type: object
      required:
        - cents
        - reason
        - wallet_balance_cents
        - max_price_cents
        - message
        - picks
      title: StarterCredit
      description: >-
        The wallet this key spends from, in the terms an agent needs to place

        its first order. Always present on a key-issuing response, whether or
        not

        a starter credit landed this time: an agent must never have to infer its

        budget from a null.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    StarterPick:
      properties:
        title:
          type: string
          title: Title
        url:
          type: string
          title: Url
        retailer:
          type: string
          title: Retailer
        price_cents:
          anyOf:
            - type: integer
            - type: 'null'
          title: Price Cents
          description: >-
            Retailer list price when the pick was last verified; null when not
            yet checked.
      type: object
      required:
        - title
        - url
        - retailer
      title: StarterPick
      description: One thing the starter credit is known to cover, with an orderable URL.
  securitySchemes:
    BearerAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Zinc API key (Bearer zn_...)

````