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

Submit a CSRF-protected form

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

Submit a CSRF-protected form (double-submit cookie check).

Requires the XSRF-TOKEN cookie from GET /api/auth/csrf/token and a matching X-CSRF-Token header.Requires the XSRF-TOKEN cookie from GET … and a matching X-CSRF-Token header.

Note: Call GET /api/auth/csrf/token first; send its token in X-CSRF-Token and keep the cookie it sets. The token must be one this server issued: tokens are signed, so a made-up value fails even when the cookie and header match.Note: Call GET … first; send its token in X-CSRF-Token and keep the cookie it sets. The token must be one this server issued: tokens are signed, so a made-up value fails even when the cookie and header match.

CSRF double-submit: X-CSRF-Token header must match the XSRF-TOKEN cookie

Parameters 1

NameTypeDescription
X-CSRF-Tokenrequiredheader · stringToken from GET /api/auth/csrf/token (the matching cookie is sent automatically by the browser).Token from GET … (the matching cookie is sent automatically by the browser).

Request body

Optional. application/json. Any body.

Example body
{"comment": "hello"}

Responses

200
Cookie and header match.
403
Cookie or header missing, they don't match, or the token wasn't issued by this server.

Example

Request
curl -X POST "https://api.testingapis.com/api/auth/csrf/submit" \
  -H "Content-Type: application/json" \
  -H "X-CSRF-Token: {{csrfToken}}" \
  -H "Cookie: XSRF-TOKEN={{csrfToken}}" \
  -d '{"comment": "hello"}' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
{"message": "CSRF check passed. Form submitted.", "submittedAt": "2026-09-30T18:26:45Z"}

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.