- Clientes
- Cadastrar cliente
Clientes
Cadastrar cliente
Cadastrar cliente
POST
/customers
curl --request POST \
--url https://api.treeunfe.com.br/api/v1/customers \
--header 'x-api-key: <api-key>' \
--header 'x-api-key: <x_api_key>' \
--header 'Content-Type: application/json' \
--data '{
"CNPJCPF": "<string>",
"xNome": "<string>",
"xFant": "<string>",
"indIEDest": "<string>",
"IE": "<string>",
"email": "<string>",
"address": "<value>"
}'
curl --request POST \
--url https://api.treeunfe.com.br/api/v1/customers \
--header 'x-api-key: <api-key>' \
--header 'x-api-key: <x_api_key>' \
--header 'Content-Type: application/json' \
--data '{
"CNPJCPF": "<string>",
"xNome": "<string>",
"xFant": "<string>",
"indIEDest": "<string>",
"IE": "<string>",
"email": "<string>",
"address": "<value>"
}'Autenticação
x-api-key
required
string
API Key da empresa.
Body
application/json
Por CNPJ, envie só CNPJCPF, indIEDest e, se contribuinte, IE. A API busca o restante pelo CNPJ.
Por CPF, envie o payload completo: sem nome ou endereço, o cliente não é cadastrado. Veja os cenários de cadastro.
CNPJCPF
required
string
CNPJ ou CPF só com números.
xNome
string
Nome ou razão social. Obrigatório no cadastro por CPF.
xFant
string
Nome fantasia.
indIEDest
required
string
Indicador de IE do destinatário: CONTRIBUINTE_ICMS ou NAO_CONTRIBUINTE (equivale a indIEDest = 9 na NF-e).
IE
string
Inscrição estadual. Obrigatória quando indIEDest é CONTRIBUINTE_ICMS.
email
string
address
object
Endereço no padrão do leiaute da NF-e. Obrigatório no cadastro por CPF; os campos marcados como obrigatórios valem para esse caso.
xLgr(string) (obrigatório): Logradouro.nro(string) (obrigatório): Número.xCpl(string): Complemento.xBairro(string) (obrigatório): Bairro.cMun(integer) (obrigatório): Código IBGE do município (7 dígitos).xMun(string) (obrigatório): Nome do município.UF(string) (obrigatório): Sigla da UF.CEP(string) (obrigatório): CEP só com números (8 dígitos).cPais(integer): Código do país. Ex.:1058(Brasil).xPais(string): Nome do país. Ex.:BRASIL.fone(string): Telefone só com números.
Respostas
| Status | Descrição |
|---|---|
201 | Cliente criado. |
400 | Body inválido (campo obrigatório ausente, formato incorreto ou campo não permitido). |
401 | Credencial ausente, inválida ou expirada. |
curl -X POST "https://api.treeunfe.com.br/api/v1/customers" \
-H "x-api-key: SUA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"CNPJCPF": "12345678909",
"xNome": "Cliente Teste",
"indIEDest": "NAO_CONTRIBUINTE",
"email": "cliente@exemplo.com.br",
"address": {
"xLgr": "Rua Exemplo",
"nro": "262",
"xCpl": "Sala 1",
"xBairro": "Centro",
"cMun": 3554102,
"xMun": "Taubaté",
"UF": "SP",
"CEP": "12040859",
"fone": "12999990000"
}
}'
curl -X POST "https://api.treeunfe.com.br/api/v1/customers" \
-H "x-api-key: SUA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"CNPJCPF": "12345678909",
"xNome": "Cliente Teste",
"indIEDest": "NAO_CONTRIBUINTE",
"email": "cliente@exemplo.com.br",
"address": {
"xLgr": "Rua Exemplo",
"nro": "262",
"xCpl": "Sala 1",
"xBairro": "Centro",
"cMun": 3554102,
"xMun": "Taubaté",
"UF": "SP",
"CEP": "12040859",
"fone": "12999990000"
}
}'
curl --request POST \
--url https://api.treeunfe.com.br/api/v1/customers \
--header 'x-api-key: <api-key>' \
--header 'x-api-key: <x_api_key>' \
--header 'Content-Type: application/json' \
--data '{
"CNPJCPF": "<string>",
"xNome": "<string>",
"xFant": "<string>",
"indIEDest": "<string>",
"IE": "<string>",
"email": "<string>",
"address": "<value>"
}'
curl --request POST \
--url https://api.treeunfe.com.br/api/v1/customers \
--header 'x-api-key: <api-key>' \
--header 'x-api-key: <x_api_key>' \
--header 'Content-Type: application/json' \
--data '{
"CNPJCPF": "<string>",
"xNome": "<string>",
"xFant": "<string>",
"indIEDest": "<string>",
"IE": "<string>",
"email": "<string>",
"address": "<value>"
}'