Get the current user
const url = 'https://api.emite.cr/v1/auth/me';const options = {method: 'GET'};
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/auth/meProfile and memberships of the signed-in person: id, email, name; every company they belong to, with their role in it (memberships); the company of this session (currentTenantId, currentRole, null when the session carries none) and what that role may do in it (scopes, the same list the API enforces, a custom role included; * for the owner; empty without a company); the two-factor status (twoFactor); and when this session will be refused if nothing happens (session.deadline, absolute or idle per session.deadlineKind, with the API's clock in session.serverTime). Requires a person's session: an API key answers 401 UNAUTHENTICATED.
Responses
Section titled “Responses”The signed-in person, their companies and this session.
object
Id of the person’s account.
Email of the account, which is also what the person signs in with.
Name of the person.
Product updates published after this date are new to the person: the date of the newest one they have seen, or the moment the account was created if they have seen none. PUT /v1/auth/me/news-seen moves it forward.
The Dashboard card shows the highlighted product updates, or those that need attention, dated after this: the date of the last one the person closed or followed from the card, or the moment the account was created. PUT /v1/auth/me/news-card-seen moves it forward; seeing the updates elsewhere does not.
The company of this session, the one the API acts on with this token. null when the session carries none (a new account; or several companies and none chosen yet: POST /v1/auth/switch-tenant), and when the company no longer admits it (the person left it, or an admin closed their sessions for it).
The person’s role in that company: a system role (owner, admin, billing_manager, accountant, issuer, viewer; GET /v1/permissions/roles) or the slug of one of the company’s custom roles (GET /v1/tenants/me/roles). null whenever currentTenantId is.
true when the company of this session is an ephemeral demo: it is deleted, with everything in it, at demoExpiresAt, and nothing in it ever reaches Hacienda.
When the demo company expires and is deleted; null outside a demo.
Identification type of the company of this session, in Hacienda’s codes: 01 cédula física, 02 cédula jurídica, 03 DIMEX, 04 NITE, 05 foreign non-resident, 06 non-taxpayer. It decides which plans the company may buy (planTrack). null without a company.
The plan ladder of the company: pf for a cédula física (01) or a DIMEX (03), which may also buy pj plans; pj for every other identification type. GET /v1/billing/plans/available serves the plans it may buy. null without a company.
What the person may do in the company of this session: the scopes the API enforces on each request — the bundle of a system role, or the list of a custom role. * grants every scope (the owner). Empty whenever currentTenantId is null, and for a member whose custom role was deleted (nothing is granted).
Every company the person belongs to, with their role in each, in the order they joined.
object
Id of the company.
Legal name of the company, as registered with Hacienda.
Commercial name of the company; null when it has none.
Storage key of the company logo; null without one. Every new logo gets a new key, so it also works as the version of the image (a cache key). The image itself is GET /v1/tenants/{id}/logo/raw, which serves the company of the session only.
The person’s role in this company: a system role (owner, admin, billing_manager, accountant, issuer, viewer; GET /v1/permissions/roles) or the slug of one of the company’s custom roles (GET /v1/tenants/me/roles).
Two-factor authentication of the account. It belongs to the person, not to a company.
object
true when at least one second-factor method is active: signing in then ends with a challenge (mfaRequired in POST /v1/auth/login).
The active methods, totp first; empty when two-factor authentication is off. totp: an authenticator app. email: a code sent to the account email.
Unused recovery codes left in the current set (a set has 10).
true when an authenticator setup was started (POST /v1/auth/2fa/totp/setup) and never confirmed: that secret protects nothing until a code confirms it.
The session behind this request, as the API enforces it.
object
When the person signed in. No re-issue moves it: switching company or renewing keeps it.
When the API will refuse this session if nothing happens: the end of the inactivity window or the maximum of the session, as deadlineKind says.
absolute: the maximum of the session, which no activity extends — after it, sign in again. idle: the company’s inactivity rule; renewing the session (POST /v1/auth/sessions/renew) moves it.
The API’s clock when it answered. A device’s clock is often off: compare the two once and correct deadline by the difference.
The session rules of the company of this session; null when it set none or the session carries no company.
object
The company’s maximum session length in minutes (120 or 240), counted from the sign-in; null when it set none. The platform’s own maximum applies either way, whichever ends first.
Minutes without activity after which a session in the company closes (15, 30 or 60); null when the company has no inactivity rule.
Example
{ "email": "ventas@emite.cr", "name": "María Solís", "currentRole": "owner", "isDemo": false, "identificationType": "01", "planTrack": "pf", "scopes": [ "invoices:read", "invoices:write", "invoices:sign", "invoices:submit" ], "memberships": [ { "tenantName": "Futura Byte Limitada", "tenantCommercialName": "EmiteCR", "role": "admin" } ], "twoFactor": { "enabled": true, "methods": [ "totp" ], "recoveryCodesRemaining": 10, "totpPending": false }, "session": { "deadlineKind": "idle", "policy": { "maxAgeMinutes": 240, "idleTimeoutMinutes": 30 } }}