- Customers
- Create customer
Customers
Create customer
Create customer
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>"
}'Authentication
x-api-key
required
string
The organization’s API Key (rawKey).
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.
CNPJCPF
required
string
CNPJ or CPF, digits only.
xNome
string
Name or company name. Required when registering by CPF.
xFant
string
Trade name.
indIEDest
required
string
Recipient’s state registration (IE) indicator: CONTRIBUINTE_ICMS (“ICMS taxpayer”) or NAO_CONTRIBUINTE (“not a taxpayer”, equivalent to indIEDest = 9 in the NF-e).
IE
string
State registration. Required when indIEDest is CONTRIBUINTE_ICMS.
email
string
address
object
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-api-key: ORGANIZATION_RAW_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: ORGANIZATION_RAW_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>"
}'