# Listar clientes (https://docs.loybox.com.ar/api-reference/clientes/listar)



<Endpoint method="GET" path="/v1/clients/list" auth="api-key" />

Trae el listado de clientes del comercio, paginado en formato límite y
desplazamiento.

## Parámetros [#parámetros]

<Fields>
  <Field name="limit" type="integer" location="query">
    Cuántos clientes traer por página. De `1` a `100`. Por defecto, `20`.
  </Field>

  <Field name="offset" type="integer" location="query">
    Desde qué posición arrancar. Por defecto, `0`.
  </Field>
</Fields>

## Respuesta [#respuesta]

<Fields>
  <Field name="items" type="array de clientes" required="true">
    Los clientes de esta página. Ver [Cliente](https://docs.loybox.com.ar/api-reference/objetos#cliente).
  </Field>

  <Field name="total" type="integer | null" required="true">
    Cantidad total de clientes del comercio, sin paginar.
  </Field>

  <Field name="limit" type="integer | null" required="true">
    El límite aplicado.
  </Field>

  <Field name="offset" type="integer | null" required="true">
    El desplazamiento aplicado.
  </Field>
</Fields>

## Ejemplo [#ejemplo]

```bash
curl https://loybox-public-api-752998171300.southamerica-west1.run.app/v1/clients/list?limit=2&offset=0 \
  -H "Authorization: Bearer $LOYBOX_API_KEY"
```

```json
// 200 OK
{
  "items": [
    {
      "code": 12345,
      "username": "Ana Pérez",
      "email": "ana@example.com",
      "points": 340
    },
    {
      "code": 12346,
      "username": "Bruno Díaz",
      "email": "bruno@example.com",
      "points": 0
    }
  ],
  "total": 1875,
  "limit": 2,
  "offset": 0
}
```

Para recorrer todo el listado, andá sumando `limit` al `offset` hasta que la
suma llegue a `total`.

## Errores [#errores]

| Código | Cuándo                                                           |
| ------ | ---------------------------------------------------------------- |
| `401`  | La API key es inválida: no tiene un comercio asociado.           |
| `422`  | `limit` está fuera del rango de 1 a 100, o `offset` es negativo. |
