Browse the docs
API & SDKs

SDK reference

Official, typed clients for TypeScript, Python and Go. They wrap the REST API, share one resource model, and read your key and region from the environment.

Every SDK exposes the same resources with idiomatic naming, so a pattern you learn in one language carries to the others. They handle auth, regional routing, pagination and retries on 429, leaving you to call methods that mirror the API reference.

All three read ORTHID_SECRET_KEY and ORTHID_REGION from the environment, so initialisation is usually a single line.

TypeScript

The @orthid/sdk package is the server client. For React and Next.js front ends use @orthid/react and @orthid/nextjs instead - see the Node quickstart.

Terminal
npm install @orthid/sdk
server.ts
import { orthid } from "@orthid/sdk";

// Configured from ORTHID_SECRET_KEY and ORTHID_REGION.
const user = await orthid.users.get("user_5f3a");

const session = await orthid.sessions.verify(token);
console.log(session.actor.id);

Python

The orthid package exposes a synchronous client and an AsyncOrthID for asyncio code. Methods use snake_case to match Python conventions.

Terminal
pip install orthid
server.py
from orthid import OrthID

# Reads ORTHID_SECRET_KEY and ORTHID_REGION from the environment.
client = OrthID()

user = client.users.get("user_5f3a")

session = client.sessions.verify(token)
print(session.actor.id)

Go

The orthid-go module returns explicit errors in the Go style and takes a context.Context on every call so you can carry deadlines and cancellation.

Terminal
go get github.com/orthid/orthid-go
main.go
package main

import (
	"context"
	"fmt"

	"github.com/orthid/orthid-go"
)

func main() {
	// Reads ORTHID_SECRET_KEY and ORTHID_REGION from the environment.
	client := orthid.New()

	user, err := client.Users.Get(context.Background(), "user_5f3a")
	if err != nil {
		panic(err)
	}
	fmt.Println(user.ID)
}
Configure explicitly when you need to
Reading from the environment is the default, not the only option. Every SDK constructor also accepts an explicit secretKey and region, which is useful when one process serves more than one region.

Resource surface

The same five resources are present in every SDK. Names differ only by language casing (organizations in TypeScript and Python, Organizations in Go).

ResourceMethods
usersget, list, create, update, delete
organizationscreate, get, list, addMember, removeMember
sessionsverify, revoke, list
agentsissue, revoke, list
auditlist, export

Issuing an agent credential looks the same shape in any SDK - a person to act for, a tight scope, a short TTL and a region:

agents.ts
const agent = await orthid.agents.issue({
  onBehalfOf: "user_5f3a",
  scope: ["records:read"],
  ttl: "10m",
  region: "au-syd-1",
});
Pagination is handled for you
List methods return an async iterator (TypeScript and Python) or a paging helper (Go) that walks the cursor automatically, so you can range over every result without touching next_cursor yourself.

Next steps