Docs
Client Libraries

API-first.
Works everywhere.

Liya Engine exposes a clean REST API — no SDK required. Use curl, fetch, httpx, or any HTTP client in any language. An OpenAPI 3.1 spec is available for code generation.

HTTP Client Examples
Stablev1

curl

bash / shell

The REST API is the primary interface for Liya Engine. Any HTTP client works — curl, Postman, or any language. Authentication uses an x-api-key header.

  • No dependencies
  • OpenAPI 3.1 spec
  • SSE streaming support
  • Postman collection available
curl https://api.liyaengine.com/v1/run \
curl -X POST https://api.liyaengine.com/v1/run \
  -H "x-api-key: $LIYA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "pack": "compliance",
    "intent": "analyze-policy",
    "input": { "document": "All employees must complete..." }
  }'
Stablefetch

Node.js

TypeScript / JavaScript

Use the native fetch API (Node 18+) or any HTTP library like axios or got. Full TypeScript support via the OpenAPI spec — generate types with openapi-typescript.

  • Native fetch (Node 18+)
  • TypeScript via openapi-typescript
  • Works in Bun, Deno, edge runtimes
  • Streaming via ReadableStream
# Uses native fetch — no dependencies needed
// Node.js 18+ native fetch — no dependencies

const response = await fetch('https://api.liyaengine.com/v1/run', {
  method: 'POST',
  headers: {
    'x-api-key': process.env.LIYA_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    pack: 'compliance',
    intent: 'analyze-policy',
    input: { document: policyText },
  }),
});

const { response: result, execution } = await response.json();

console.log(result.content);          // Validated analysis output
console.log(result.confidence);       // e.g. 0.94
console.log(result.metadata.flags);  // [] if guardrails passed
console.log(execution.latency_ms);   // e.g. 820
Stablehttpx

Python

Python 3.9+

Use httpx for async Python or requests for sync. Both libraries handle auth headers, JSON serialisation, and streaming. Pydantic models can be generated from the OpenAPI spec.

  • httpx async/await support
  • requests sync alternative
  • Pydantic via datamodel-codegen
  • FastAPI and Django compatible
pip install httpx
import httpx
import os

# Async (recommended for FastAPI / async frameworks)
async with httpx.AsyncClient() as client:
    resp = await client.post(
        "https://api.liyaengine.com/v1/run",
        headers={"x-api-key": os.environ["LIYA_API_KEY"]},
        json={
            "pack": "compliance",
            "intent": "analyze-policy",
            "input": {"document": policy_text},
        },
    )
    data = resp.json()

result = data["response"]
execution = data["execution"]

print(result["content"])          # Validated analysis output
print(result["confidence"])       # e.g. 0.94
print(execution["latency_ms"])    # e.g. 820
print(execution["agent_mode"])    # "agentic" | "single-shot"
Community

Community HTTP examples

Community-contributed request examples for other languages. All use standard HTTP — just set the x-api-key header and POST JSON.

Have an example for another language?

Contribute an example ↗