TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Issue a CSRF token and set it as the XSRF-TOKEN cookie

GEThttps://api.testingapis.com/api/auth/csrf/tokenSign in to see this endpoint's URL

Send the same value back in the X-CSRF-Token header when calling POST /api/auth/csrf/submit. Tokens are signed by the server (csrf_<random>.<hmac>), the signed double-submit pattern.Send the same value back in the X-CSRF-Token header when calling POST …. Tokens are signed by the server (csrf_<random>.<hmac>), the signed double-submit pattern.

Responses

200
Token issued; Set-Cookie: XSRF-TOKEN=....

Example

Request
curl -X GET "https://api.testingapis.com/api/auth/csrf/token" \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
Set-Cookie: XSRF-TOKEN=csrf_d30ce4a0283122160df146124303d444d149c2cf; path=/; samesite=lax

{
  "csrfToken": "csrf_d30ce4a0283122160df146124303d444d149c2cf",
  "message": "Cookie XSRF-TOKEN set. POST /api/auth/csrf/submit with the same value in the X-CSRF-Token header."
}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.