Skip to content

API Overview

The TrustComponent API connects your own servers to every module: fetch CAPTCHA results, send analytics events and read your statistics, report heartbeats, validate VAT IDs and read the audit log. Everything else happens in the dashboard.

Every endpoint is documented on the page of its module, with its parameters, its response, every status code and an example in cURL and in each of the eight SDK languages. Pick your language once in any example; every other example on the site follows.

https://api.trustcomponent.com

Each path starts with the module and the version of the operation, for example /captcha/v3/verifications/{verificationId}/results. Request and response bodies are JSON (application/json), ids are UUIDs and timestamps are ISO 8601 in UTC, like 2026-07-01T10:30:00.000Z.

The SDKs wrap every operation of this reference, retry what is safe to retry, turn error answers into typed errors and stay on the version of each operation they were built for. They are the recommended way to call the API; cURL works just as well.

Install
Terminal window
# cURL calls the REST API directly, nothing to install.
Install
Terminal window
npm install @trustcomponent/sdk
Install
Terminal window
composer require trustcomponent/trustcomponent-php
Install
Terminal window
pip install trustcomponent
Install
<!-- Maven; Gradle: implementation("com.trustcomponent:trustcomponent-java:1.0.1") -->
<dependency>
<groupId>com.trustcomponent</groupId>
<artifactId>trustcomponent-java</artifactId>
<version>1.0.1</version>
</dependency>
Install
Terminal window
dotnet add package TrustComponent
Install
Terminal window
go get github.com/trustcomponent/trustcomponent-go
Install
Terminal window
gem install trustcomponent
Install
Terminal window
cargo add trustcomponent

Create one client when your application starts and share it: it keeps the connections open and serves every module. Every call reads the same in every language, module, resource, operation, named as in this reference and written the way your language writes names: tc.monitoring.monitors.pingHeartbeat(…), tc.taxValidation.validations.createValidation(…), tc.platform.projects.getProjects(). CAPTCHA has a single operation and calls it on the module: tc.captcha.getVerificationResult(token).

Create a client and call an operation
Terminal window
curl -X POST https://api.trustcomponent.com/monitoring/v2/monitors/<monitor_id>/heartbeat \
-H "Authorization: Bearer <your_api_key>"
Create a client and call an operation
import { TrustComponent } from '@trustcomponent/sdk';
const tc = new TrustComponent('<your_api_key>');
await tc.monitoring.monitors.pingHeartbeat({ monitorId: '<monitor_id>' });
Create a client and call an operation
use TrustComponent\TrustComponent;
$tc = new TrustComponent('<your_api_key>');
$tc->monitoring()->monitors()->pingHeartbeat('<monitor_id>');
Create a client and call an operation
from uuid import UUID
from trustcomponent import TrustComponent
tc = TrustComponent("<your_api_key>")
tc.monitoring.monitors.ping_heartbeat(UUID("<monitor_id>"))
Create a client and call an operation
import com.trustcomponent.sdk.TrustComponent;
import java.util.UUID;
TrustComponent tc = new TrustComponent("<your_api_key>");
tc.monitoring().monitors().pingHeartbeat(UUID.fromString("<monitor_id>"));
Create a client and call an operation
using TrustComponent;
using var tc = new TrustComponentClient("<your_api_key>");
await tc.Monitoring.Monitors.PingHeartbeatAsync(Guid.Parse("<monitor_id>"));
Create a client and call an operation
tc := trustcomponent.New("<your_api_key>")
_, err := tc.Monitoring.Monitors.PingHeartbeat(context.Background(), "<monitor_id>").Execute()
Create a client and call an operation
require 'trustcomponent'
tc = TrustComponent::Client.new('<your_api_key>')
tc.monitoring.monitors.ping_heartbeat('<monitor_id>')
Create a client and call an operation
use trustcomponent::apis::monitoring_monitors_api::PingHeartbeatParams;
let tc = trustcomponent::TrustComponent::new("<your_api_key>");
tc.monitoring.monitors.ping_heartbeat(PingHeartbeatParams {
monitor_id: "<monitor_id>".into(),
}).await?;

An error answer becomes a typed error that carries the status and the code from the table below; a lost connection is an error of its own. Every operation of this reference shows its call in each language.

new TrustComponent('<your_api_key>') with the defaults fits most backends. Every setting is chosen once, when the client is created; this example sets all of them:

