Sdks
<!-- status: ga language: api -->
SDKs
The API is described by one OpenAPI 3.1 document generated from the server code: GET /openapi.json, snapshotted as apps/web/openapi.json. Client code is generated from that spec, so it cannot drift from the server.
Language | Source | Maintained in this repo |
|---|---|---|
Go |
| yes |
TypeScript |
| yes |
Rust | the API crates' own types | yes |
Anything else | generate from | no |
Only Rust, Go and TypeScript are maintained here. For other languages point a generator at the published spec; the contract is the spec, and a breaking change shows up as a diff of the snapshot.
Conventions every client sees
Public routes live under
/v1. Errors areapplication/problem+jsonwithtype,title,status,detail.Lists use
?limit=&cursor=and answer{data, next_cursor}.A resource you cannot access answers 404, not 403.
Credentials are a session cookie (web) or
Authorization: Bearer <token>. Keep tokens in the environment ($WT_TOKEN), never in source.
Go
c, _ := wtapi.NewClientWithResponses(os.Getenv("WT_API"), wtapi.WithRequestEditorFn(
func(_ context.Context, r *http.Request) error {
r.Header.Set("Authorization", "Bearer "+os.Getenv("WT_TOKEN"))
return nil
}))
res, err := c.MeWithResponse(ctx)Explorer and code export
The web app's API page lists every operation, sends requests as the signed-in user (roles and 404s apply) and exports the request as curl, Go or TypeScript fetch with $WT_TOKEN and $WT_API placeholders.
Test data
wtctl gen --scenario <name> --rate 20/s --duration 5m --key-env WT_INGEST_KEY replays the scenarios checkout_latency, regression_after_deploy, noisy_neighbor and cron_misses through the gateway, time-shifted to now with fresh ids on every loop. The Rust testkit is the only place scenarios are defined: cargo run -p wt-testkit --bin gen_fixtures writes testdata/scenarios/*.otlp.json. The key is read from the named environment variable and is never a flag value. Each loop is time-shifted when it starts, so at low rates the data trails now by up to the loop's send time and consecutive loops overlap.