Customers

Clientes da loja. Use o id em checkouts e transparentes.

Criar

curl -s https://api.aporta.cc/v1/customers/create \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "ana@exemplo.com",
    "name": "Ana Silva",
    "cellphone": "11999999999",
    "taxId": "529.982.247-25",
    "zipCode": "01310-100",
    "metadata": { "crmId": "42" }
  }'
  • Obrigatório: email
  • taxId (CPF/CNPJ) é normalizado; útil para Pix ensureSameTaxId
  • Sandbox: recurso com devMode: true

Listar (cursor)

curl -s "https://api.aporta.cc/v1/customers/list?limit=20" \
  -H "Authorization: Bearer sk_test_…"

Query: after · before · limit (1–100, default 100) · startDate / endDate (YYYY-MM-DD, America/Sao_Paulo) · filtros email / taxId.

{
  "data": [ /* customers */ ],
  "success": true,
  "error": null,
  "pagination": {
    "hasMore": true,
    "next": "cust_…",
    "before": null
  }
}

Ordem: createdAt DESC, id DESC. Não envie after e before juntos.

Obter / deletar

  • GET /v1/customers/{id}
  • POST /v1/customers/delete com { "id": "cust_…" }

Próximo: checkouts ou quickstart.

Dados pessoais (LGPD)

Para atender um titular: POST /v1/customers/export devolve em JSON tudo o que guardamos do cliente (cliente, checkouts, cobranças transparentes e assinaturas). POST /v1/customers/anonymize remove nome, e-mail, telefone, documento, CEP, metadata e externalId; as cobranças continuam (retenção legal). Ambos recebem { id }, exigem chave da loja inteira e ficam na auditoria. No dashboard pedem chave de segurança.