TypeScript SDK
The TypeScript SDK provides a typed wrapper around the Runta REST API for TypeScript and JavaScript projects.
Requirements
Section titled “Requirements”- Node.js 18 or newer
- A Runta API token
- npm, pnpm, or yarn
Install
Section titled “Install”npm install @runta/runta-sdkConfigure
Section titled “Configure”The easiest setup is an environment variable:
export RUNTA_TOKEN="rt_your_token_here"The SDK connects to the hosted API by default:
https://api.runta.devTo use a local or custom API endpoint:
export RUNTA_ENDPOINT="http://127.0.0.1:8080"You can also pass both values directly in code:
import { Runta } from "@runta/runta-sdk";
const runta = new Runta({ token: "rt_your_token_here", endpoint: "https://api.runta.dev",});Do not commit real tokens to Git.
Configuration Order
Section titled “Configuration Order”Authentication uses the first available value from:
| Source | Key |
|---|---|
| Constructor | new Runta({ token: "rt_..." }) |
| Environment | RUNTA_TOKEN |
| Config file | token in RUNTA_CONFIG or ~/.config/runta/config.toml |
Endpoint configuration uses the first available value from:
| Source | Key |
|---|---|
| Constructor | new Runta({ endpoint: "..." }) |
| Environment | RUNTA_ENDPOINT |
| Config file | endpoint in RUNTA_CONFIG or ~/.config/runta/config.toml |
| Default | https://api.runta.dev |
Example config file:
endpoint = "https://api.runta.dev"token = "rt_your_token_here"