Java client for the Vertesia API.
The client combines a small hand-written facade with OpenAPI-generated API and model classes. Application code should usually start with VertesiaClient; the generated APIs and models remain available under io.vertesia.api and io.vertesia.model.
Requires Java 17 or newer.
The package coordinates are:
<dependency>
<groupId>io.vertesia</groupId>
<artifactId>vertesia-client</artifactId>
<version>1.7.0-alpha.20261120.100641Z</version>
</dependency>import io.vertesia.ClientOptions;
import io.vertesia.VertesiaClient;
VertesiaClient client = new VertesiaClient(new ClientOptions()
.setRegion("us1")
.setApiKey("sk-..."));
var account = client.accounts.getCurrentAccount().execute();
var projects = client.projects.listProjects().execute();sk- secret keys are exchanged through Vertesia STS and cached as bearer tokens. pk- keys are no longer supported. If you already have an issued bearer token, pass it directly:
VertesiaClient client = new VertesiaClient(new ClientOptions()
.setRegion("us1")
.setToken("eyJ..."));Do not set both apiKey and token.
Use region for normal public regional routing:
VertesiaClient client = new VertesiaClient(new ClientOptions()
.setRegion("us1")
.setApiKey("sk-..."));Use preview with a region to target the preview API:
VertesiaClient client = new VertesiaClient(new ClientOptions()
.setRegion("us1")
.setPreview(true)
.setApiKey("sk-..."));Use site when you need to pass an exact API host:
VertesiaClient client = new VertesiaClient(new ClientOptions()
.setSite("api.us1.vertesia.io")
.setApiKey("sk-..."));serverUrl, storeUrl, and tokenServerUrl are developer-only overrides for local or split-service testing.
The high-level client exposes generated API groups:
client.studio.projects.listProjects().execute();
client.store.objects.searchObjects(payload).execute();It also exposes convenience aliases when routing is unambiguous:
client.projects.listProjects().execute();
client.objects.searchObjects(payload).execute();Each operation returns a request: pass required parameters to the method, set optional ones by name, and finish with execute(). Adding an optional parameter to an operation does not break existing callers.
client.apps.deleteApp(appId).confirm(true).execute();executeWithHttpInfo(), executeAsync(callback) and buildCall(callback) are available on every request.
Generated model classes can be used directly:
import io.vertesia.model.ComplexSearchPayload;
ComplexSearchPayload payload = new ComplexSearchPayload();A newer server can add a property, an enum value, or a union variant without a breaking API change, and a released client keeps decoding its responses:
-
Unknown properties are ignored (open models keep them in
getAdditionalProperties()). -
An unknown enum value decodes as
UNKNOWN_DEFAULT_OPEN_API, and writing the model back sends the value received, so a read-modify-write does not change it. A Java enum cannot hold that value, so the model keeps the JSON it received for the property, in a transient field, and writes each unknown value again in place of the placeholder. A value you set, or a list or a map you put in place of a decoded one, is written as it now is. A decoded list or map you edit keeps its unknown values: a list gets them back in order while it holds as manyUNKNOWN_DEFAULT_OPEN_APIelements as it received unknown values (removing one of them, or adding a placeholder yourself, writes the placeholders as such), and a map by key. This covers enum properties, enums in lists and maps, and models decoded as union variants. A union whose branch is an enum, such asAuditAction(KnownAuditActionor a string), decodes a value the enum does not declare with its next branch:"c:reviewer"is anAssignableRoleNameholding aString, notSystemRoles.UNKNOWN_DEFAULT_OPEN_API.To read the value itself,
UnknownEnumValues.asString(model, "status")returns the JSON string the model writes for a property, andUnknownEnumValues.asJson(model, "statuses")the JSON of a list or map: the value received when it is unknown to this client, else the value set.AutonomousRunResponse run = response.getAutonomousRunResponse(); if (run.getStatus() == AgentRunStatus.UNKNOWN_DEFAULT_OPEN_API) { String status = UnknownEnumValues.asString(run, "status").orElseThrow(); // "hibernating" }
-
An unknown union variant is kept as the
JsonElementit was received as:getActualInstance()andgetRaw()return it, and serialization writes it back unchanged.getRaw()isnullfor a known variant. A union with a published discriminator does this only for a discriminator value it does not know; a known value must match its branch, and a missing one is an error. The raw value keeps itsnullmembers: models leave out the properties they do not set and thenullentries of their typed maps (putMetadataItem("owner", null)still sends noowner), andJsonOutputwrites the rest of the tree as it is, sonullvalues inside free-form maps and objects (Object,Map<String, Object>) are written too. -
ModelOptionsandMcpConnectionParameterareanyOfunions whose branches carry a literal tag (_option_id,type), optional inModelOptions. A branch is used only when it writes every received property back with the same value. Options merged from several model families are kept raw instead of losing those properties.
scripts/patch_forward_compat_validation.py applies these rules after generation, with
JsonOutput and UnknownEnumValues.
Generated source is committed so the repository is directly usable by Java consumers. The source of truth is still the OpenAPI spec generated from the private Studio repository.
To regenerate locally:
scripts/regenerate.shAfter any OpenAPI generation path, run scripts/post_generate.sh before
testing or committing generated output. It is the shared post-generation hook
used by local regeneration and the internal Studio sync workflow.
The internal Studio workflow syncs generated Java source and spec/ into this repository after the OpenAPI spec is validated on main. Hand-written client files, tests, workflows, README, LICENSE, NOTICE, .env.example, and generator config are protected by .openapi-generator-ignore.
Run offline tests:
mvn -B testSDK sync supplies shared API response fixtures. To run the fixture-backed checks locally,
set VERTESIA_STUDIO_OPENAPI_FIXTURES to the absolute path of the fixture directory.
Run the local quality gate:
mvn -B verifyFormat generated and hand-written sources:
mvn -B spotless:applyCheck formatting without modifying files:
mvn -B spotless:checkRun build hygiene checks only:
mvn -B validateLive tests are opt-in and load .env when present:
VERTESIA_LIVE_TESTS=1 mvn -B testRequired live-test variables:
VERTESIA_API_KEY=sk-...
VERTESIA_STUDIO_URL=https://api-preview.us1.vertesia.io/api/v1
VERTESIA_ZENO_URL=https://api-preview.us1.vertesia.io/api/v1
VERTESIA_STS_URL=https://sts.us1.vertesia.io
The public CI test workflow runs offline tests. The integration workflow resolves the test sk- key from Google Secret Manager through GitHub OIDC.
Use the Release workflow on main for timestamped dev cohorts or release/X.Y
for stable releases. version is the synchronized spec version with a leading
v; optional source_sha pins the tested commit. dry_run=true validates and
packages without tags or uploads.
The checked-in POM remains <base>-SNAPSHOT. The publisher stamps the artifact
version only in its build workspace, runs mvn -B verify, and tags the original
source commit. It does not push version-bump commits to the source branch.
For example, v1.6.0-dev.20261021.123456Z publishes Maven artifact version
1.6.0-alpha.20261021.123456Z; Maven's alpha qualifier sorts before the final
release. Dev GitHub releases are marked as prereleases.
Retries accept an existing tag only at the same source commit. An already published Maven version is reused only when its matching source tag exists.
The release workflow can upload release artifacts to Maven Central Portal. It requires these GitHub secrets:
MAVEN_CENTRAL_USERNAME
MAVEN_CENTRAL_PASSWORD
MAVEN_GPG_PRIVATE_KEY
MAVEN_GPG_PASSPHRASE
By default, the workflow publishes to Maven Central and waits for availability. Set
maven_central_auto_publish=false to leave the validated deployment for manual
publication in the Central Portal. Coordinated cohorts use automatic publication.
Use one facade per user/project/resource/scope combination. The user must already be provisioned through SCIM and the organization must configure a federation trust policy. No user creation occurs.
FederationOptions policy = new FederationOptions(
"connection-id", "project-id", "https://api.us1.vertesia.io",
() -> getFreshIdpToken());
// policy = policy.withScope("content:read"); // omit for current delegable permissions
ClientOptions options = new ClientOptions().setRegion("us1").setFederation(policy);
VertesiaClient client = new VertesiaClient(options);
// Use client.projects, client.objects, etc. as usual.
// One-shot exchange; caller manages the lifetime:
FederationToken issued = VertesiaClient.exchangeFederationToken(options, policy, idpAssertion);
// issued.accessToken(), issued.expiresIn(), issued.scope()The first authenticated request exchanges an assertion. The facade shares its cached token between
Studio and Store, obtaining a fresh assertion after 90% of the token lifetime on the next request.
Renewal is synchronized across threads. There is no refresh token, background worker or automatic
replay of API writes on a 401. A failed renewal fails the request without sending expired credentials.
The provider must obtain a currently valid IdP token whenever called. Federation, apiKey and
token options are mutually exclusive.
Subject assertions default to urn:ietf:params:oauth:token-type:jwt; the full record constructor
also accepts ID/access token types. The endpoint defaults to resolved STS plus /oauth/token;
use policy.withTokenEndpoint(...) for the complete tenant endpoint, or explicit tokenServerUrl
for custom split URLs. HTTPS is required except loopback HTTP, and redirects are rejected.
Optional middleware authentication uses policy.withClientSecret(id, secret) for
client_secret_post, withClientSecretBasic(id, secret) for Basic, or
withClientAssertion(id, supplier) for private_key_jwt. The supplier must mint a fresh short-lived
assertion with a unique jti on each exchange, with a single-string aud equal to the Vertesia
authorization-server issuer from discovery (including the tenant). Secrets and tokens are redacted
from the new record representations and exchange errors.
Exchange results report conservative remaining expires_in seconds after subtracting the STS
round trip (rounded up). Time spent obtaining IdP/client assertions does not consume the delegated
token's lifetime. Already-expired results are rejected in both one-shot and automatic modes.
Implicit STS routing is limited to recognized Vertesia STS domains; custom api* hostnames require
an explicit STS URL or complete token endpoint, even when their names resemble hosted endpoints.
An API 401 invalidates only the bearer token that request used. The SDK does not replay the request; the next call attempts a fresh exchange. Concurrent late 401s do not evict a different newer token. Failed automatic exchanges are cached for one second to avoid repeatedly calling the IdP/STS during an outage. Finite lifetimes up to one day are accepted, including fractional seconds; returned remaining seconds are rounded down. The server's current five-minute cap is not a client limit.
Catch FederationExchangeException and inspect getStatusCode() and getErrorCode() for retryable
429/503 responses or configuration errors. Only known OAuth codes are exposed; descriptions and
unknown remote codes remain redacted. Default one-shot calls reuse a shared HTTP connection pool.
Vertesia signs webhooks with Standard Webhooks: the deliveries of event
subscriptions with signing enabled, and the workflow notifications (notify_endpoints) of a project that signs its
notifications. Verify them with the Standard Webhooks library and the whsec_ secret Vertesia returned when the
subscription was created or the secret rotated; a project's notifications all share the project's notification
secret. During a rotation a request carries one signature per active secret, and either verifies.
An event subscription signed before Vertesia adopted Standard Webhooks keeps its earlier X-Vertesia-Signature
header until its secret is rotated, and that first rotation switches formats at once, with no overlap: deploy a
receiver that accepts either format before rotating.
Use com.standardwebhooks:standardwebhooks; see the
Java library.
import com.standardwebhooks.Webhook;
Webhook webhook = new Webhook(System.getenv("VERTESIA_WEBHOOK_SECRET")); // whsec_...
// Throws WebhookVerificationException when the signature or the timestamp is not valid.
webhook.verify(rawBody, headers);Pass the raw request body exactly as received. The webhook-id header stays the same across retries, so deduplicate
on it.