Skip to main content

API Overview

The Erna API provides two integration levels for staff scheduling:

Natural-language scheduling

POST /v1/schedules — describe what you need in plain English, and the API generates a schedule using AI-powered code generation and constraint solving. This is an asynchronous workflow:
  1. Submit scheduling instructions, employees, and a time horizon
  2. Receive a job ID
  3. Poll GET /v1/schedules/jobs/ until the schedule is ready
# Create a schedule
curl -X POST https://api.erna.ai/v1/schedules \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "instructions": [
      "2 servers during lunch (11am-2pm) every day",
      "1 server for dinner (5pm-10pm) every day"
    ],
    "timeHorizon": { "start": "2026-02-09", "end": "2026-02-15" },
    "employees": [
      { "id": "alice", "name": "Alice", "roleIds": ["server"] },
      { "id": "bob", "name": "Bob", "roleIds": ["server"] },
      { "id": "carol", "name": "Carol", "roleIds": ["server"] }
    ],
    "roles": [{ "id": "server", "name": "Server" }]
  }'

# Poll for the result
curl https://api.erna.ai/v1/schedules/jobs/$JOB_ID \
  -H "Authorization: Bearer $TOKEN"

Direct solver access

POST /v1/solver/solve — submit a pre-compiled CP-SAT constraint model and get the solution synchronously. Use this when you build the model yourself with the dabke library.
curl -X POST https://api.erna.ai/v1/solver/solve \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "variables": [...], "constraints": [...] }'

Base URL

https://api.erna.ai

Errors

All error responses follow a consistent format:
{
  "error": "Human-readable error message",
  "details": [
    { "path": "employees.0.roleIds", "message": "Array must contain at least 1 element(s)" }
  ]
}
StatusMeaning
400Invalid request body
401Missing or invalid authentication
402Insufficient credits
403Missing required scope
404Resource not found
502Upstream solver error