API docs

The Monogram REST API manages projects, prompts, evaluations, and deployments. Requests use a bearer token and return JSON.

API base

http
https://api.monogramml.com/v1

Auth

Send your API key in the Authorization header for each request.

http
Authorization: Bearer your-api-key
Content-Type: application/json

Project

A project is the top-level container for related prompts and eval suites.

GET /projects

List authenticated workspace projects, sorted by last modified, newest first.

Response 200
{
  "projects": [
    {
      "id": "proj_k8fna2",
      "name": "support-triage",
      "description": "Ticket classification and priority assignment",
      "created_at": "2026-03-10T14:22:00Z",
      "updated_at": "2026-08-01T09:15:00Z"
    }
  ],
  "total": 1
}
POST /projects

Create a project.

Request body
{
  "name": "support-triage",          // required
  "description": "..."            // optional
}
Response 201
{
  "id": "proj_k8fna2",
  "name": "support-triage",
  "description": "Ticket classification and priority assignment",
  "created_at": "2026-08-05T11:30:00Z"
}
DELETE /projects/{id}

Permanently delete a project, its prompts, eval suites, and deployment history.

Response 204
// No body

Prompt

Prompts are versioned templates with typed variable schemas, each within a project.

GET /projects/{project_id}/prompts

List project prompts with version counts and last-modified timestamps.

Response 200
{
  "prompts": [
    {
      "id": "prompt_7dr3h9",
      "name": "triage-v1",
      "version_count": 4,
      "latest_version": "2026-07-30T08:12:00Z"
    }
  ]
}
POST /projects/{project_id}/prompts

Create a prompt with its first version.

Request body
{
  "name": "triage-v1",
  "template": "Classify {{ticket_text}} as P0, P1, or P2.",
  "variables": {
    "ticket_text": "string"
  },
  "message": "initial version"
}
POST /prompts/{id}/versions

Add a version to an existing prompt. It becomes active for deploy operations.

Request body
{
  "template": "Updated template text here {{ticket_text}}",
  "variables": { "ticket_text": "string" },
  "message": "tighten classification criteria"
}

Eval suites

An eval suite contains test cases and scoring criteria. Running it on a prompt version returns a scored result.

POST /evals/suites

Create an eval suite with test cases and a rubric.

Request body
{
  "project_id": "proj_k8fna2",
  "name": "priority-accuracy",
  "rubric": "Parsed priority must match expected_priority exactly",
  "cases": [
    {
      "inputs": { "ticket_text": "Production down" },
      "expected_priority": "P0"
    }
  ]
}
POST /evals/runs

Run an eval suite on a prompt version. Returns a run ID; poll /evals/runs/{id} for results.

Request body
{
  "suite_id": "suite_9mx2k4",
  "prompt_id": "prompt_7dr3h9",
  "model": "openai/gpt-4o"
}
Response 202
{
  "run_id": "run_4bc7n1",
  "status": "queued"
}
GET /evals/runs/{id}

Get an eval run's status and results. status moves from queued to running to pass or fail.

Response 200
{
  "run_id": "run_4bc7n1",
  "status": "pass",
  "score": 0.94,
  "cases": [
    {
      "case_index": 0,
      "pass": true,
      "output": "{\"priority\": \"P0\", \"reason\": \"...\"}"
    }
  ],
  "completed_at": "2026-08-05T11:38:44Z"
}

Deploys

A deployment sends a prompt version to a target endpoint, optionally behind an eval gate.

POST /deployments

Deploy a prompt version. With eval_suite_id, check the eval gate first, and proceed only after a passing run.

Request body
{
  "prompt_id": "prompt_7dr3h9",
  "eval_suite_id": "suite_9mx2k4",   // optional gate
  "target": "monogram-endpoint",
  "rollout_pct": 10
}
Response 201
{
  "id": "dep_2qt9m7",
  "status": "deploying",
  "endpoint": "https://api.monogramml.com/v1/infer/dep_2qt9m7"
}
POST /infer/{deployment_id}

Invoke a live deployment: send prompt variable values in the request body and receive model output.

Request body
{
  "variables": {
    "ticket_text": "Login is broken for all EU users"
  }
}
Response 200
{
  "output": "{\"priority\": \"P0\", \"reason\": \"Regional auth outage\"}",
  "latency_ms": 340,
  "model": "openai/gpt-4o"
}

API errors

Status Code Meaning
400 invalid_request Malformed request body or missing required field.
401 unauthorized Missing or invalid API key.
403 forbidden Your plan does not include access to this resource.
404 not_found The requested resource does not exist.
429 rate_limited Too many requests. Back off and retry after the Retry-After header value.
500 server_error Unexpected server error. Contact support if it persists.

Limits

API rate limits apply per API key. Response headers contain:

  • X-RateLimit-Limit - requests per 60 seconds for your plan
  • X-RateLimit-Remaining - requests remaining in the current window
  • X-RateLimit-Reset - Unix timestamp when the window resets

Free: 60 requests/min. Pro: 300 requests/min. Team: 1000 requests/min.