1. Guides
  2. Registering organizations

An organization is an issuing company in your Enterprise account. Every route on this page uses the Enterprise key.

​
Create

POST /enterprise/organizations

{
  "CNPJCPF": "12345678000195",
  "xNome": "Cliente Exemplo LTDA",
  "xFant": "Cliente Exemplo",
  "email": "fiscal@cliente-exemplo.com.br",
  "fone": "+5511999887755",
  "IE": "123456789",
  "address": {
    "xLgr": "Rua das Palmeiras",
    "nro": "456",
    "xBairro": "Centro",
    "cMun": 3550308,
    "xMun": "São Paulo",
    "UF": "SP",
    "CEP": "01002000"
  },
  "generateApiKey": false
}
FieldDescription
CNPJCPFCNPJ or CPF (Brazilian company or individual tax ID), digits only. Cannot be changed later.
xNome / xFantLegal name and trade name.
email, fone, IEContact details and state registration (IE).
addressAddress. cMun is the municipality’s IBGE code (7 digits).
generateApiKeytrue also generates an API Key. Requires apiKeyOptions (see the options).

The response (201) includes organization and, if requested, apiKey. Store the organization.id: it’s used in the other routes.

​
Edit

PATCH /enterprise/organizations/{organizationId}

Send only the fields that changed:

{ "xNome": "Cliente Exemplo LTDA - Matriz" }

Accepted fields: xNome, xFant, email, fone, IE, address, and isActive.

The body is strict. Any field outside this list returns 400. Sending CNPJCPF, even with the current value, returns 400 CNPJ não pode ser alterado (“CNPJ cannot be changed”).

​
Deactivate

{ "isActive": false }

While the organization is inactive, all of its API Keys receive 403 Organization is inactive. Send isActive: true to reactivate it.

​
Fiscal configuration

Before issuing, the organization needs its NF-e settings filled in. Generate a link and send it to the customer:

ActionEndpoint
Create linkPOST /bff/enterprise-group/organizations/{organizationId}/fiscal-config-invites
List linksGET /bff/enterprise-group/organizations/{organizationId}/fiscal-config-invites

​
Digital certificate

The organization also needs an A1 certificate (.pfx). These routes use the organization’s x-api-key:

ActionEndpoint
UploadPOST /certificates/upload (multipart/form-data with file and password)
Get the current oneGET /certificates/current
DeleteDELETE /certificates/{certificateId}
curl -X POST https://api.treeunfe.com.br/api/v1/certificates/upload \
  -H "x-api-key: ORGANIZATION_RAW_KEY" \
  -F "file=@certificado.pfx" \
  -F "password=CERTIFICATE_PASSWORD"