Get the permission catalog (roles + scopes)
const url = 'https://api.emite.cr/v1/permissions/roles';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.emite.cr/v1/permissions/roles \ --header 'Authorization: Bearer <token>'Returns every predefined role with its scope bundle, every scope with its UI grouping and API-key grantability flag, and the named scope presets the API key screen offers (emit: what issuing a document end to end requires). The web caches this for the session and renders the team, roles and API key screens off it. The catalog is static; invalidate on a deploy that changes Role or Scope.
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”The system roles, every scope, and the API key presets.
object
The six system roles, owner first, each with its scopes. A company’s custom roles are listed at GET /v1/tenants/me/roles.
object
The system role, as a member’s role names it.
Every scope the role grants. ["*"] for owner: every scope there is, including any added later — read it as a wildcard rather than expanding it.
Whether the role can be given to a member, by invitation or by changing their role. false for owner: ownership only moves through the ownership transfer, which leaves the previous owner as admin.
Every scope, with its group and whether an API key may hold it.
object
The scope, <resource>:<action>; * grants every scope.
The resource the scope belongs to, for laying out a permission matrix.
Whether an API key may hold the scope (scopes when creating one). false for what only a person may do: members, API keys, billing, credentials, ownership and the like. * is grantable, and on a key means every scope an API key may hold — never these.
Named lists of scopes the API key screen offers as a starting point.
object
The preset. emit: what issuing a document end to end needs — create the draft, sign it, submit it to Hacienda and read it back with its status, PDF and XML. read_only: read documents, contacts and the item catalog; change nothing.
The scopes it selects, all of them grantable to an API key.
Example
{ "roles": [ { "slug": "owner", "scopes": [ "invoices:read", "reports:read" ] } ], "scopes": [ { "slug": "invoices:read", "group": "invoices" } ], "apiKeyPresets": [ { "slug": "emit", "scopes": [ "invoices:read", "invoices:write", "invoices:sign", "invoices:submit" ] } ]}