Skip to content

Verify the token

This goes in the handler that receives the form. Read the secret from your environment — it is a server credential and must never reach the browser — and the token from the goust-response field the widget wrote.

Every sample below sends the same request; pick the one you already work in.

# $GOUST_SECRET is your site secret. $TOKEN is the value of the
# "goust-response" field the widget wrote into your form.
# For a signed-in user, add "account":"<your own id for them>" to the body.
curl -s -X POST https://challenge.goust.io/siteverify \
  -H 'content-type: application/json' \
  -d "{\"secret\":\"$GOUST_SECRET\",\"response\":\"$TOKEN\"}"

# => {"success":true}
# => {"success":false,"errors":["invalid_secret"]}

A JSON body with two fields, and a third you may add:

Field Value
secret Your site secret, from the dashboard.
response The token, from the goust-response form field.
account Optional. Your own id for the account the visitor is signed in to: an opaque string of 1 to 128 characters.

Send account when the form belongs to a signed-in user. Goust then keeps a reputation for that account on your site, and on plans with risk details the answer carries it. The id is yours and stays opaque: use an internal id rather than an email address. Goust stores a keyed hash of it, scoped to your site, and never the value. Leave the field out for a visitor who is not signed in.

Branch on success in the answer rather than on the status: /siteverify answers 200 for a refusal as well as a grant. Reading the answer has both shapes.

A token is single-use. Once a verification succeeds, verifying the same token again refuses, which is what stops a captured token being replayed against your form.