Configure the client
const tc = TrustComponent.builder('<your_api_key>')
.host('https://api.trustcomponent.com')
.timeoutMs(10_000)
.maxRetries(1)
.deprecationWarnings(true)
.integration('my-shop/2.4.0')
.logger({ warn: (message) => myLog.warn(message) })
.fetch(fetch)
.build();
Configure the client
$tc = TrustComponent::builder('<your_api_key>')
->host('https://api.trustcomponent.com')
->connectTimeout(3)
->timeout(10)
->maxRetries(1)
->proxy('http://proxy.internal:3128')
->deprecationWarnings(true)
->integration('my-shop/2.4.0')
->logger(fn (string $message) => $logger->warning($message))
->build();
Configure the client
tc = TrustComponent(
"<your_api_key>",
host="https://api.trustcomponent.com",
timeout=10,
max_retries=1,
proxy="http://proxy.internal:3128",
deprecation_warnings=True,
integration="my-shop/2.4.0",
logger=my_logger.warning,
)
Configure the client
TrustComponent tc = TrustComponent.builder("<your_api_key>")
.host("https://api.trustcomponent.com")
.connectTimeout(Duration.ofSeconds(3))
.timeout(Duration.ofSeconds(10))
.maxRetries(1)
.proxy("http://proxy.internal:3128")
.proxyAuthentication("user", "password")
.deprecationWarnings(true)
.integration("my-shop/2.4.0")
.logger(message -> log.warn(message))
.build();
Configure the client
using var tc = TrustComponentClient.Builder("<your_api_key>")
.Host("https://api.trustcomponent.com")
.Timeout(TimeSpan.FromSeconds(10))
.MaxRetries(1)
.Proxy("http://proxy.internal:3128")
.DeprecationWarnings(true)
.Integration("my-shop/2.4.0")
.Logger(message => logger.LogWarning(message))
.Build();
Configure the client
proxy, _ := url.Parse("http://proxy.internal:3128")
tc := trustcomponent.New("<your_api_key>",
trustcomponent.WithHost("https://api.trustcomponent.com"),
trustcomponent.WithTimeout(10*time.Second),
trustcomponent.WithMaxRetries(1),
trustcomponent.WithProxy(proxy),
trustcomponent.WithDeprecationWarnings(true),
trustcomponent.WithIntegration("my-shop/2.4.0"),
trustcomponent.WithLogger(func(message string) { log.Print(message) }),
)
Configure the client
tc = TrustComponent::Client.new(
'<your_api_key>',
host: 'https://api.trustcomponent.com',
timeout: 10,
max_retries: 1,
proxy: 'http://proxy.internal:3128',
deprecation_warnings: true,
integration: 'my-shop/2.4.0',
logger: ->(message) { Rails.logger.warn(message) }
)
Configure the client
let tc = trustcomponent::TrustComponent::builder("<your_api_key>")
.host("https://api.trustcomponent.com")
.timeout(Duration::from_secs(10))
.max_retries(1)
.proxy("http://proxy.internal:3128")
.deprecation_warnings(true)
.integration("my-shop/2.4.0")
.logger(|message| eprintln!("{message}"))
.build()?;

The names follow your language (maxRetries, max_retries, MaxRetries, WithMaxRetries); what they do is the same everywhere:

