Pular para o conteúdo principal

Contas de Faturamento

Gerenciamento de contas de faturamento (Billing Accounts) para cobrança de clientes.

Endpoints

MétodoEndpointDescriçãoPermissão
POST/billing/api/v1/billing-accountsCriar conta de faturamentoBILLING_ACCOUNTS_CREATE
GET/billing/api/v1/billing-accountsListar contasBILLING_ACCOUNTS_READ
GET/billing/api/v1/billing-accounts/:idObter conta por IDBILLING_ACCOUNTS_READ
PATCH/billing/api/v1/billing-accounts/:idAtualizar contaBILLING_ACCOUNTS_UPDATE
DELETE/billing/api/v1/billing-accounts/:idExcluir contaBILLING_ACCOUNTS_DELETE

Atributos

CampoTipoDescrição
personIdstring (UUID)ID da pessoa associada (opcional)
namestringNome da conta de faturamento
emailstringE-mail principal para contato
statusenumStatus: ACTIVE, SUSPENDED, CLOSED
balancenumberSaldo atual da conta
currencystringMoeda (ex: BRL, USD)
billingEmailstringE-mail para envio de faturas (opcional)
billingAddressobjectEndereço de cobrança
taxIdstringCPF/CNPJ ou outro documento fiscal
taxIdTypestringTipo do documento (ex: CPF, CNPJ)
createdAtdatetimeData de criação
updatedAtdatetimeData da última atualização

Estrutura do Endereço (billingAddress)

CampoTipoDescrição
streetstringLogradouro
numberstringNúmero
citystringCidade
statestringEstado/UF
zipCodestringCEP
countrystringPaís

Criar Conta de Faturamento

POST /api/v1/billing-accounts

Cria uma nova conta de faturamento.

Atributos

CampoTipoObrigatórioDescrição
personIdstringNãoID da pessoa associada
namestringSimNome da conta
emailstringSimE-mail principal
statusenumNãoStatus inicial (padrão: ACTIVE)
currencystringNãoMoeda (padrão: configuração da organização)
billingEmailstringNãoE-mail para faturas
billingAddressobjectNãoEndereço de cobrança
taxIdstringNãoCPF/CNPJ
taxIdTypestringNãoTipo do documento
curl -X POST 'https://billing.stg.catalisa.app/billing/api/v1/billing-accounts' \
-H 'Authorization: Bearer SEU_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"data": {
"type": "billing-accounts",
"attributes": {
"name": "Empresa ABC Ltda",
"email": "financeiro@empresa-abc.com.br",
"currency": "BRL",
"taxId": "12.345.678/0001-90",
"taxIdType": "CNPJ",
"billingAddress": {
"street": "Av. Paulista",
"number": "1000",
"city": "São Paulo",
"state": "SP",
"zipCode": "01310-100",
"country": "Brasil"
}
}
}
}'

Response (201 Created)

