Skip to content

Issue the CSRF token for the current session​

GET
/api/auth/csrf

Returns the authenticity token bound to the caller's session, creating a session when none exists. Does not require authentication. A frontend that is not rendered by the server's HTML layout calls this before its first state-changing request. POST /api/auth/login resets the token and DELETE /api/auth/logout resets the whole session, so call this again after either. Send the value in the X-CSRF-Token header on POST, PUT, PATCH and DELETE requests. The response carries Cache-Control: no-store and must never be cached.

Responses​

Token issued; a session cookie is set when none existed

application/json
JSON
{
  
"csrf_token": "abc123def456"
}

Playground​

Samples​

Powered by VitePress OpenAPI

Part of the MITRE Security Automation Framework (SAF)