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

# Listar tarjetas

> Endpoint para obtener las tarjetas tokenizadas registradas en tu empresa.

### Query Parameters

<ParamField query="filter[customer_id]" type="string" placeholder="9dd4158b-0e45-42bc-b56f-a4c1f856814d">
  Filtra tarjetas por ID de cliente.
</ParamField>

<ParamField query="sort" type="string" default="-created_at">
  Ordenamiento por fecha de creación. Usa `created_at` para ascendente y `-created_at` para descendente (más reciente primero).
</ParamField>

<ParamField query="per_page" type="integer" default="15">
  Cantidad de resultados por página.
</ParamField>

<ParamField query="page" type="integer" default="1">
  Número de página para paginación.
</ParamField>

### Ejemplos de uso

<Tabs>
  <Tab title="curl">
    ```bash theme={null}
    curl https://api.onepay.la/v1/cards \
      -X GET \
      -H "Authorization: Bearer sk_test_xxx"
    ```

    Con filtro por cliente:

    ```bash theme={null}
    curl "https://api.onepay.la/v1/cards?filter[customer_id]=9dd4158b-0e45-42bc-b56f-a4c1f856814d" \
      -X GET \
      -H "Authorization: Bearer sk_test_xxx"
    ```
  </Tab>

  <Tab title="JavaScript">
    ```ts theme={null}
    const response = await fetch('https://api.onepay.la/v1/cards?filter[customer_id]=9dd4158b-0e45-42bc-b56f-a4c1f856814d', {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer sk_test_xxx',
      },
    });
    const data = await response.json();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    response = requests.get(
        'https://api.onepay.la/v1/cards',
        params={'filter[customer_id]': '9dd4158b-0e45-42bc-b56f-a4c1f856814d'},
        headers={'Authorization': 'Bearer sk_test_xxx'},
    )
    data = response.json()
    ```
  </Tab>
</Tabs>

### Response

<ResponseField name="data" type="array">
  Lista de tarjetas.

  <Expandable title="Propiedades de cada tarjeta">
    <ResponseField name="id" type="string">UUID de la tarjeta tokenizada.</ResponseField>
    <ResponseField name="brand" type="string">Marca de la tarjeta (`Mastercard`, `Visa`, etc.).</ResponseField>
    <ResponseField name="label" type="string">Etiqueta legible, por ejemplo `Mastercard • 8099`.</ResponseField>
    <ResponseField name="last_four" type="string">Últimos 4 dígitos de la tarjeta.</ResponseField>
    <ResponseField name="expiration_date" type="string">Fecha de vencimiento en formato `MM/YYYY`, por ejemplo `9/2026`.</ResponseField>
    <ResponseField name="customer_id" type="string">UUID del cliente al que pertenece la tarjeta.</ResponseField>
    <ResponseField name="created_at" type="string">Fecha de creación en formato ISO 8601.</ResponseField>
    <ResponseField name="country" type="string">Código de país donde fue registrada la tarjeta, por ejemplo `CO`.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="current_page" type="integer">Página actual.</ResponseField>
<ResponseField name="from" type="integer">Índice del primer registro en la página actual.</ResponseField>
<ResponseField name="last_page" type="integer">Última página disponible.</ResponseField>
<ResponseField name="per_page" type="integer">Cantidad de registros por página.</ResponseField>
<ResponseField name="to" type="integer">Índice del último registro en la página actual.</ResponseField>
<ResponseField name="total" type="integer">Total de tarjetas.</ResponseField>

### Ejemplo de respuesta

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": [
      {
        "id": "9e01eeae-2868-4564-9d04-84d1d1d027d2",
        "brand": "Mastercard",
        "label": "Mastercard • 8099",
        "last_four": "8099",
        "expiration_date": "9/2026",
        "customer_id": "9df8018b-6a28-4696-b7b2-63615f34a2f5",
        "created_at": "2025-01-19T18:29:25.000000Z",
        "country": "CO"
      },
      {
        "id": "9e01eeae-4569-4564-9d04-84d1d1d027a3",
        "brand": "Visa",
        "label": "Visa • 4242",
        "last_four": "4242",
        "expiration_date": "12/2027",
        "customer_id": "9df8018b-6a28-4696-b7b2-63615f34a2f5",
        "created_at": "2025-01-20T10:15:30.000000Z",
        "country": "CO"
      }
    ],
    "current_page": 1,
    "from": 1,
    "last_page": 3,
    "per_page": 15,
    "to": 15,
    "total": 42
  }
  ```
</ResponseExample>
