Skip to main content

Get the session

GET/api/session
Signed-in memberRead-only

1. GET /api/csrf and keep the session cookie it sets. It answers {"headerName": "X-CSRF-TOKEN", "parameterName": "_csrf", "token"}. 2. Send the token in that header with every POST, PUT, and DELETE, for example POST /api/registrations. 3. Sign in through POST /login with email and password form fields and the token. It answers with a redirect, never JSON: to / when it worked, and to /login?error when it did not. 4. Fetch a new token. Signing in replaces the session and its token, so the token from step 1 is now refused with 403 access_denied. 5. Read the signed-in identity from GET /api/session.

Read more: Sessions and CSRFSource: SessionApiController#current(opens in new tab)

Response​

Success: 200

FieldTypeRequiredNotes
userIdstring (uuid)Optional
organizationIdstring (uuid)Optional
emailstringOptional
displayNamestringOptional
roleenum AppUserRoleOptionalADMINMEMBER

Errors​

StatusCodeApplies to
400validation_faileda field is missing or out of rangeAny endpoint
400invalid_parametera path or query parameter is missing or does not convert, such as an ID that is not a UUIDAny endpoint
401authentication_requiredno sessionAny endpoint
404not_foundno such addressAny endpoint
405method_not_allowedthe address does not take that methodAny endpoint
415unsupported_media_typethe address does not read a body of that typeAny endpoint
500internal_errora fault ReleaseFlow did not foresee; the body never carries the exception behind itAny endpoint
400output_language_invalidAccount area
400ui_locale_invalidAccount area
400invitation_invalidAccount area
400organization_slug_invalidAccount area
404invitation_not_foundAccount area
404member_not_foundAccount area
409email_already_registeredAccount area
409invitation_already_pendingAccount area
409invitation_email_unavailableAccount area
409organization_slug_takenAccount area
409member_last_administratorAccount area

Request

bash
# Sign in first and keep the session cookie in cookies.txt (see Sessions and CSRF).
curl "http://localhost:8080/api/session" \
-b cookies.txt -c cookies.txt

Response

200

Example

{
  "userId": "<uuid>",
  "organizationId": "<uuid>",
  "email": "<string>",
  "displayName": "<string>",
  "role": "ADMIN"
}