Using your specs
While you are editing, your work is a draft. Publishing freezes that draft so others can read it and your systems and agents can use it. Each time you publish, the new version becomes the current one. Older versions remain available if you need to look back.
Publishing
Click Publish in the editor when you are ready. You can add an optional message describing what changed. LemmaBase checks your rules first; if something is wrong, publish is rejected and you will see where the problem is.
Rules that change over time
A rule can have different versions for different periods. For example, a VAT rate that changed on a specific date. When you or your systems and agents ask for an answer, Lemma uses the version that was in effect at the moment you specify. The details of how to write temporal rules are on Lemma.run (opens in new tab) .
Asking LemmaBase for answers
Every published repository gets its own API. Your systems and agents send a request with some input values, and LemmaBase returns the result of applying your rules. You can also ask for the schema of a rule set (what inputs it expects) without running it.
The API docs for a repository are available in the browser on that repository’s docs page. You can also download an OpenAPI description of the API.
API reference
Each published repository is available at:
https://lemmabase.com/api/@owner_handle/repository_slug
Paths below are relative to that base.
Meta routes
-
GET /: list spec schemas active at the effective instant (?effective=optional). GET /openapi.json: OpenAPI 3.1 for the published workspace.GET /health: service health check.
Spec routes
-
GET /{spec}: schema, metadata, and temporal version boundaries for one spec. Optional?rules=comma-separated list to scope returned rules. -
POST /{spec}: evaluate the spec. Request body is a JSON object (or form-urlencoded) mapping data field names to values. Optional?rules=to limit which rule results are returned.
On spec routes, set the evaluation instant with Accept-Datetime
(RFC 7089) or ?effective=.
Input data always comes from the request body, never from query parameters.
Example
curl -X POST "https://lemmabase.com/api/@yourhandle/pricing/pricing" \
-H "Content-Type: application/json" \
-H "Accept-Datetime: 2025-01-01T00:00:00Z" \
-d '{"amount": "100"}'
A successful request returns JSON with spec, effective, data, and results:
{
"spec": "pricing",
"effective": "2025-01-01T00:00:00Z",
"results": {
"total": {
"display": "200",
"number": "200",
"vetoed": false
}
}
}
Authentication
Public repositories work without credentials. Private and organization-scoped repositories require a LemmaBase API token:
Authorization: Bearer lmb_YOUR_TOKEN
Create personal tokens under Dashboard → Settings. Organization service tokens are managed in that organization’s settings.
Errors
| Status | Meaning |
|---|---|
| 400 | Invalid request (bad spec id, evaluation error) |
| 401 | Unauthorized (private repo, no valid token) |
| 404 | Repository, publication, or spec not found |
| 422 | Failed to load published workspace |
All errors return a JSON body with an error string field.