You are reading the documentation. Use the environment link in the top navigation to switch between the production and staging docs sites.
Build against Trace Learn with the generated SDKs, direct HTTP API, CLI, or MCP surfaces. All developer surfaces use the same public OpenAPI document and the same bearer-token authentication model.
Base URL
SDKs default to production. Pass baseUrl to target a different Trace Learn API environment.
Authentication
Create an API key in Trace Learn from Organization settings - API Keys. Use it as a bearer token:
curl "https://api-staging.tracelearn.app/v1/organizations?limit=1" \
-H "Authorization: Bearer $TX_AGENT_KIT_TOKEN"
API keys are stored encrypted at rest, looked up by a SHA-256 hash, and displayed only once when created.
First API flow
Start by discovering the organization ID, then discover a team ID, then call a team-scoped operation.
export TX_AGENT_KIT_ORG_ID="$(
curl -s "https://api-staging.tracelearn.app/v1/organizations?limit=1" \
-H "Authorization: Bearer $TX_AGENT_KIT_TOKEN" |
jq -r '.data[0].id'
)"
export TX_AGENT_KIT_TEAM_ID="$(
curl -s "https://api-staging.tracelearn.app/v1/teams?organizationId=$TX_AGENT_KIT_ORG_ID&limit=1" \
-H "Authorization: Bearer $TX_AGENT_KIT_TOKEN" |
jq -r '.data[0].id'
)"
curl "https://api-staging.tracelearn.app/v1/teams/$TX_AGENT_KIT_TEAM_ID/assets?limit=10" \
-H "Authorization: Bearer $TX_AGENT_KIT_TOKEN"
The same flow through the CLI:
tx-agent-kit organizations list-organizations --fields response.data.id,response.data.name
tx-agent-kit teams list-teams --organization-id "$TX_AGENT_KIT_ORG_ID" --fields response.data.id,response.data.name
tx-agent-kit assets list-assets --team-id "$TX_AGENT_KIT_TEAM_ID" --fields response.total,response.data
TypeScript
import { TxAgentKitClient } from "@tx-agent-kit/sdk"
const txagentkit = new TxAgentKitClient({
token: process.env.TX_AGENT_KIT_TOKEN
})
const organizations = await txagentkit.organizations.listOrganizations({
query: { limit: 1 }
}) as { data: Array<{ id: string }> }
const organizationId = organizations.data[0]?.id
if (!organizationId) {
throw new Error("No organization found")
}
const teams = await txagentkit.teams.listTeams({
query: { organizationId, limit: 1 }
}) as { data: Array<{ id: string }> }
const teamId = teams.data[0]?.id
if (!teamId) {
throw new Error("No team found")
}
const assets = await txagentkit.assets.listAssets({
teamId,
query: { limit: 10 }
})
Python
import os
from tx_agent_kit_sdk import TxAgentKitClient
txagentkit = TxAgentKitClient(token=os.environ["TX_AGENT_KIT_TOKEN"])
organizations = txagentkit.organizations.list_organizations(
query={"limit": 1}
)
organization_id = organizations["data"][0]["id"]
teams = txagentkit.teams.list_teams(
query={"organizationId": organization_id, "limit": 1}
)
team_id = teams["data"][0]["id"]
assets = txagentkit.assets.list_assets(
teamId=team_id,
query={"limit": 10}
)
Errors
| Status | Meaning |
|---|
400 | Request body, query string, or path parameter is malformed. |
401 | Authorization is missing, invalid, expired, or revoked. |
403 | The token is valid but does not have permission for the resource. |
404 | The endpoint or resource was not found. |
409 | The request conflicts with existing state. |
429 | The client has exceeded a rate limit. |
5xx | Server error. Retry safe requests with exponential backoff. |