SettingWhat it doesValue
API keyAuthenticates every request.Default: required
Allowed: A project or agency key, ak_….
hostBase URL of the API.Default: https://api.trustcomponent.com
Allowed: Any URL with scheme. Only needed for tests against a mock server.
timeoutLimit for one attempt, from sending until the answer arrived.Default: 30 s
Allowed: Greater than 0. In seconds in PHP, Python and Ruby, in milliseconds in TypeScript (timeoutMs), a duration type in Java, .NET, Go and Rust. In Go it limits connecting and the start of the answer.
connectTimeout (PHP and Java only)Limit for opening the connection; the other languages include it in timeout.Default: 3 s
Allowed: Greater than 0.
maxRetriesHow often a request is repeated when the API says it is temporary: 429 with Retry-After, 502, 503, 504 and a lost connection. Nothing else is repeated.Default: 2
Allowed: 0 or more; 0 switches retries off, negative values count as 0.
proxySends every request through an HTTP proxy, see Proxy.Default: none
Allowed: A proxy URL, optionally with user:password@. In Go a parsed *url.URL, in .NET also any IWebProxy, in Java also proxy(host, port). TypeScript takes an own fetch instead.
proxyAuthentication (Java only)Login for the proxy, without putting the password into a URL; also for an own proxy(ProxySelector). The other languages take the login in the proxy URL.Default: none
Allowed: user and password.
deprecationWarningsLogs one warning per deprecated operation and process, with the date it will be switched off.Default: on
Allowed: on or off.
integrationName and version of the plugin or product built on the SDK. It is sent with every request in addition to the language, version and runtime the SDK always reports.Default: none
Allowed: name/version: the name in lower-case letters, digits, ., _ and - (at most 50), the version up to 32 characters without spaces, e.g. my-shop/2.4.0. Anything else fails when the client is created.
loggerReceives the SDK’s warnings.Default: the standard log of the language (console.warn, error_log, the trustcomponent logger in Python, java.util.logging, stderr in .NET, Ruby and Rust, log.Print in Go)
Allowed: A function that takes one string; in TypeScript an object with warn.
HTTP layerReplaces the HTTP stack below the SDK, for tests or an own connection pool: fetch (TypeScript), handler (PHP, Guzzle), HttpMessageHandler (.NET), WithTransport (Go), faraday_adapter (Ruby).Default: the language’s own
Allowed: With an own transport or handler in Go and .NET, proxy and timeout are up to that transport.

Retries and waiting. Without Retry-After the SDK waits about 0.5 s, 1 s, 2 s and so on between attempts, at most 8 s. A Retry-After over 60 seconds is not waited for; the error comes back at once. One call can therefore take up to (maxRetries + 1) × timeout plus the waits. Set maxRetries to 0 where a request has to answer within a tight time budget, such as a form submit.

A request made without the SDK, for example with cURL, needs none of this; the API asks for nothing but the API key.

One client per application. The client keeps its connections open; create it once and reuse it instead of creating one per request.

All requests can go through an HTTP proxy, for TLS connections too (the proxy then opens a tunnel). If the proxy asks for a login, put user and password into the proxy URL, percent-encoded where they contain special characters; the SDK sends them as Basic proxy authentication:

Through a proxy with login
Terminal window
curl --proxy http://user:password@proxy.internal:3128 \
-X POST https://api.trustcomponent.com/monitoring/v2/monitors/<monitor_id>/heartbeat \
-H "Authorization: Bearer <your_api_key>"
Through a proxy with login
import { ProxyAgent, fetch } from 'undici';
const proxy = new ProxyAgent('http://user:password@proxy.internal:3128');
const tc = TrustComponent.builder('<your_api_key>')
.fetch((url, init) => fetch(url, { ...init, dispatcher: proxy }))
.build();
Through a proxy with login
$tc = TrustComponent::builder('<your_api_key>')
->proxy('http://user:password@proxy.internal:3128')
->build();
Through a proxy with login
tc = TrustComponent("<your_api_key>", proxy="http://user:password@proxy.internal:3128")
Through a proxy with login
TrustComponent tc = TrustComponent.builder("<your_api_key>")
.proxy("http://user:password@proxy.internal:3128")
.build();
Through a proxy with login
using var tc = TrustComponentClient.Builder("<your_api_key>")
.Proxy("http://user:password@proxy.internal:3128")
.Build();
Through a proxy with login
proxy, _ := url.Parse("http://user:password@proxy.internal:3128")
tc := trustcomponent.New("<your_api_key>", trustcomponent.WithProxy(proxy))
Through a proxy with login
tc = TrustComponent::Client.new('<your_api_key>', proxy: 'http://user:password@proxy.internal:3128')
Through a proxy with login
let tc = trustcomponent::TrustComponent::builder("<your_api_key>")
.proxy("http://user:password@proxy.internal:3128")
.build()?;
  • Node.js: fetch takes no proxy setting of its own, so the SDK accepts an own fetch; undici is the package Node.js builds its fetch on.
  • Java: besides the URL form, proxy(host, port) with proxyAuthentication(user, password) sets the same login without putting the password into a URL; it also applies to an own proxy(ProxySelector). For TLS connections the JDK sends Basic proxy authentication only when the system property jdk.http.auth.tunneling.disabledSchemes is empty, and it reads that property once, when the JVM builds its first java.net.http.HttpClient. If the SDK builds that first client, it sets the property to empty itself (unless your application has set it), which applies to the whole JVM. If your application or a library creates an HttpClient earlier (for example Spring’s RestClient on the JDK client, or another SDK), set the property when the JVM starts, with an empty value: -Djdk.http.auth.tunneling.disabledSchemes=. The login then reaches the proxy whatever runs first.
  • .NET: Proxy also takes any IWebProxy, e.g. one with Windows credentials.

