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

# Administrar clientes

> Creá y administrá clientes con los SDKs actuales de Commet y el dashboard.

Instalá la Skill de Commet para que tu agente integre clientes usando el contrato actual de la API.

```bash theme={null}
npx skills add commet-labs/skills --skill commet
```

Un customer representa a la empresa o persona que vas a cobrar. Cada customer puede tener una relación de suscripción activa a la vez.

## Dashboard

Entrá a **Customers** para buscar clientes, revisar su estado de facturación, asignar un plan y administrar la suscripción.

## Crear un customer

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { Commet } from "@commet/node";

  const commet = new Commet({ apiKey: "ck_xxx" });

  const customer = await commet.customers.create({ email: "user@example.com" });
  ```

  ```python Python theme={null}
  from commet import Commet

  commet = Commet("ck_xxx")

  customer = commet.customers.create(email="user@example.com")
  ```

  ```go Go theme={null}
  client, err := commet.New("ck_xxx")
  if err != nil {
  	log.Fatal(err)
  }
  ctx := context.Background()

  customer, err := client.Customers.Create(ctx, &commet.CreateCustomerParams{
  	Email: "user@example.com",
  })
  if err != nil {
  	log.Fatal(err)
  }
  ```

  ```java Java theme={null}
  import co.commet.Commet;
  import co.commet.params.CreateCustomerParams;

  var commet = Commet.builder().apiKey("ck_xxx").build();

  var customer = commet.customers().create(
      CreateCustomerParams.builder("user@example.com").build()
  );
  ```

  ```php PHP theme={null}
  use Commet\Commet;

  $commet = new Commet('ck_xxx');

  $customer = $commet->customers->create(email: 'user@example.com');
  ```
</CodeGroup>

`create` es idempotente cuando enviás tu propio `id`: un reintento con el mismo ID devuelve el customer existente.

Usá:

* `id` para el identificador estable de tu aplicación.
* `email` para comunicaciones de facturación.
* `address` y `taxDocument` para el contexto de facturación e impuestos.
* `metadata` para valores propios de tu aplicación que no controlen comportamiento de billing.

## Crear customers en batch

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { Commet } from "@commet/node";

  const commet = new Commet({ apiKey: "ck_xxx" });

  const customerBatch = await commet.customers.createBatch({ customers: [{ email: "user@example.com" }] });
  ```

  ```python Python theme={null}
  from commet import Commet

  commet = Commet("ck_xxx")

  customer_batch = commet.customers.create_batch(customers=[{"email": "user@example.com"}])
  ```

  ```go Go theme={null}
  client, err := commet.New("ck_xxx")
  if err != nil {
  	log.Fatal(err)
  }
  ctx := context.Background()

  customerBatch, err := client.Customers.CreateBatch(ctx, &commet.BatchCreateCustomersParams{
  	Customers: []commet.BatchCreateCustomersParamsCustomersItem{{
  		Email: "user@example.com",
  	}},
  })
  if err != nil {
  	log.Fatal(err)
  }
  ```

  ```java Java theme={null}
  import co.commet.Commet;
  import co.commet.models.BatchCreateCustomersParamsCustomersItem;
  import co.commet.params.BatchCreateCustomersParams;
  import java.util.List;

  var commet = Commet.builder().apiKey("ck_xxx").build();

  var customerBatch = commet.customers().createBatch(
      BatchCreateCustomersParams.builder(List.of(new BatchCreateCustomersParamsCustomersItem("user@example.com", null, null, null, null, null, null, null))).build()
  );
  ```

  ```php PHP theme={null}
  use Commet\Commet;

  $commet = new Commet('ck_xxx');

  $customerBatch = $commet->customers->createBatch(
      customers: [['email' => 'user@example.com']],
  );
  ```
</CodeGroup>

Un batch acepta hasta 100 customers y devuelve por separado los elementos exitosos y fallidos.

