Skip to main content

Get a CSRF token

GET/api/csrf
PublicRead-only

The public endpoints need a CSRF token from GET /api/csrf. Every unusable token returns 400 invitation_invalid. Other errors are 409 invitation_already_pending, 409 invitation_email_unavailable (the email already belongs to a member who is not removed), 404 invitation_not_found, 404 member_not_found (an unknown, removed, or other Organization's member), 409 member_last_administrator, and 403 access_denied for members calling administrator endpoints. A session refused because its member changed answers 401 authentication_required, like any request without a session. See ADR-0043.

Read more: When someone leavesSource: CsrfApiController#csrf(opens in new tab)

Response​

Success: 200

FieldTypeRequiredNotes
headerNamestringOptional
parameterNamestringOptional
tokenstringOptional

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
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
curl "http://localhost:8080/api/csrf" \
-b cookies.txt -c cookies.txt

Response

200

Example

{
  "headerName": "<string>",
  "parameterName": "<string>",
  "token": "<string>"
}