- Customers
- Create customer
Customers
Create customer
Create customer
Authentication
Enterprise key with this route’s permission. See Authentication.
ID of the organization (issuing company) the operation applies to.
Body
application/json
By CNPJ, send only CNPJCPF, indIEDest and, for a taxpayer, IE. The API looks up the rest by the CNPJ.
By CPF, send the full payload: without the name or address, the customer is not created. See the registration scenarios.
CNPJ or CPF, digits only.
Name or company name. Required when registering by CPF.
Trade name.
Recipient’s state registration (IE) indicator: CONTRIBUINTE_ICMS (“ICMS taxpayer”) or NAO_CONTRIBUINTE (“not a taxpayer”, equivalent to indIEDest = 9 in the NF-e).
State registration. Required when indIEDest is CONTRIBUINTE_ICMS.
Address following the NF-e layout. Required when registering by CPF; the fields marked required apply to that case.
xLgr(string) (required): Street.nro(string) (required): Number.xCpl(string): Address line 2.xBairro(string) (required): Neighborhood.cMun(integer) (required): The municipality’s IBGE code (7 digits).xMun(string) (required): Municipality name.UF(string) (required): State abbreviation.CEP(string) (required): Postal code (CEP), digits only (8 digits).cPais(integer): Country code. E.g.1058(Brazil).xPais(string): Country name. E.g.BRASIL.fone(string): Phone number, digits only.
Responses
| Status | Description |
|---|---|
201 | Customer created. |
400 | Invalid body (missing required field, wrong format, or field not allowed). |
401 | Credential missing, invalid, or expired. |
curl -X POST "https://api.treeunfe.com.br/api/v1/customers" \
-H "x-enterprise-key: YOUR_ENTERPRISE_KEY" \
-H "x-organization-id: ORGANIZATION_ID" \
-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-enterprise-key: YOUR_ENTERPRISE_KEY" \
-H "x-organization-id: ORGANIZATION_ID" \
-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"
}
}'