Skip to main content
The Java client covers the statutes, session law, watch, board, credit and pricing operations of the US Data API and matches the behavior of the Python SDK. The operations without a method yet are listed in the SDKs overview. It needs Java 11 or newer and has one runtime dependency, Jackson (jackson-databind). HTTP goes through the JDK java.net.http.HttpClient, so you can pass your own configured client. Every call has a blocking form, a ...WithResponse form (status, headers, request id, credits) and a ...Async form. For the options shared by all SDKs, see the SDKs overview.
Preview. Not yet published to Maven Central, so build from source until the first release.

Install

Check out the repository, change into java/ and run the build and tests.
These are the intended coordinates. They do not resolve today.Maven:
Gradle (Kotlin DSL):
Gradle (Groovy):
Source: Vaquill-AI/vaquill-sdks, java/ on GitHub.

Quickstart

Resources: client.statutes(), client.sessionLaws(), client.watches(), client.boards(), client.credits(), client.pricing(). Request bodies are built with Model.builder(), and optional query parameters with ...Params.builder(). Responses are plain models. Members this SDK version does not know about are kept in getAdditionalProperties() and survive a round trip.

Client options

Per call, pass RequestOptions as the last argument: timeout, maxRetries, idempotencyKey and extra headers. client.toBuilder() derives a client that shares the same spend guard. The User-Agent is vaquill-java/<version>.

Response metadata

Async

Async calls run on an SDK-owned daemon pool and use the same retries and spend guard as blocking calls.

Errors

Every failure is an unchecked VaquillException.
IdempotencyConflict is a marker interface implemented by the three idempotency exceptions, so a catch block can match them with an instanceof check. The 422 message is Validation failed: followed by the first rejected fields, for example body: Field required. A 2xx whose body is not the documented JSON raises ResponseParseException. A Deprecation or Sunset response header logs one warning per endpoint.

Retries and idempotency

The SDKs retry 408, 429 and 5xx responses, plus a 409 only for idempotency_in_progress. Connection errors and timeouts are retried when it is safe to do so. The default is 2 retries, and setting the retry limit to 0 turns retries off. Backoff starts at 0.5 seconds, doubles to an 8 second cap and is scaled down by 0 to 25 percent jitter. The wait comes from the retry-after-ms header first, then Retry-After (seconds or an HTTP date), then the body’s retryAfterSeconds. A wait above 120 seconds is not slept: the error is raised at once. Never retried: a 402 insufficient_credits, daily_cap_exceeded, any other 4xx, and anything the server marks retryable: false. Java specifics:
  • Retried by code: rate_limited, idempotency_in_progress, upstream_timeout, service_unavailable and internal_error, and otherwise by status 408, 429 and 5xx. 501 is not retried.
  • Connect failures are always retried. Any other transport error is retried only for GET and HEAD, or when the request carries an Idempotency-Key, because the server may already have done the work.
  • A 5xx on a charged call is not retried without a key, for the same reason.
A call is charged when the API declares the Idempotency-Key header on its operation. The SDKs derive the list of charged calls from the API contract, and prices are not hard-coded in them. Each charged call sends one generated Idempotency-Key, reused on every retry of that call. When the server honours the key it replays the stored response instead of charging again, and the response reports that it was replayed. Pass your own key to choose it. The SDK generates a key for every charged POST unless you pass your own with RequestOptions.builder().idempotencyKey("..."). A key must be 16 to 255 visible ASCII characters. An empty or malformed key is rejected before anything is sent. Response.isIdempotentReplayed() is true when the server answered from a stored result, and a replay counts as 0 credits against the spend guard.

Spend guard

Charged calls are serialised under one lock, so the cap is exact even with many threads. See how the guard stays exact. When the total has reached the cap, the next charged call raises SpendGuardExceededException and is never sent. client.getCreditsSpent() returns the total. Free endpoints are never blocked.

Pagination and batch helpers

Every paginated endpoint has an iter... method returning a Paginator<T>.
Charged pages spend credits and count against the spend guard like any other call. Set maxPages or maxItems.
  • maxPages(n) and maxItems(n) set limits before iteration starts. Afterwards they throw IllegalStateException. isTruncated() reports that a limit stopped the walk.
  • isStuck() is true when the server repeated a cursor or offset, or returned an empty page claiming more. Iteration stops instead of looping forever.
  • pages() iterates page by page.
  • A paginator is single use and not thread safe.
Available: statutes().iterSearch / iterDivisions / iterSectionChanges, sessionLaws().iterSearch / iterList / iterChanges / iterBody, watches().iterList / iterChanges, boards().iterList. Batch helpers split large inputs, de-duplicate in order and suffix the idempotency key per chunk (key-1, key-2). An empty input sends nothing. Each helper has an ...Async form.

Webhooks

Deliveries use Standard Webhooks (webhook-id, webhook-timestamp, webhook-signature).
  • Pass the raw request body, not re-serialised JSON.
  • headers is any Map<String, ?>. Names are matched case-insensitively and values may be a string or a list.
  • The secret is the whsec_ base64 form or a plain string. An empty, blank or whsec_-only secret, and invalid base64 after whsec_, throw IllegalArgumentException, so an unset environment variable can never verify a forged event.
  • Tolerance is 300 seconds either side of now. Use the longer overloads for another tolerance, several secrets (rotation) or the legacy X-Vaquill-Signature scheme (off by default, no replay protection).
  • WebhookVerificationException means do not trust the delivery. WebhookPayloadException means the signature was valid but the body is not an event.
See Alerts for the payload and delivery behavior.

Versioning

The SDK follows semantic versioning, and the first release is planned as 0.1.0. The library targets Java 11 (--release 11).
Releases will be cut by pushing a java-vX.Y.Z tag, which signs and publishes to Maven Central. The signing and upload steps have not run yet, so the first release is the first time they are exercised.
Last modified on November 7, 2026