TrustCaptcha API (Legacy)
Fetch a verification result (v2)
Section titled “Fetch a verification result (v2)”Called by the TrustCaptcha backend libraries 3.x (legacy guide). The result has the same fields as in v3, except for the names of the four booleans, and the error answers differ:
| v2 field | v3 field |
|---|---|
verificationPassed | isVerificationPassed |
gatewayFailoverActive | isGatewayFailoverActive |
riskScoringEnabled | isRiskScoringEnabled |
minimalDataModeEnabled | isMinimalDataModeEnabled |
https://api.trustcomponent.com/captcha/v2/verifications/{verificationId}/resultsReturns the result of a verification
Call it from your server with the verification id from the token the widget put into your form. A 429 here means the result reached its maximum retrieval count and comes without Retry-After; it is final and is not retried.
Authentication: API key as bearer token. Operation getResultV2.
# The verification id is the "verificationId" inside the token the widget wrote into your form.curl "https://api.trustcomponent.com/captcha/v2/verifications/<verification_id>/results" \ -H "Authorization: Bearer <your_api_key>"{ "captchaId": "cc2e2d5e-d1ef-4a7f-a7bd-dec5b37df47a", "verificationId": "cc2e2d5e-d1ef-4a7f-a7bd-dec5b37df47a", "verificationPassed": true, "score": 0.3, "decisionType": "STANDARD", "decisionAction": "ALLOW", "gatewayFailoverActive": false, "riskScoringEnabled": true, "minimalDataModeEnabled": false, "origin": "https://www.example.com", "ipAddress": "203.0.113.7", "countryCode": "DE", "deviceFamily": "Mac", "operatingSystem": "Mac OS X", "browser": "Firefox", "verificationStartedAt": "2020-01-01T13:30:05.941Z", "verificationFinishedAt": "2020-01-01T13:30:09.512Z", "resultExpiresAt": "2020-01-01T13:45:09.512Z", "resultFirstFetchedAt": "2020-01-01T13:30:10.106Z", "resultLastFetchedAt": "2020-01-01T13:30:10.106Z"}Path parameters
| Name | Type | Description |
|---|---|---|
verificationIdrequired | string (uuid) | ID of a verification |
Response 200 · application/json
| Field | Type | Description |
|---|---|---|
captchaId | string (uuid) | Id of the captcha (in the dashboard) the verification ran on. |
verificationId | string (uuid) | Id of the verification, the one from the token. |
verificationPassed | boolean | Whether the visitor passed the CAPTCHA. The field most integrations act on. |
score | number | Risk that the request is automated, from 0 (probably human) to 1 (probably automated). · 0 to 1 |
decisionType | string | How the verification outcome was determined. Possible values include STANDARD, BYPASS_KEY, CUSTOM_ACCESS_RULE, GLOBAL_IP_ACCESS_RULE, FAILOVER, FAILOVER_TOLERANCE. |
decisionAction | string | The recommended action for this verification. Possible values include NO_ACTION, ALLOW, BLOCK, CUSTOM. |
gatewayFailoverActive | boolean | True when the gateway synthesized this result because the captcha service was unreachable. |
riskScoringEnabled | boolean | Whether the risk analysis of the captcha was switched on for this verification. |
minimalDataModeEnabled | boolean | Whether the captcha runs in minimal data mode; then origin, IP address and device fields are empty. |
origin | string | Origin of the page the widget ran on. |
ipAddress | string | IP address of the visitor. |
countryCode | string | Two-letter ISO 3166-1 alpha-2 country code derived from the client IP. Empty string if not resolvable. |
deviceFamily | string | Device family of the visitor, from the user agent. |
operatingSystem | string | Operating system of the visitor, from the user agent. |
browser | string | Browser of the visitor, from the user agent. |
verificationStartedAt | string | When the widget started the verification. |
verificationFinishedAt | string | When the visitor finished the verification. |
resultExpiresAt | string | Until when the result can be retrieved. |
resultFirstFetchedAtmay be null | string | When the result was retrieved for the first time. |
resultLastFetchedAtmay be null | string | When the result was retrieved for the last time. |
Status codes
| Status | Meaning |
|---|---|
200 | Result object |
403 | Authorization header missing or api key invalid |
404 | Could not find a result for given Id |
410 | The result has expired and can no longer be retrieved |
412 | Client failover claimed, but no recent outage is on record |
423 | Result is not yet released |
429 | The result has reached its maximum retrieval count and can no longer be retrieved |
The same operation also answers under the older path /v2/verifications/{verificationId}/results, without the /captcha prefix.
| v2 answer | v3 answer |
|---|---|
403 for a missing or invalid key | 401 with credentials_missing or credentials_invalid |
423 while not finished | 409, code: result_not_released |
429 once retrieved (without Retry-After) | 410, code: result_retrieval_limit_reached |
410 once expired | 410, code: result_expired |
The test verification ids work in v2 only together with the test key ak_ followed by 49 × x: to try the example, use it as <your_api_key> and 00000000-0000-0000-0000-000000000000 as <verification_id>.
Fetch an assessment (v1)
Section titled “Fetch an assessment (v1)”Called by the TrustCaptcha backend libraries 1.x and 2.x (legacy guide). It authenticates with one of two credentials: an API key of the project (or the older secret key of the captcha) in the tc-authorization header, or the access token the widget issued with the verification as query parameter accessToken. It returns a smaller result than v2.
curl "https://api.trustcomponent.com/verifications/{verificationId}/assessments" \ -H "tc-authorization: <your_api_key>"| Status | Meaning |
|---|---|
200 | The assessment: captchaId, verificationId, verificationPassed, score, reason, mode, origin, ipAddress, deviceFamily, operatingSystem, browser and three timestamps |
403 | No credential, or the key or access token is invalid |
404 | No assessment with this id |
410 | Already retrieved |
423 | Not released yet |