## Obtener un customer

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { Commet } from "@commet/node";

  const commet = new Commet({ apiKey: "ck_xxx" });

  const customer = await commet.customers.get({ id: "cus_xxx" });
  ```

  ```python Python theme={null}
  from commet import Commet

  commet = Commet("ck_xxx")

  customer = commet.customers.get("cus_xxx")
  ```

  ```go Go theme={null}
  client, err := commet.New("ck_xxx")
  if err != nil {
  	log.Fatal(err)
  }
  ctx := context.Background()

  customer, err := client.Customers.Get(ctx, "cus_xxx")
  if err != nil {
  	log.Fatal(err)
  }
  ```

  ```java Java theme={null}
  import co.commet.Commet;

  var commet = Commet.builder().apiKey("ck_xxx").build();

  var customer = commet.customers().get("cus_xxx");
  ```

  ```php PHP theme={null}
  use Commet\Commet;

  $commet = new Commet('ck_xxx');

  $customer = $commet->customers->get(id: 'cus_xxx');
  ```
</CodeGroup>

## Actualizar un customer

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { Commet } from "@commet/node";

  const commet = new Commet({ apiKey: "ck_xxx" });

  const customer = await commet.customers.update({ id: "cus_xxx" });
  ```

  ```python Python theme={null}
  from commet import Commet

  commet = Commet("ck_xxx")

  customer = commet.customers.update("cus_xxx")
  ```

  ```go Go theme={null}
  client, err := commet.New("ck_xxx")
  if err != nil {
  	log.Fatal(err)
  }
  ctx := context.Background()

  customer, err := client.Customers.Update(ctx, "cus_xxx", nil)
  if err != nil {
  	log.Fatal(err)
  }
  ```

  ```java Java theme={null}
  import co.commet.Commet;
  import co.commet.params.UpdateCustomerParams;

  var commet = Commet.builder().apiKey("ck_xxx").build();

  var customer = commet.customers().update(
      "cus_xxx",
      UpdateCustomerParams.builder().build()
  );
  ```

  ```php PHP theme={null}
  use Commet\Commet;

  $commet = new Commet('ck_xxx');

  $customer = $commet->customers->update(id: 'cus_xxx');
  ```
</CodeGroup>

Las actualizaciones usan semántica `PATCH`: enviá solamente los campos que deben cambiar.

## Listar customers

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { Commet } from "@commet/node";

  const commet = new Commet({ apiKey: "ck_xxx" });

  const response = await commet.customers.list();
  ```

  ```python Python theme={null}
  from commet import Commet

  commet = Commet("ck_xxx")

  customers_list_result = commet.customers.list()
  ```

  ```go Go theme={null}
  client, err := commet.New("ck_xxx")
  if err != nil {
  	log.Fatal(err)
  }
  ctx := context.Background()

  customersListResult, err := client.Customers.List(ctx, nil)
  if err != nil {
  	log.Fatal(err)
  }
  ```

  ```java Java theme={null}
  import co.commet.Commet;
  import co.commet.params.ListCustomersParams;

  var commet = Commet.builder().apiKey("ck_xxx").build();

  var customersListResult = commet.customers().list(ListCustomersParams.builder().build());
  ```

  ```php PHP theme={null}
  use Commet\Commet;

  $commet = new Commet('ck_xxx');

  $customersListResult = $commet->customers->list();
  ```
</CodeGroup>

Las listas devuelven `{ object, data, hasMore, nextCursor }`. Enviá `nextCursor` como `cursor` para pedir la siguiente página. Las operaciones individuales devuelven el customer directamente.

Consultá la [referencia de Customers](/docs/es/api-reference/customers/list-customers) para ver los campos exactos de request y response generados.

## Relacionado

* [Customer Portal](/docs/es/customer-portal)
* [Administrar suscripciones](/docs/es/manage-subscriptions)
* [Changelog de Offers & Pricing y checklist de migración](https://commet.co/changelog/offers-and-pricing)


## Related topics

- [Administrar planes](/docs/es/create-plans.md)
- [Administrar suscripciones](/docs/es/manage-subscriptions.md)
- [Portal del Cliente](/docs/es/customer-portal.md)
- [Manejar pagos fallidos](/docs/es/handle-failed-payments.md)
- [Modelos de consumo](/docs/es/consumption-models.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.