Skip to main content
The Leme API lets your systems do what you already do in the dashboard: put an agent to work. You send an instruction, the agent runs with the same permissions, approvals, and tools it always has, and you collect the result — by polling or by webhook. There are two ways to activate an agent from the outside:

Runs API

Full programmatic control: create a run per request, choose the instruction, follow the status, cancel, and receive completion webhooks.

Webhook trigger

A dedicated URL for external tools. The instruction is fixed on the trigger; every accepted event becomes a run.
Use the Runs API when your code decides what the agent should do on each call. Use a webhook trigger when the sender is an external tool (a form, Stripe, Zapier) and the instruction never changes.

Authentication

Every API request is authenticated with an API token. Create one in the Leme dashboard under Settings → API tokens.
Tokens are scoped to a project and have a mode: read_only tokens can check statuses and list runs; creating or canceling runs requires a read_write token. The token is shown once at creation — store it in your secret manager.
Treat the token like a password. Anyone holding it can act on your project within the token’s mode. Revoke it in the dashboard if it leaks.

Runs are asynchronous

Agent work takes seconds to minutes, so the API never blocks waiting for it. Creating a run returns 202 Accepted immediately with a run resource you can follow:
Follow the run by polling GET /api/v1/runs/:id, or register a callbackUrl and let Leme notify you — see Completion webhooks.

Idempotency

Network calls fail and get retried. To make retries safe, send an Idempotency-Key header with every POST:
Repeating the same key with the same body returns the original response instead of creating a second run. The same key with a different body returns 409 idempotency_conflict. Keys are remembered for 24 hours.

Errors

Errors always use the same envelope, with a stable machine-readable code:
Handle errors by code, not by message — messages may change, codes will not.

Rate limits

Requests over a limit return 429 with a retry-after header telling you how long to wait.

OpenAPI

The full machine-readable specification is available at GET https://app.leme.ai/api/openapi — use it to generate clients or import the API into your tooling.