- Getting started
- Authentication
Getting started
Authentication
The API's two credentials and when to use each one.
The API uses different credentials for the Enterprise account and for each issuing company (organization).
| Header | Who uses it | Routes |
|---|---|---|
x-enterprise-key: <key> | Enterprise account | /enterprise/* and /bff/enterprise-group/* |
x-api-key: <rawKey> | Organization | NF-e, events, records, and certificate |
Enterprise key
The x-enterprise-key identifies your Enterprise account and has the enterprise:manage scope. Use it on the routes that manage organizations, API Keys, and fiscal configuration links.
curl https://api.treeunfe.com.br/api/v1/enterprise/organizations \
-H "x-enterprise-key: YOUR_ENTERPRISE_KEY" ...
The Enterprise key gives access to every issuing company in the account. Use it only in your backend, never in apps or in the browser.
Organization API Key
The x-api-key is generated for one organization and only accesses that organization’s data. It is the credential for the operational routes (issuing, events, records). See API Keys for scopes, environments, and expiration.
curl -X POST https://api.treeunfe.com.br/api/v1/nfe \
-H "x-api-key: ORGANIZATION_RAW_KEY" ...
If the organization is inactive, its keys receive 403 Organization is inactive.