# 2. First request

> Exchange the key for a token and read the product catalog.

## Get an access token

```bash
curl -X POST 'https://api-admin.billz.ai/v1/auth/login' \
  -H 'Content-Type: application/json' \
  -d '{"secret_token": "SECRET_KEY"}'
```

Response:

```json
{
  "code": 200,
  "message": "ok",
  "error": null,
  "data": {
    "access_token": "eyJhbGciOi...",
    "refresh_token": "eyJhbGciOi...",
    "token_type": "Bearer",
    "expires_in": 1296000
  }
}
```

`expires_in` is in seconds: for sign-in with a key it is **15 days**. Along with it, `refresh_token` is stored (lifetime — 30 days): it is used to refresh the token pair without using the secret key.

![Issuing a token: the application sends the secret key to POST /v1/auth/login, the API returns access\_token, refresh\_token and expires\_in, the application stores the pair](/_astro/03-issue-token.DNaVqB9R_Z2bRBuq.webp)

> **The lifetime is taken from the response**
>
> After `POST /v2/auth/refresh` the lifetime is taken from the server configuration and may differ from 15 days. See [authentication and permissions](/en/concepts/auth/) for details.

## Read the catalog

```bash
curl -X GET 'https://api-admin.billz.ai/v2/products?limit=5&search=Nike' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
```

The response is an object with two fields:

```json
{
  "count": 134,
  "products": [
    {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "Air Jordan 1 High",
      "barcode": "978020137962",
      "sku": "THY-1232",
      "shop_measurement_values": [
        { "shop_id": "...", "shop_name": "Nike Store", "active_measurement_value": 5 }
      ],
      "shop_prices": [
        { "shop_id": "...", "shop_name": "Nike Store",
          "retail_price": 1000000, "retail_currency": "UZS",
          "supply_price": 600000, "supply_currency": "UZS",
          "promo_price": 0, "promos": [] }
      ]
    }
  ]
}
```

Stock and prices are returned **per shop**.

## Useful parameters

| Parameter       | Meaning                                                                                               |
| --------------- | ----------------------------------------------------------------------------------------------------- |
| `limit`, `page` | pagination; 100 records per page by default                                                           |
| `search`        | search string; substring, case-insensitive. By default searches by name, SKU, barcode and description |

The remaining catalog parameters — filters by dates, shops and search fields — are covered in [catalog synchronization](/en/guides/sync-catalog/).

Next: [first sale](/en/start/first-sale/).