Using your specs

Using your specs

While you are editing, changes stay in your browser until you create a change request. Accepting a change request publishes that snapshot so others can read it and your systems and agents can use it. Live specs stay on the previous publication until Accept. Older publications remain available if you need to look back.

Change requests

Click Create change request in the editor when you are ready. Add an optional motivation explaining why this publication should be adopted. LemmaBase.com checks your rules first; if something is wrong, the change request is rejected and you will see where the problem is. Open Change requests to review and Accept (or Close) them.

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.com for answers

Every published repository gets its own API. Your systems and agents send a request with some input values, and LemmaBase.com 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": {
"result": "200",
"number": "200",
"vetoed": false
 }
 }
 }

Authentication

Public repositories work without credentials. Private and organization-scoped repositories require a LemmaBase.com access key:

Authorization: Bearer lmb_YOUR_TOKEN

Create personal and organization access keys under Dashboard → Access Keys. Organization keys are read-only.

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.