Skip to content

API and API keys

Teemli has a REST API: the same one its own web, desktop and mobile apps use. Scripts and integrations call it with an API key instead of a sign-in. Everything in the app’s API reference is generated from the OpenAPI 3.1 spec, so it always matches what’s live.

  • Base URL: https://api.teemli.com
  • Auth: Authorization: Bearer tml_… (an API key) or a sign-in token from Teemli’s OAuth 2.1 sign-in.
  • Your organisation’s routes live under /v1/orgs/{org}/…. GET /v1/me tells you your organisation id (organisation.id).
  1. In Teemli, open Developers (from your account menu) → API keys.
  2. Click New key, give it a name you’ll recognise later (“Reporting script”, “Zapier”), and pick its scopes (below). Optionally set an expiry (1–730 days).
  3. Copy the key. It’s shown once: Teemli stores only a fingerprint (a SHA-256 hash) of it, so nobody, including Teemli, can show it to you again. Lost it? Revoke it and make a new one.

Try it:

Terminal window
curl -s https://api.teemli.com/v1/me -H "Authorization: Bearer tml_your_key"

A personal key acts as you. It sees exactly what you see in the app and nothing more: your own agents, your tasks, the channels you’re in, the pages shared with you. It can never see a colleague’s private things or another organisation’s data. This isn’t a filter in our code alone: every request runs under the same database row-level security as the app.

Scopes narrow a key further. Give each key only what it needs:

Scope What it allows
agents:read Your agents, their conversations, tasks, memory, skills, routines, usage and activity
agents:write Edit your agents, memory, skills and routines
agents:run Send messages to your agents and start tasks. This spends AI budget.
history:read / history:write Chats you imported from ChatGPT, Claude or Grok Bot (read / delete)
tasks:read / tasks:write Projects and work items you can see / create and update them as you
chat:read / chat:write Channels and messages you can see / post, edit and react as you
docs:read / docs:write Pages and databases you can see / create and edit pages as you
meetings:read Your meeting notes and calls
webhooks:manage Create and change your outgoing webhooks
admin:read People, teams, agents (no content), spend and the activity log. Admins only

A route outside a key’s scopes answers 403. Every page of the API reference says which scope each endpoint needs.

Some things always need a person in the app and are refused for every key: approving an agent’s sensitive action (a script would turn “ask first” into “always yes”), private sign-in and saved logins, password managers, model keys and settings, connecting apps, a computer’s live view, imports, managing API keys, and deleting an account.

An admin can also make an organisation service key. Like an admin, it can’t read anyone’s private content, so it only ever gets admin:read: people, teams, agents without their content, spend and the activity log. It stops working if the admin who made it is no longer an admin.

Keys can be revoked at any time (Developers → API keys), can expire, show when they were last used, stop when their person leaves the organisation, and stop at once when an admin turns API access off (Admin → Switches; answered 403).

Each key has its own limit: 300 requests a minute by default (you can choose 1–6,000 when you create it), with bursts of up to a quarter of that. All of an organisation’s keys together share a cap of 3,000 a minute. Over a limit you get 429 Too Many Requests with a Retry-After header in seconds.

Errors are RFC 9457 application/problem+json. Branch on type, not on the human-readable title:

Status type
400 urn:teemli:problem:bad-request
401 urn:teemli:problem:unauthorized
403 urn:teemli:problem:forbidden
404 urn:teemli:problem:not-found (also for things you aren’t allowed to see: Teemli never confirms they exist)
409 urn:teemli:problem:conflict
422 urn:teemli:problem:validation
429 Too many requests (see Retry-After)
503 urn:teemli:problem:unavailable

Paging is cursor-based. List endpoints take limit (1–100, default 50) and cursor, and return {"items": [...], "next_cursor": "..." | null}. Pass next_cursor back as cursor until it’s null. Small, bounded lists return just {"items": [...]}.

Idempotency. Every write (POST, PUT, PATCH, DELETE) accepts an Idempotency-Key header: a UUID you generate. Retrying with the same key returns the original status and body (with Idempotent-Replayed: true) instead of doing the work twice. Reusing a key for a different request is 422; a duplicate sent at the same moment is 409. Keys are remembered for 24 hours.

Asynchronous work. Messages to agents return 202 Accepted with the saved message: the agent works in the background. Poll the conversation’s messages and turns, or subscribe a webhook to turn.completed and task.status.

IDs are UUIDs. Timestamps are RFC 3339 in UTC. Money is in US dollars. Every response carries an x-request-id header; include it when you contact support.

Terminal window
ORG=$(curl -s https://api.teemli.com/v1/me -H "Authorization: Bearer $TEEMLI_KEY" | jq -r .organisation.id)
# Find your agents (needs agents:read)
curl -s "https://api.teemli.com/v1/orgs/$ORG/agents" -H "Authorization: Bearer $TEEMLI_KEY"
# Start a task (needs agents:run; spends the agent's budget)
curl -s -X POST "https://api.teemli.com/v1/orgs/$ORG/tasks" \
-H "Authorization: Bearer $TEEMLI_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"agent_id": "AGENT_ID", "title": "Weekly numbers", "text": "Pull last week’s signups from the dashboard and summarise them."}'

The agent asks you in Teemli before anything sensitive (sending to other people, purchases, deletes), exactly as when you ask it in the app.

The repository includes a small typed client (api/client/, generated with openapi-typescript): typed requests, automatic idempotency keys, a TeemliError with the problem details, and verifyWebhook for webhook signatures. It will be published with the source.

The apps get live updates (streamed agent replies, status changes) over a WebSocket at wss://api.teemli.com/v1/ws, documented in api/asyncapi.yaml. It needs a sign-in token, not an API key; integrations should use webhooks instead.