Integration Guide
Kanshi Integration Guide
Send the submitted form fields to Kanshi, read the decision, and route the submission through your own accept, quarantine, or reject handlers. Generate your API key from the Kanshi app console before connecting your form.
Endpoint
https://api.kanshi.works/api/v1/validate
Method
POST
Action header
result
API request
Choose your stack, replace YOUR_API_KEY with the key from your Kanshi app console, then wire the branch handlers into your app.
cURL
terminal
# Requires jq to parse the JSON response.
response=$(curl --silent --show-error --fail --location 'https://api.kanshi.works/api/v1/validate' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'action: result' \
--header 'Content-Type: text/plain' \
--data-raw 'name: John Doe
email: useremail@service.com
message: Trying to send a message here.')
decision=$(echo "$response" | jq -r '.result')
case "$decision" in
legitimate)
echo "Accept the submission."
;;
spam)
echo "Block, quarantine, or ask for verification."
;;
fake)
echo "Reject the submission or flag it for review."
;;
*)
echo "Unexpected response: $response"
;;
esac