A proxy that refuses the login answers 407; the SDK raises an error that says so instead of retrying.

Without a proxy setting the SDK follows the usual proxy configuration of the platform, so a proxy set by the server’s administrator applies without any code:

LanguageRead from
PHP, Python, Ruby, Go, .NET, RustHTTPS_PROXY, HTTP_PROXY and NO_PROXY (also in lower case), credentials in the URL included
TypeScriptthe same variables, when Node.js runs with NODE_USE_ENV_PROXY=1
Javathe JVM properties https.proxyHost, https.proxyPort, http.proxyHost, http.proxyPort and http.nonProxyHosts (-Dhttps.proxyHost=proxy.internal -Dhttps.proxyPort=3128); a login is set with proxyAuthentication

A proxy set on the client always wins over the environment.

Every operation authenticates with an API key, sent as bearer token:

Terminal window
Authorization: Bearer ak_your_key_here
  • Project keys belong to one project and work for every module in it. Create them in the project under API / Integration, which also shows the project ID.
  • Agency keys belong to an agency and reach the client projects the agency manages, with the roles the key holds there. Operations that act on a project therefore name it in the path (/projects/{projectId}/…); List projects returns the projects a key reaches. Create them in the agency under API / Integration.
  • A key carries roles like a member: Member for everything that changes something, Auditor for the audit log. Reading results and statistics needs no particular role.
  • A key is shown in full only once, right after you create it; we store only a hash. Keep it on your server, never in a browser or an app.

Every error answer is application/problem+json (RFC 9457) with title, status, an English detail for people and, where a program may want to react, a stable code:

Example error (409)
{
"type": "about:blank",
"title": "Conflict",
"status": 409,
"code": "result_not_released",
"detail": "The visitor has not finished the verification yet"
}

The table lists the answers every operation shares. An operation can add its own: a code of its module with one of these statuses (409 result_not_released when a CAPTCHA result is fetched too early, 404 monitor_not_heartbeat for a heartbeat to a monitor of another type), or a status that only it uses. Each operation lists every answer it can give, so branch on code where there is one and on the status otherwise.

StatuscodeMeaning
400The request is invalid; detail says why.
400idempotency_key_reusedThe Idempotency-Key was already used for a different request.
400idempotency_key_invalidThe Idempotency-Key is not 1 to 255 printable characters.
401credentials_missingNo API key was sent.
401credentials_invalidThe key is unknown, revoked or expired.
402feature_not_includedThe plan of the module does not include this feature.
402plan_limit_reachedA quota of the plan is used up.
402trial_expiredThe trial of the module has ended.
403access_deniedThe key has no access to this project, agency or resource, or lacks the role.
403project_key_requiredAn operation that takes its project from the key was called with another key.
404The resource does not exist.
409The state of the resource does not allow it now.
409idempotency_key_in_flightA request with this Idempotency-Key is still running; send it again in a moment.
410operation_retiredThis version of the operation was retired; update your integration.
423project_lockedThe project was locked by TrustComponent; contact support.
423agency_lockedThe agency was locked by TrustComponent; contact support.
429rate_limit_exceededToo many requests; wait as many seconds as Retry-After says.
500An unexpected error on our side. It is not retried automatically, because the same request may fail the same way; try again later, and if it keeps failing, contact support with the time of the request and the instance from the answer.
502, 503, 504Temporarily unavailable; the SDKs retry with a short backoff. If it persists, try again later, and contact support if it does not get better.

A 402 is something you can lift yourself (a plan, an add-on, a payment), a 423 only TrustComponent can. Codes are never renamed and never reused for another meaning; new ones may appear, so treat an unknown code like its status.

The API is rate limited. A request over the limit answers 429 with code: rate_limit_exceeded and a Retry-After header in seconds; the SDKs wait and retry on their own.

Two limits apply at the same time:

LimitRequests per minute
per API key600
per IP address1,200

The limits protect the platform and are far above normal use; they are not your plan’s quota. Each limit works like a bucket that holds one minute’s worth of requests and refills continuously: a burst of up to the full minute passes at once, and afterwards requests pass at the rate the bucket refills. To give a system a budget of its own, for example a busy CAPTCHA form apart from an analytics export, give it its own API key, within the number of keys a project can have. If you expect to need more than these limits, write to our support. An operation with a different limit names it on its page, for example sending a heartbeat.