{
"data": {
"type": "billing-accounts",
"id": "550e8400-e29b-41d4-a716-446655440010",
"links": {
"self": "/api/v1/billing-accounts/550e8400-e29b-41d4-a716-446655440010"
},
"attributes": {
"name": "Empresa ABC Ltda",
"email": "financeiro@empresa-abc.com.br",
"status": "ACTIVE",
"balance": 0,
"currency": "BRL",
"taxId": "12.345.678/0001-90",
"taxIdType": "CNPJ",
"billingAddress": {
"street": "Av. Paulista",
"number": "1000",
"city": "São Paulo",
"state": "SP",
"zipCode": "01310-100",
"country": "Brasil"
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
},
"links": {
"self": "/api/v1/billing-accounts/550e8400-e29b-41d4-a716-446655440010"
}
}

Listar Contas de Faturamento

GET /api/v1/billing-accounts

Lista todas as contas de faturamento com suporte a paginação e filtros.

Query Parameters

ParâmetroTipoDescrição
page[number]integerNúmero da página
page[size]integerItens por página
filter[status]enumFiltrar por status
filter[personId]UUIDFiltrar por pessoa associada
curl 'https://billing.stg.catalisa.app/billing/api/v1/billing-accounts?filter[status]=ACTIVE&page[size]=10' \
-H 'Authorization: Bearer SEU_TOKEN'

Response (200 OK)

{
"data": [
{
"type": "billing-accounts",
"id": "550e8400-e29b-41d4-a716-446655440010",
"links": {
"self": "/api/v1/billing-accounts/550e8400-e29b-41d4-a716-446655440010"
},
"attributes": {
"name": "Empresa ABC Ltda",
"email": "financeiro@empresa-abc.com.br",
"status": "ACTIVE",
"balance": 1500.00,
"currency": "BRL",
"taxId": "12.345.678/0001-90",
"taxIdType": "CNPJ",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
}
],
"meta": {
"totalItems": 25,
"totalPages": 3,
"currentPage": 1,
"itemsPerPage": 10
},
"links": {
"self": "/api/v1/billing-accounts?page[number]=1&page[size]=10",
"next": "/api/v1/billing-accounts?page[number]=2&page[size]=10",
"last": "/api/v1/billing-accounts?page[number]=3&page[size]=10"
}
}

Obter Conta por ID

GET /api/v1/billing-accounts/:id

Obtém os detalhes de uma conta de faturamento específica.

curl 'https://billing.stg.catalisa.app/billing/api/v1/billing-accounts/550e8400-e29b-41d4-a716-446655440010' \
-H 'Authorization: Bearer SEU_TOKEN'

Response (200 OK)

{
"data": {
"type": "billing-accounts",
"id": "550e8400-e29b-41d4-a716-446655440010",
"links": {
"self": "/api/v1/billing-accounts/550e8400-e29b-41d4-a716-446655440010"
},
"attributes": {
"name": "Empresa ABC Ltda",
"email": "financeiro@empresa-abc.com.br",
"status": "ACTIVE",
"balance": 1500.00,
"currency": "BRL",
"taxId": "12.345.678/0001-90",
"taxIdType": "CNPJ",
"billingAddress": {
"street": "Av. Paulista",
"number": "1000",
"city": "São Paulo",
"state": "SP",
"zipCode": "01310-100",
"country": "Brasil"
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
},
"links": {
"self": "/api/v1/billing-accounts/550e8400-e29b-41d4-a716-446655440010"
}
}

Atualizar Conta

PATCH /api/v1/billing-accounts/:id

Atualiza os dados de uma conta de faturamento.

Atributos Atualizáveis

CampoTipoDescrição
namestringNome da conta
emailstringE-mail principal
statusenumStatus da conta
billingEmailstringE-mail para faturas
billingAddressobjectEndereço de cobrança
taxIdstringCPF/CNPJ
taxIdTypestringTipo do documento
curl -X PATCH 'https://billing.stg.catalisa.app/billing/api/v1/billing-accounts/550e8400-e29b-41d4-a716-446655440010' \
-H 'Authorization: Bearer SEU_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"data": {
"type": "billing-accounts",
"id": "550e8400-e29b-41d4-a716-446655440010",
"attributes": {
"billingEmail": "faturamento@empresa-abc.com.br",
"status": "SUSPENDED"
}
}
}'

Response (200 OK)

{
"data": {
"type": "billing-accounts",
"id": "550e8400-e29b-41d4-a716-446655440010",
"links": {
"self": "/api/v1/billing-accounts/550e8400-e29b-41d4-a716-446655440010"
},
"attributes": {
"name": "Empresa ABC Ltda",
"email": "financeiro@empresa-abc.com.br",
"billingEmail": "faturamento@empresa-abc.com.br",
"status": "SUSPENDED",
"balance": 1500.00,
"currency": "BRL",
"taxId": "12.345.678/0001-90",
"taxIdType": "CNPJ",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T11:00:00Z"
}
},
"links": {
"self": "/api/v1/billing-accounts/550e8400-e29b-41d4-a716-446655440010"
}
}

Excluir Conta

DELETE /api/v1/billing-accounts/:id

Remove uma conta de faturamento. A conta não pode ter assinaturas ativas ou faturas pendentes.

curl -X DELETE 'https://billing.stg.catalisa.app/billing/api/v1/billing-accounts/550e8400-e29b-41d4-a716-446655440010' \
-H 'Authorization: Bearer SEU_TOKEN'

Response (204 No Content)

Sem corpo de resposta.


Erros Comuns

CódigoErroDescrição
400VALIDATIONDados inválidos (e-mail, taxId, etc.)
404NOT_FOUNDConta não encontrada
409CONFLICTE-mail já cadastrado em outra conta
409CONFLICTConta possui assinaturas ativas (exclusão)
409CONFLICTConta possui faturas pendentes (exclusão)