Skip to content

Get the current user

GET
/v1/auth/me
curl --request GET \
--url https://api.emite.cr/v1/auth/me

Profile 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.

The signed-in person, their companies and this session.

Media typeapplication/json
object
id
required

Id of the person’s account.

string format: uuid
email
required

Email of the account, which is also what the person signs in with.

string
name
required

Name of the person.

string
newsSeenAt
required

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.

string format: date-time
newsCardSeenAt
required

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.

string format: date-time
currentTenantId
required

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).

string format: uuid
nullable
currentRole
required

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.

string
nullable
isDemo
required

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.

boolean
demoExpiresAt
required

When the demo company expires and is deleted; null outside a demo.

string format: date-time
nullable
identificationType
required

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.

string
nullable
Allowed values: 01 02 03 04 05 06
planTrack
required

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.

string
nullable
Allowed values: pf pj
scopes
required

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).

Array<string>
memberships
required

Every company the person belongs to, with their role in each, in the order they joined.

Array<object>
object
tenantId
required

Id of the company.

string format: uuid
tenantName
required

Legal name of the company, as registered with Hacienda.

string
tenantCommercialName
required

Commercial name of the company; null when it has none.

string
nullable
logoStorageKey
required

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.

string
nullable
role
required

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).

string
twoFactor
required

Two-factor authentication of the account. It belongs to the person, not to a company.

object
enabled
required

true when at least one second-factor method is active: signing in then ends with a challenge (mfaRequired in POST /v1/auth/login).

boolean
methods
required

The active methods, totp first; empty when two-factor authentication is off. totp: an authenticator app. email: a code sent to the account email.

Array<string>
Allowed values: totp email
recoveryCodesRemaining
required

Unused recovery codes left in the current set (a set has 10).

number
totpPending
required

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.

boolean
session
required

The session behind this request, as the API enforces it.

object
authTime
required

When the person signed in. No re-issue moves it: switching company or renewing keeps it.

string format: date-time
deadline
required

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.

string format: date-time
deadlineKind
required

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.

string
Allowed values: idle absolute
serverTime
required

The API’s clock when it answered. A device’s clock is often off: compare the two once and correct deadline by the difference.

string format: date-time
policy
required

The session rules of the company of this session; null when it set none or the session carries no company.

object
maxAgeMinutes
required

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.

number
nullable
idleTimeoutMinutes
required

Minutes without activity after which a session in the company closes (15, 30 or 60); null when the company has no inactivity rule.

number
nullable
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
}
}
}