Skip to content

cURL

cURL is the fastest way to test the FormSentry API from your terminal.

Terminal window
curl -X POST https://api.formsentry.ai/v1/verify \
-H "Content-Type: application/json" \
-d '{
"apiKey": "YOUR_API_KEY",
"formId": "YOUR_FORM_ID",
"payload": {
"name": "John Doe",
"email": "john@example.com",
"message": "I would like to learn more about your services."
}
}'

Set your credentials once:

Terminal window
export FORMSENTRY_API_KEY="fs_your_api_key_here"
export FORMSENTRY_FORM_ID="your_form_id_here"

Then use them in requests:

Terminal window
curl -X POST https://api.formsentry.ai/v1/verify \
-H "Content-Type: application/json" \
-d "{
\"apiKey\": \"$FORMSENTRY_API_KEY\",
\"formId\": \"$FORMSENTRY_FORM_ID\",
\"payload\": {
\"name\": \"John Doe\",
\"email\": \"john@example.com\",
\"message\": \"Hello, I need help with my account.\"
}
}"

Send a clearly spammy submission to verify detection:

Terminal window
curl -X POST https://api.formsentry.ai/v1/verify \
-H "Content-Type: application/json" \
-d "{
\"apiKey\": \"$FORMSENTRY_API_KEY\",
\"formId\": \"$FORMSENTRY_FORM_ID\",
\"payload\": {
\"name\": \"SEO Expert\",
\"email\": \"spammer@example.com\",
\"message\": \"Buy cheap SEO services! Get 10000 backlinks for just $5! Visit our website now for guaranteed Google rankings!\"
}
}"

Expected response:

{
"status": "spam",
"confidence": 0.95,
"reasoning": "Submission contains promotional content and unsolicited marketing",
"submissionId": "550e8400-e29b-41d4-a716-446655440000",
"processingTime": 180,
"formId": "your_form_id"
}

Use -i to see rate limit headers:

Terminal window
curl -i -X POST https://api.formsentry.ai/v1/verify \
-H "Content-Type: application/json" \
-d '{"apiKey":"YOUR_API_KEY","formId":"YOUR_FORM_ID","payload":{"name":"Test","email":"test@test.com","message":"Hello"}}'

Response headers include:

X-RateLimit-Limit: 10
X-RateLimit-Remaining: 9
X-RateLimit-Reset: 1640995200

Pipe the output through jq for formatted JSON:

Terminal window
curl -s -X POST https://api.formsentry.ai/v1/verify \
-H "Content-Type: application/json" \
-d '{"apiKey":"YOUR_API_KEY","formId":"YOUR_FORM_ID","payload":{"name":"John","email":"john@example.com","message":"Hello"}}' \
| jq .

Set a 5-second timeout:

Terminal window
curl -X POST https://api.formsentry.ai/v1/verify \
--max-time 5 \
-H "Content-Type: application/json" \
-d '{"apiKey":"YOUR_API_KEY","formId":"YOUR_FORM_ID","payload":{"name":"John","email":"john@example.com","message":"Hello"}}'