## Customers - Search / get customers

`GET`  https://{entorno}.ticketbaiws.eus/clientes/

`GET`  https://{entorno}.ticketbaiws.eus/clientes/{id}/

These are the customers and products of the company's **invoicing tool**  in the private area. They are meant for looking up the customer and the products before issuing an invoice with [POST /tbai/](https://ticketbaiws.eus/en/ticketbai-post/): the field names match those of the invoice (nombre, nif, pais_cliente, importe_unitario, tipo_iva, tipo_req...).

**They do not depend on the environment:**  with the test token (**api-test** ) you read and modify the same data as with the production token.

Searches customers by text (NIF, name, trade name, email or phone) or by exact NIF, or gets a single customer by its **id** . Each customer includes id, nif, tipo_documento, nombre, nombre_comercial, direccion, cp, poblacion, provincia, pais, pais_cliente (ISO-2), email, telefono, web and fecha_alta.

**GET methods accept the parameters either in the body as a JSON payload or as a query string in the URL, as shown in the cURL example.**

**PARAMETERS**

- `buscar` (string, optional): Text to search for in NIF, name, trade name, email and phone. Ejemplo: `ejemplo`
- `nif` (string, optional): Exact NIF (normalized) Ejemplo: `B01000012`
- `pagina` (integer, optional): Page number, starting at 0. Ejemplo: `0`
- `cantidad` (integer, optional): Results per page. Default 50, maximum 250. Ejemplo: `50`

The list returns the total number of results in `count`.

**GET** `https://{entorno}.ticketbaiws.eus/clientes/`

```bash
$ curl --request GET \
     --url 'https://api-test.ticketbaiws.eus/clientes/?buscar=ejemplo&pagina=0&cantidad=50' \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'Token: xxx' \
     --header 'Nif: 00000014Z'
```

Respuesta:

```json
HTTP/1.1 200 OK
{
    "result": "OK",
    "return": [
        {
            "id": 1532,
            "nif": "B01000012",
            "tipo_documento": "02",
            "nombre": "Empresa de ejemplo S.L.",
            "nombre_comercial": "Ejemplo",
            "direccion": "Calle Mayor 1",
            "cp": "48001",
            "poblacion": "Bilbao",
            "provincia": "Bizkaia",
            "pais": "España",
            "pais_cliente": "ES",
            "email": "facturas@ejemplo.com",
            "telefono": "944000000",
            "web": "https://www.ejemplo.com",
            "fecha_alta": "28/11/2026"
        }
    ],
    "msg": "Showing 1 to 1 of 1",
    "count": 1
}
```

Response GET /clientes/{id}/:

```json
HTTP/1.1 200 OK
{
    "result": "OK",
    "return": {
        "id": 1532,
        "nif": "B01000012",
        "tipo_documento": "02",
        "nombre": "Empresa de ejemplo S.L.",
        "nombre_comercial": "Ejemplo",
        "direccion": "Calle Mayor 1",
        "cp": "48001",
        "poblacion": "Bilbao",
        "provincia": "Bizkaia",
        "pais": "España",
        "pais_cliente": "ES",
        "email": "facturas@ejemplo.com",
        "telefono": "944000000",
        "web": "https://www.ejemplo.com",
        "fecha_alta": "28/11/2026"
    },
    "msg": ""
}
```

Response (not found):

```json
HTTP/1.1 200 OK
{
    "result": "ERROR",
    "return": null,
    "msg": "Client not found"
}
```

Fuente: https://ticketbaiws.eus/en/clientes-get/
