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.
Base URL
Section titled “Base URL”https://api.trustcomponent.comEach 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.
# cURL calls the REST API directly, nothing to install.npm install @trustcomponent/sdkcomposer require trustcomponent/trustcomponent-phppip install trustcomponent<!-- 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>dotnet add package TrustComponentgo get github.com/trustcomponent/trustcomponent-gogem install trustcomponentcargo add trustcomponentCreate a client
Section titled “Create a client”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).
curl -X POST https://api.trustcomponent.com/monitoring/v2/monitors/<monitor_id>/heartbeat \ -H "Authorization: Bearer <your_api_key>"import { TrustComponent } from '@trustcomponent/sdk';
const tc = new TrustComponent('<your_api_key>');
await tc.monitoring.monitors.pingHeartbeat({ monitorId: '<monitor_id>' });use TrustComponent\TrustComponent;
$tc = new TrustComponent('<your_api_key>');
$tc->monitoring()->monitors()->pingHeartbeat('<monitor_id>');from uuid import UUIDfrom trustcomponent import TrustComponent
tc = TrustComponent("<your_api_key>")
tc.monitoring.monitors.ping_heartbeat(UUID("<monitor_id>"))import com.trustcomponent.sdk.TrustComponent;import java.util.UUID;
TrustComponent tc = new TrustComponent("<your_api_key>");
tc.monitoring().monitors().pingHeartbeat(UUID.fromString("<monitor_id>"));using TrustComponent;
using var tc = new TrustComponentClient("<your_api_key>");
await tc.Monitoring.Monitors.PingHeartbeatAsync(Guid.Parse("<monitor_id>"));tc := trustcomponent.New("<your_api_key>")
_, err := tc.Monitoring.Monitors.PingHeartbeat(context.Background(), "<monitor_id>").Execute()require 'trustcomponent'
tc = TrustComponent::Client.new('<your_api_key>')
tc.monitoring.monitors.ping_heartbeat('<monitor_id>')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.
Configuration
Section titled “Configuration”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:
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();$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();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,)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();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();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) }),)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) })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:
| Setting | What it does | Value |
|---|---|---|
| API key | Authenticates every request. | Default: required Allowed: A project or agency key, ak_…. |
host | Base URL of the API. | Default: https://api.trustcomponent.comAllowed: Any URL with scheme. Only needed for tests against a mock server. |
timeout | Limit 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. |
maxRetries | How 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. |
proxy | Sends 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. |
deprecationWarnings | Logs one warning per deprecated operation and process, with the date it will be switched off. | Default: on Allowed: on or off. |
integration | Name 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. |
logger | Receives 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 layer | Replaces 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:
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>"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();$tc = TrustComponent::builder('<your_api_key>') ->proxy('http://user:password@proxy.internal:3128') ->build();tc = TrustComponent("<your_api_key>", proxy="http://user:password@proxy.internal:3128")TrustComponent tc = TrustComponent.builder("<your_api_key>") .proxy("http://user:password@proxy.internal:3128") .build();using var tc = TrustComponentClient.Builder("<your_api_key>") .Proxy("http://user:password@proxy.internal:3128") .Build();proxy, _ := url.Parse("http://user:password@proxy.internal:3128")tc := trustcomponent.New("<your_api_key>", trustcomponent.WithProxy(proxy))tc = TrustComponent::Client.new('<your_api_key>', proxy: 'http://user:password@proxy.internal:3128')let tc = trustcomponent::TrustComponent::builder("<your_api_key>") .proxy("http://user:password@proxy.internal:3128") .build()?;- Node.js:
fetchtakes no proxy setting of its own, so the SDK accepts an ownfetch;undiciis the package Node.js builds itsfetchon. - Java: besides the URL form,
proxy(host, port)withproxyAuthentication(user, password)sets the same login without putting the password into a URL; it also applies to an ownproxy(ProxySelector). For TLS connections the JDK sends Basic proxy authentication only when the system propertyjdk.http.auth.tunneling.disabledSchemesis empty, and it reads that property once, when the JVM builds its firstjava.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 anHttpClientearlier (for example Spring’sRestClienton 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:
Proxyalso takes anyIWebProxy, 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:
| Language | Read from |
|---|---|
| PHP, Python, Ruby, Go, .NET, Rust | HTTPS_PROXY, HTTP_PROXY and NO_PROXY (also in lower case), credentials in the URL included |
| TypeScript | the same variables, when Node.js runs with NODE_USE_ENV_PROXY=1 |
| Java | the 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.
Authentication
Section titled “Authentication”Every operation authenticates with an API key, sent as bearer token:
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.
Errors
Section titled “Errors”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:
{ "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.
| Status | code | Meaning |
|---|---|---|
400 | The request is invalid; detail says why. | |
400 | idempotency_key_reused | The Idempotency-Key was already used for a different request. |
400 | idempotency_key_invalid | The Idempotency-Key is not 1 to 255 printable characters. |
401 | credentials_missing | No API key was sent. |
401 | credentials_invalid | The key is unknown, revoked or expired. |
402 | feature_not_included | The plan of the module does not include this feature. |
402 | plan_limit_reached | A quota of the plan is used up. |
402 | trial_expired | The trial of the module has ended. |
403 | access_denied | The key has no access to this project, agency or resource, or lacks the role. |
403 | project_key_required | An operation that takes its project from the key was called with another key. |
404 | The resource does not exist. | |
409 | The state of the resource does not allow it now. | |
409 | idempotency_key_in_flight | A request with this Idempotency-Key is still running; send it again in a moment. |
410 | operation_retired | This version of the operation was retired; update your integration. |
423 | project_locked | The project was locked by TrustComponent; contact support. |
423 | agency_locked | The agency was locked by TrustComponent; contact support. |
429 | rate_limit_exceeded | Too many requests; wait as many seconds as Retry-After says. |
500 | An 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, 504 | Temporarily 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.
Rate limits
Section titled “Rate limits”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:
| Limit | Requests per minute |
|---|---|
| per API key | 600 |
| per IP address | 1,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.
Idempotency
Section titled “Idempotency”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:
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"}'import { withIdempotencyKey } from '@trustcomponent/sdk';
const validation = await tc.taxValidation.validations.createValidation( { projectId: '<project_id>', taxValidationValidationCreateParams: { countryCode: 'DE', rawValue: 'DE811569869' } }, withIdempotencyKey('order-4711'),);use TrustComponent\TrustComponent;
$validation = TrustComponent::withIdempotencyKey('order-4711', fn () => $tc->taxValidation()->validations()->createValidation('<project_id>', $params));validation = tc.tax_validation.validations.create_validation(UUID("<project_id>"), params, _headers={"Idempotency-Key": "order-4711"})TaxValidationValidation validation = tc.taxValidation().validations() .createValidation(UUID.fromString("<project_id>"), params, Map.of("Idempotency-Key", "order-4711"));using (TrustComponentClient.WithIdempotencyKey("order-4711")){ var validation = await tc.TaxValidation.Validations.CreateValidationAsync(Guid.Parse("<project_id>"), parameters);}validation, _, err := tc.TaxValidation.Validations.CreateValidation(trustcomponent.WithIdempotencyKey(ctx, "order-4711"), "<project_id>").TaxValidationValidationCreateParams(params).Execute()validation = tc.tax_validation.validations.create_validation('<project_id>', params, header_params: { 'Idempotency-Key' => 'order-4711' })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.
Versions and deprecation
Section titled “Versions and deprecation”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.