A network error or a timeout leaves open whether a write reached TrustComponent. To repeat it safely, send an Idempotency-Key header of up to 255 characters, for example a UUID or your own order number. A request repeated within 24 hours with the same key and the same content runs only once: the repetition gets the original answer, marked with the header Idempotent-Replayed: true.

A key belongs to the API key that sent it: the same value used with another API key, by you or by anyone else, is a different key, so nobody can block or read your requests through it. Only successful answers are kept, so a request that failed can be sent again with the same key. A key reused for a different request answers 400 with code: idempotency_key_reused, and a repetition that arrives while the first request is still running answers 409 with code: idempotency_key_in_flight. An empty key, one longer than 255 characters or one with control characters answers 400 with code: idempotency_key_invalid; leave the header out to send a request without a key. The operations that accept the header list it among their parameters.

The protection covers requests and answers of up to 12 MiB each; a larger request, or one whose answer is larger, runs normally without it. Requests sent as form data (multipart/form-data, for example a file upload, or application/x-www-form-urlencoded) run without it as well.

The SDKs send a new key with every write and the same key on their own retries, so you need nothing for that. To make a call idempotent across processes, for example when a job may run twice, pass your own key:

Your own idempotency key
Terminal window
curl -X POST "https://api.trustcomponent.com/taxvalidation/v2/projects/<project_id>/validations" \
-H "Authorization: Bearer <your_api_key>" \
-H "Idempotency-Key: order-4711" \
-H "Content-Type: application/json" \
-d '{"countryCode": "DE", "rawValue": "DE811569869"}'
Your own idempotency key
import { withIdempotencyKey } from '@trustcomponent/sdk';
const validation = await tc.taxValidation.validations.createValidation(
{ projectId: '<project_id>', taxValidationValidationCreateParams: { countryCode: 'DE', rawValue: 'DE811569869' } },
withIdempotencyKey('order-4711'),
);
Your own idempotency key
use TrustComponent\TrustComponent;
$validation = TrustComponent::withIdempotencyKey('order-4711', fn () => $tc->taxValidation()->validations()->createValidation('<project_id>', $params));
Your own idempotency key
validation = tc.tax_validation.validations.create_validation(UUID("<project_id>"), params, _headers={"Idempotency-Key": "order-4711"})
Your own idempotency key
TaxValidationValidation validation = tc.taxValidation().validations()
.createValidation(UUID.fromString("<project_id>"), params, Map.of("Idempotency-Key", "order-4711"));
Your own idempotency key
using (TrustComponentClient.WithIdempotencyKey("order-4711"))
{
var validation = await tc.TaxValidation.Validations.CreateValidationAsync(Guid.Parse("<project_id>"), parameters);
}
Your own idempotency key
validation, _, err := tc.TaxValidation.Validations.CreateValidation(trustcomponent.WithIdempotencyKey(ctx, "order-4711"), "<project_id>").TaxValidationValidationCreateParams(params).Execute()
Your own idempotency key
validation = tc.tax_validation.validations.create_validation('<project_id>', params, header_params: { 'Idempotency-Key' => 'order-4711' })
Your own idempotency key
let validation = trustcomponent::with_idempotency_key("order-4711", tc.tax_validation.validations.create_validation(params)).await?;

In TypeScript, Python, Java and Ruby the key belongs to the one call it is passed to. In PHP, .NET, Go and Rust it is set for a scope, and every write inside that scope carries it: the writes in the callback (PHP), in the using block (.NET), made with the returned context (Go) or in the future passed to with_idempotency_key (Rust). Let one scope wrap exactly one write, as in the examples above; a second, different write with the same key answers 400 with code: idempotency_key_reused. In Go, pass the context from WithIdempotencyKey to that one call instead of keeping it for later calls.

Each operation has its own version, visible in its path. A released version never changes in a way that breaks an integration: new fields, new optional parameters, new operations and new enum values can appear at any time, so ignore fields you do not know and tolerate unknown enum values. Anything else becomes a new version of that one operation, next to the old one.

A version that is about to go away answers with a Deprecation and a Sunset header (RFC 9745, RFC 8594), and the SDKs log one warning per operation. After the sunset date it answers 410 with code: operation_retired. Older versions that existing integrations still use are documented under Legacy: TrustCaptcha, TrustMonitoring and Trust VAT Checker.