Generate an SDK
Generate a type-safe API client for any language from the Tholos OpenAPI spec.
The Tholos API publishes a full OpenAPI 3.1 specification that you can use to generate a type-safe client in any language. This means you get autocomplete, type checking, and up-to-date method signatures without maintaining a hand-written SDK.
OpenAPI spec URL
Section titled “OpenAPI spec URL”https://api.tholos.app/openapi.jsonYou can point any OpenAPI-compatible code generator at this URL to produce a client for your language of choice.
TypeScript
Section titled “TypeScript”@hey-api/openapi-ts generates a fully typed client with optional React Query integration.
-
Install the generator
Terminal window pnpm add -D @hey-api/openapi-tspnpm add @hey-api/client-fetch -
Create a config file
Create
openapi-ts.config.tsin your project root:import { defineConfig } from "@hey-api/openapi-ts";export default defineConfig({input: "https://api.tholos.app/openapi.json",output: {path: "src/generated/tholos",format: "prettier",},client: "@hey-api/client-fetch",plugins: ["@hey-api/typescript", "@hey-api/sdk"],}); -
Generate the client
Terminal window npx openapi-tsThis creates typed functions for every API endpoint in
src/generated/tholos/. -
Use the generated client
import { client, getMe, getOrganizationVaults } from "./generated/tholos";client.setConfig({baseUrl: "https://api.tholos.app",headers: {Authorization: `Bearer ${process.env.THOLOS_API_TOKEN}`,},});const { data: user } = await getMe();console.log(user);const { data: vaults } = await getOrganizationVaults({path: { organization_id: 123 },});console.log(vaults);
Python
Section titled “Python”openapi-python-client generates a typed Python client with httpx.
-
Install the generator
Terminal window pip install openapi-python-client -
Generate the client
Terminal window openapi-python-client generate \--url https://api.tholos.app/openapi.json \--output-path ./tholos_client -
Use the generated client
from tholos_client import Client, AuthenticatedClientclient = AuthenticatedClient(base_url="https://api.tholos.app",token="tholos_pat_your_token_here",)from tholos_client.api.user import get_meresponse = get_me.sync(client=client)print(response)
ogen generates a Go client with full type definitions and built-in security support. We recommend ogen over oapi-codegen because it supports OpenAPI 3.1.
-
Install the generator
Terminal window go install github.com/ogen-go/ogen/cmd/ogen@latest -
Create a config file
Create
ogen.ymlin your project:generator:ignore_not_implemented: ["all"]The
ignore_not_implementedsetting tells ogen to skip operations it cannot generate (e.g., complexanyOfschemas) instead of failing. -
Generate the client
Terminal window curl -o openapi.json https://api.tholos.app/openapi.jsonogen --config ogen.yml --target tholos --clean openapi.jsonThis creates a fully typed client and request/response types in the
tholos/directory. -
Use the generated client
package mainimport ("context""fmt""github.com/ogen-go/ogen/ogenerrors""your-module/tholos")// bearerTokenSource provides PAT authentication.type bearerTokenSource struct {token string}func (s *bearerTokenSource) APIKeyCookie(_ context.Context, _ tholos.OperationName) (tholos.APIKeyCookie, error) {return tholos.APIKeyCookie{}, ogenerrors.ErrSkipClientSecurity}func (s *bearerTokenSource) APIKeyHeader(_ context.Context, _ tholos.OperationName) (tholos.APIKeyHeader, error) {return tholos.APIKeyHeader{APIKey: "Bearer " + s.token}, nil}func main() {client, _ := tholos.NewClient("https://api.tholos.app",&bearerTokenSource{token: "tholos_pat_your_token_here"},)resp, _ := client.GetMe(context.Background())fmt.Println(resp)}
Other languages
Section titled “Other languages”Any OpenAPI code generator works with the Tholos spec. Some popular options:
| Language | Generator |
|---|---|
| Ruby | openapi-generator with the ruby client |
| Java/Kotlin | openapi-generator with the java or kotlin client |
| Swift | openapi-generator with the swift6 client |
| Rust | progenitor |
| C#/.NET | NSwag or Kiota |
For any generator, point it at https://api.tholos.app/openapi.json and configure it to use Bearer token authentication.
Re-generating after API changes
Section titled “Re-generating after API changes”The OpenAPI spec is always up to date with the latest API version. To pick up new endpoints or changes, re-run your generator command. We recommend adding the generation step to your CI pipeline or as a package script:
{ "scripts": { "generate:api": "openapi-ts" }}Next steps
Section titled “Next steps”- Quickstart — make your first API call
- Authentication — learn about Personal Access Tokens
- API Reference — browse all endpoints