{ "openapi": "3.1.0", "info": { "title": "LangWatch API", "version": "1.0.0", "description": "LangWatch openapi spec" }, "servers": [ { "url": "https://app.langwatch.ai" } ], "security": [ { "project_api_key": [] } ], "paths": { "/": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "handle": { "type": [ "string", "null" ] }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ] }, "name": { "type": "string" }, "updatedAt": { "type": "string" }, "projectId": { "type": "string" }, "organizationId": { "type": "string" }, "version": { "type": "number" }, "versionId": { "type": "string" }, "versionCreatedAt": { "type": "string" }, "model": { "type": "string" }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] } }, "response_format": { "type": [ "object", "null" ], "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": "object", "properties": { "name": { "type": "string" }, "schema": { "type": "object" } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] } }, "required": [ "id", "handle", "scope", "name", "updatedAt", "projectId", "organizationId", "version", "versionId", "versionCreatedAt", "model", "prompt", "messages", "response_format" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getIndex", "parameters": [], "description": "Get all prompts for a project" }, "post": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "handle": { "type": [ "string", "null" ] }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ] }, "name": { "type": "string" }, "updatedAt": { "type": "string" }, "projectId": { "type": "string" }, "organizationId": { "type": "string" }, "version": { "type": "number" }, "versionId": { "type": "string" }, "versionCreatedAt": { "type": "string" }, "model": { "type": "string" }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] } }, "response_format": { "type": [ "object", "null" ], "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": "object", "properties": { "name": { "type": "string" }, "schema": { "type": "object" } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] } }, "required": [ "id", "handle", "scope", "name", "updatedAt", "projectId", "organizationId", "version", "versionId", "versionCreatedAt", "model", "prompt", "messages", "response_format" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postIndex", "parameters": [], "description": "Create a new prompt with default initial version", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "handle": { "type": "string", "pattern": "^[a-z0-9_-]+(?:\\/[a-z0-9_-]+)?$" }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ], "default": "PROJECT" }, "authorId": { "type": "string" }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] } }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list[str]", "list[float]", "list[int]", "list[bool]", "dict" ] } }, "required": [ "identifier", "type" ] } }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] } } }, "required": [ "handle" ] } } } } } }, "/api/agents": { "get": { "responses": {}, "operationId": "getApiAgents", "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "exclusiveMinimum": 0, "default": 1 } }, { "in": "query", "name": "limit", "schema": { "type": "integer", "exclusiveMinimum": 0, "maximum": 1000, "default": 50 } } ], "description": "List all non-archived agents for the project (paginated)" }, "post": { "responses": {}, "operationId": "postApiAgents", "parameters": [], "description": "Create a new agent", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "type": { "type": "string", "enum": [ "signature", "code", "workflow", "http" ] }, "config": { "type": "object", "additionalProperties": {} }, "workflowId": { "type": "string" } }, "required": [ "name", "type", "config" ] } } } } } }, "/api/agents/{id}": { "get": { "responses": {}, "operationId": "getApiAgentsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Get an agent by its id" }, "patch": { "responses": {}, "operationId": "patchApiAgentsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update an agent by its id", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "type": { "type": "string", "enum": [ "signature", "code", "workflow", "http" ] }, "config": { "type": "object", "additionalProperties": {} }, "workflowId": { "type": [ "string", "null" ] } } } } } } }, "delete": { "responses": {}, "operationId": "deleteApiAgentsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Archive an agent (soft-delete)" } }, "/api/analytics/timeseries": { "post": { "responses": { "200": { "description": "Timeseries analytics data with current and previous periods", "content": { "application/json": { "schema": { "type": "object", "properties": { "currentPeriod": { "type": "array", "items": { "type": "object", "additionalProperties": {} } }, "previousPeriod": { "type": "array", "items": { "type": "object", "additionalProperties": {} } } }, "required": [ "currentPeriod", "previousPeriod" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiAnalyticsTimeseries", "parameters": [], "description": "Query analytics timeseries data with metrics, aggregations, and filters", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "startDate": { "anyOf": [ { "type": "number" }, { "type": "string" } ] }, "endDate": { "anyOf": [ { "type": "number" }, { "type": "string" } ] }, "query": { "type": "string" }, "filters": { "type": "object", "properties": { "topics.topics": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "topics.subtopics": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.user_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.thread_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.customer_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.labels": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.key": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.value": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.prompt_ids": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "traces.origin": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "traces.error": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "traces.name": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "spans.type": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "spans.model": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.guardrails_only": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.has_passed": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.has_score": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.has_label": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.passed": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.score": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.state": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.label": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.event_type": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.metrics.key": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.metrics.value": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.event_details.key": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "annotations.hasAnnotation": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] } }, "additionalProperties": false, "default": {} }, "traceIds": { "type": "array", "items": { "type": "string" } }, "negateFilters": { "type": "boolean" }, "series": { "type": "array", "items": { "type": "object", "properties": { "metric": { "type": "string", "enum": [ "metadata.trace_id", "metadata.user_id", "metadata.thread_id", "metadata.span_type", "sentiment.thumbs_up_down", "performance.completion_time", "performance.first_token", "performance.total_cost", "performance.prompt_tokens", "performance.completion_tokens", "performance.total_tokens", "performance.tokens_per_second", "events.event_type", "events.event_score", "events.event_details", "evaluations.evaluation_score", "evaluations.evaluation_pass_rate", "evaluations.evaluation_runs", "threads.average_duration_per_thread" ] }, "key": { "type": "string" }, "subkey": { "type": "string" }, "aggregation": { "type": "string", "enum": [ "terms", "cardinality", "avg", "sum", "min", "max", "median", "p99", "p95", "p90" ] }, "pipeline": { "type": "object", "properties": { "field": { "type": "string", "enum": [ "trace_id", "user_id", "thread_id", "customer_id" ] }, "aggregation": { "type": "string", "enum": [ "sum", "avg", "min", "max" ] } }, "required": [ "field", "aggregation" ] }, "filters": { "type": "object", "properties": { "topics.topics": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "topics.subtopics": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.user_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.thread_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.customer_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.labels": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.key": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.value": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.prompt_ids": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "traces.origin": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "traces.error": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "traces.name": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "spans.type": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "spans.model": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.guardrails_only": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.has_passed": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.has_score": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.has_label": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.passed": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.score": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.state": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.label": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.event_type": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.metrics.key": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.metrics.value": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.event_details.key": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "annotations.hasAnnotation": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] } }, "additionalProperties": false }, "asPercent": { "type": "boolean" } }, "required": [ "metric", "aggregation" ] } }, "groupBy": { "type": "string", "enum": [ "topics.topics", "traces.trace_name", "metadata.user_id", "metadata.thread_id", "metadata.customer_id", "metadata.labels", "metadata.model", "metadata.span_type", "sentiment.thumbs_up_down", "events.event_type", "evaluations.evaluation_passed", "evaluations.evaluation_label", "evaluations.evaluation_processing_state", "error.has_error" ] }, "groupByKey": { "type": "string" }, "timeScale": { "anyOf": [ { "type": "string", "const": "full" }, { "type": "integer" } ] }, "timeZone": { "type": "string" } }, "required": [ "startDate", "endDate", "series", "timeZone" ] } } } } } }, "/api/annotations": { "get": { "description": "Returns all annotations for project", "responses": { "200": { "description": "Annotation response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Annotation" } } } } }, "400": { "description": "Unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/annotations/trace/{id}": { "get": { "description": "Returns all annotations for single trace", "parameters": [ { "name": "id", "in": "path", "description": "ID of trace to fetch", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Annotation response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Annotation" } } } } }, "400": { "description": "Unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "post": { "description": "Create an annotation for a single trace", "parameters": [ { "name": "id", "in": "path", "description": "ID of the trace to annotate", "required": true, "schema": { "type": "string" } } ], "requestBody": { "description": "Annotation data", "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "comment": { "type": "string" }, "isThumbsUp": { "type": "boolean" }, "email": { "type": "string" } } } } } }, "responses": { "200": { "description": "Annotation created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Annotation" } } } }, "400": { "description": "Invalid input", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/annotations/{id}": { "get": { "description": "Returns a single annotation based on the ID supplied", "parameters": [ { "name": "id", "in": "path", "description": "ID of annotation to fetch", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Annotation response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Annotation" } } } }, "400": { "description": "Unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "delete": { "description": "Deletes a single annotation based on the ID supplied", "parameters": [ { "name": "id", "in": "path", "description": "ID of annotation to delete", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Annotation response", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string" }, "message": { "type": "string" } } } } } }, "400": { "description": "Unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } }, "patch": { "description": "Updates a single annotation based on the ID supplied", "parameters": [ { "name": "id", "in": "path", "description": "ID of annotation to delete", "required": true, "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "comment": { "type": "string" }, "isThumbsUp": { "type": "boolean" }, "email": { "type": "string" } } } } } }, "responses": { "200": { "description": "Annotation response", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string" }, "message": { "type": "string" } } } } } }, "400": { "description": "Unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/api-keys": { "get": { "operationId": "listApiKeys", "summary": "List API keys", "description": "List all API keys owned by the authenticated user in this organization. Requires organization:view permission.", "security": [ { "admin_api_key": [] } ], "responses": { "200": { "description": "List of API keys", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/ApiKeyInfo" } } } } } } }, "401": { "description": "Invalid or missing API key token" }, "403": { "description": "Insufficient permissions (requires organization:view)" } } }, "post": { "operationId": "createApiKey", "summary": "Create an API key", "description": "Create a new API key. For service keys, pass keyType:\"service\". Optionally scope to specific projects via projectIds (ADMIN on each). Omit projectIds for full org access. The plaintext token is returned once — store it securely.", "security": [ { "admin_api_key": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 100, "description": "Human-readable name for this token" }, "description": { "type": "string", "maxLength": 500, "description": "Optional description" }, "expiresAt": { "type": "string", "format": "date-time", "description": "Optional expiration date (ISO 8601)" }, "bindings": { "type": "array", "minItems": 1, "maxItems": 20, "description": "Role bindings that define what this token can access", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "ADMIN", "MEMBER", "VIEWER" ], "description": "Role to grant" }, "scopeType": { "type": "string", "enum": [ "ORGANIZATION", "TEAM", "PROJECT" ], "description": "Scope level" }, "scopeId": { "type": "string", "description": "ID of the organization, team, or project" } }, "required": [ "role", "scopeType", "scopeId" ] } }, "keyType": { "type": "string", "enum": [ "personal", "service" ], "default": "personal", "description": "personal = tied to a user. service = not tied to any user, for automation." }, "projectIds": { "type": "array", "items": { "type": "string" }, "maxItems": 50, "description": "For service keys with restricted scope: list of project IDs to grant ADMIN access to. Omit for full org access." } }, "required": [ "name", "bindings" ] } } } }, "responses": { "201": { "description": "API key created. The token field contains the plaintext key — it is only shown once.", "content": { "application/json": { "schema": { "type": "object", "properties": { "token": { "type": "string", "description": "Plaintext API key token (sk-lw-...). Store securely — shown only once." }, "apiKey": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" } } } } } } } }, "401": { "description": "Invalid or missing API key token" }, "403": { "description": "Requested binding exceeds the creator's own permissions, or scope does not belong to this organization" }, "422": { "description": "Validation error (missing name, empty bindings, etc.)" } } } }, "/api/api-keys/{id}": { "delete": { "operationId": "revokeApiKey", "summary": "Revoke an API key", "description": "Revoke (soft-delete) an API key. Revoked keys can no longer authenticate. Requires organization:manage permission.", "security": [ { "admin_api_key": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "API key ID" } ], "responses": { "200": { "description": "API key revoked successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } } } } } }, "401": { "description": "Invalid or missing API key token" }, "403": { "description": "Not authorized to revoke this API key (owned by another user)" }, "404": { "description": "API key not found" }, "409": { "description": "API key is already revoked" } } } }, "/api/dashboards": { "get": { "responses": {}, "operationId": "getApiDashboards", "parameters": [], "description": "List all dashboards for the project with graph counts" }, "post": { "responses": {}, "operationId": "postApiDashboards", "parameters": [], "description": "Create a new dashboard", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 255 } }, "required": [ "name" ] } } } } } }, "/api/dashboards/reorder": { "put": { "responses": {}, "operationId": "putApiDashboardsReorder", "parameters": [], "description": "Reorder dashboards by providing an ordered list of IDs", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "dashboardIds": { "type": "array", "items": { "type": "string", "minLength": 1 }, "minItems": 1 } }, "required": [ "dashboardIds" ] } } } } } }, "/api/dashboards/{id}": { "get": { "responses": {}, "operationId": "getApiDashboardsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Get a dashboard by its id, including its graphs" }, "patch": { "responses": {}, "operationId": "patchApiDashboardsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Rename a dashboard", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 255 } }, "required": [ "name" ] } } } } }, "delete": { "responses": {}, "operationId": "deleteApiDashboardsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Delete a dashboard and its graphs (hard delete, cascade)" } }, "/api/dataset": { "get": { "responses": {}, "operationId": "getApiDataset", "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "exclusiveMinimum": 0, "default": 1 } }, { "in": "query", "name": "limit", "schema": { "type": "integer", "exclusiveMinimum": 0, "maximum": 1000, "default": 50 } } ], "description": "List all non-archived datasets for the project (paginated)" }, "post": { "responses": {}, "operationId": "postApiDataset", "parameters": [], "description": "Create a new dataset", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] }, "default": [] } }, "required": [ "name" ] } } } } } }, "/api/dataset/upload": { "post": { "responses": {}, "operationId": "postApiDatasetUpload", "parameters": [], "description": "Create a new dataset from an uploaded file (CSV, JSON, JSONL)" } }, "/api/dataset/{slugOrId}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "datasetId": { "type": "string" }, "projectId": { "type": "string" }, "entry": { "type": "object", "additionalProperties": {} }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "datasetId", "projectId", "entry", "createdAt", "updatedAt" ] } } }, "required": [ "data" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Dataset not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiDatasetBySlugOrId", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "slugOrId", "required": true } ], "description": "Get a dataset by its slug or id." }, "patch": { "responses": {}, "operationId": "patchApiDatasetBySlugOrId", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "slugOrId", "required": true } ], "description": "Update a dataset by its slug or id", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } } } } } } }, "delete": { "responses": {}, "operationId": "deleteApiDatasetBySlugOrId", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "slugOrId", "required": true } ], "description": "Archive a dataset (soft-delete)" } }, "/api/dataset/{slugOrId}/records": { "post": { "responses": {}, "operationId": "postApiDatasetBySlugOrIdRecords", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "slugOrId", "required": true } ], "description": "Create records in a dataset in batch", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "entries": { "type": "array", "items": { "type": "object", "additionalProperties": {} }, "minItems": 1, "maxItems": 1000 } }, "required": [ "entries" ] } } } } }, "get": { "responses": {}, "operationId": "getApiDatasetBySlugOrIdRecords", "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "exclusiveMinimum": 0, "default": 1 } }, { "in": "query", "name": "limit", "schema": { "type": "integer", "exclusiveMinimum": 0, "maximum": 1000, "default": 50 } }, { "schema": { "type": "string" }, "in": "path", "name": "slugOrId", "required": true } ], "description": "List records for a dataset (paginated)" }, "delete": { "responses": {}, "operationId": "deleteApiDatasetBySlugOrIdRecords", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "slugOrId", "required": true } ], "description": "Delete records from a dataset by IDs", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "recordIds": { "type": "array", "items": { "type": "string" }, "minItems": 1, "maxItems": 1000 } }, "required": [ "recordIds" ] } } } } } }, "/api/dataset/{slugOrId}/records/{recordId}": { "patch": { "responses": {}, "operationId": "patchApiDatasetBySlugOrIdRecordsByRecordId", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "slugOrId", "required": true }, { "schema": { "type": "string" }, "in": "path", "name": "recordId", "required": true } ], "description": "Update or create a record in a dataset", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "entry": { "type": "object", "additionalProperties": {} } }, "required": [ "entry" ] } } } } } }, "/api/dataset/{slugOrId}/upload": { "post": { "responses": {}, "operationId": "postApiDatasetBySlugOrIdUpload", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "slugOrId", "required": true } ], "description": "Upload a file (CSV, JSON, JSONL) to an existing dataset" } }, "/api/dataset/{slug}/entries": { "post": { "responses": {}, "operationId": "postApiDatasetBySlugEntries", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "slug", "required": true } ], "description": "Add entries to a dataset", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DatasetPostEntries" } } } } } }, "/api/experiments/runs/{runId}": { "get": { "description": "Get the current status of an evaluation run for polling. Returns progress while running, and summary when completed.", "operationId": "getEvaluationsV3RunStatus", "tags": [ "Evaluations V3" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "runId", "required": true, "description": "The run ID returned from POST /api/experiments/{slug}/run" } ], "responses": { "200": { "description": "Run status", "content": { "application/json": { "schema": { "type": "object", "properties": { "runId": { "type": "string" }, "status": { "type": "string", "enum": [ "pending", "running", "completed", "failed", "stopped" ] }, "progress": { "type": "integer", "description": "Number of cells completed" }, "total": { "type": "integer", "description": "Total number of cells" }, "startedAt": { "type": "integer", "description": "Unix timestamp when run started" }, "finishedAt": { "type": "integer", "description": "Unix timestamp when run finished (only present when completed/failed/stopped)" }, "summary": { "type": "object", "description": "Execution summary (only present when completed)", "properties": { "runId": { "type": "string" }, "totalCells": { "type": "integer" }, "completedCells": { "type": "integer" }, "failedCells": { "type": "integer" }, "duration": { "type": "integer", "description": "Total execution time in milliseconds" }, "runUrl": { "type": "string", "description": "URL to view the run in LangWatch" } } }, "error": { "type": "string", "description": "Error message (only present when failed)" } }, "required": [ "runId", "status", "progress", "total" ] } } } }, "401": { "description": "Unauthorized - Missing or invalid API key", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Run not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } } } } }, "/api/experiments/{slug}/run": { "post": { "description": "Start execution of a saved Evaluations V3 experiment by slug. Returns immediately with a runId for polling, or streams SSE events if Accept: text/event-stream header is provided.", "operationId": "postEvaluationsV3Run", "tags": [ "Evaluations V3" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "slug", "required": true, "description": "The slug of the evaluation to run" } ], "responses": { "200": { "description": "Run started successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "runId": { "type": "string", "description": "Unique identifier for this run" }, "status": { "type": "string", "enum": [ "running" ], "description": "Initial status of the run" }, "total": { "type": "integer", "description": "Total number of cells to execute" }, "runUrl": { "type": "string", "description": "URL to view the run in LangWatch" } }, "required": [ "runId", "status", "total" ] } }, "text/event-stream": { "schema": { "type": "string", "description": "Server-sent events stream with execution progress" } } } }, "401": { "description": "Unauthorized - Missing or invalid API key", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Evaluation not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } } } } }, "/api/evaluators": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": [ "string", "null" ] }, "type": { "type": "string" }, "config": { "type": [ "object", "null" ], "additionalProperties": {} }, "workflowId": { "type": [ "string", "null" ] }, "copiedFromEvaluatorId": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "fields": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string" }, "type": { "type": "string" }, "optional": { "type": "boolean" } }, "required": [ "identifier", "type" ] } }, "outputFields": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string" }, "type": { "type": "string" }, "optional": { "type": "boolean" } }, "required": [ "identifier", "type" ] } }, "workflowName": { "type": "string" }, "workflowIcon": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "projectId", "name", "slug", "type", "config", "workflowId", "copiedFromEvaluatorId", "createdAt", "updatedAt", "fields", "outputFields", "platformUrl" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiEvaluators", "parameters": [], "description": "Get all evaluators for a project" }, "post": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": [ "string", "null" ] }, "type": { "type": "string" }, "config": { "type": [ "object", "null" ], "additionalProperties": {} }, "workflowId": { "type": [ "string", "null" ] }, "copiedFromEvaluatorId": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "fields": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string" }, "type": { "type": "string" }, "optional": { "type": "boolean" } }, "required": [ "identifier", "type" ] } }, "outputFields": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string" }, "type": { "type": "string" }, "optional": { "type": "boolean" } }, "required": [ "identifier", "type" ] } }, "workflowName": { "type": "string" }, "workflowIcon": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "projectId", "name", "slug", "type", "config", "workflowId", "copiedFromEvaluatorId", "createdAt", "updatedAt", "fields", "outputFields", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiEvaluators", "parameters": [], "description": "Create a new evaluator", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "config": { "type": "object", "additionalProperties": {} } }, "required": [ "name", "config" ] } } } } } }, "/api/evaluators/{idOrSlug}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": [ "string", "null" ] }, "type": { "type": "string" }, "config": { "type": [ "object", "null" ], "additionalProperties": {} }, "workflowId": { "type": [ "string", "null" ] }, "copiedFromEvaluatorId": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "fields": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string" }, "type": { "type": "string" }, "optional": { "type": "boolean" } }, "required": [ "identifier", "type" ] } }, "outputFields": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string" }, "type": { "type": "string" }, "optional": { "type": "boolean" } }, "required": [ "identifier", "type" ] } }, "workflowName": { "type": "string" }, "workflowIcon": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "projectId", "name", "slug", "type", "config", "workflowId", "copiedFromEvaluatorId", "createdAt", "updatedAt", "fields", "outputFields", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Evaluator not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiEvaluatorsByIdOrSlug", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "idOrSlug", "required": true } ], "description": "Get a specific evaluator by ID or slug" } }, "/api/evaluators/{id}": { "put": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": [ "string", "null" ] }, "type": { "type": "string" }, "config": { "type": [ "object", "null" ], "additionalProperties": {} }, "workflowId": { "type": [ "string", "null" ] }, "copiedFromEvaluatorId": { "type": [ "string", "null" ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "fields": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string" }, "type": { "type": "string" }, "optional": { "type": "boolean" } }, "required": [ "identifier", "type" ] } }, "outputFields": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string" }, "type": { "type": "string" }, "optional": { "type": "boolean" } }, "required": [ "identifier", "type" ] } }, "workflowName": { "type": "string" }, "workflowIcon": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "projectId", "name", "slug", "type", "config", "workflowId", "copiedFromEvaluatorId", "createdAt", "updatedAt", "fields", "outputFields", "platformUrl" ] } } } }, "400": { "description": "Bad request (e.g. attempting to change evaluatorType)", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Evaluator not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "putApiEvaluatorsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update an existing evaluator", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "config": { "type": "object", "additionalProperties": {} } } } } } } }, "delete": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } }, "required": [ "success" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Evaluator not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiEvaluatorsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Archive (soft-delete) an evaluator" } }, "/api/gateway/v1/budgets": { "get": { "responses": { "200": { "description": "Applicable budgets", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "organization_id": { "type": "string" }, "scope_type": { "type": "string" }, "scope_id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "window": { "type": "string" }, "on_breach": { "type": "string", "enum": [ "BLOCK", "WARN" ] }, "limit_usd": { "type": "string" }, "spent_usd": { "type": "string" }, "resets_at": { "type": "string" }, "archived_at": { "type": [ "string", "null" ] } }, "required": [ "id", "organization_id", "scope_type", "scope_id", "name", "description", "window", "on_breach", "limit_usd", "spent_usd", "resets_at", "archived_at" ] } } }, "required": [ "data" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiGatewayV1Budgets", "tags": [ "Budgets" ], "parameters": [], "summary": "List budgets applicable to the project", "description": "Returns every budget that could apply to requests routed through this project — org, team, and project scope. VK and principal-scoped budgets are returned via their detail pages." }, "post": { "responses": { "201": { "description": "Budget created", "content": { "application/json": { "schema": { "type": "object", "properties": { "budget": { "type": "object", "properties": { "id": { "type": "string" }, "organization_id": { "type": "string" }, "scope_type": { "type": "string" }, "scope_id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "window": { "type": "string" }, "on_breach": { "type": "string", "enum": [ "BLOCK", "WARN" ] }, "limit_usd": { "type": "string" }, "spent_usd": { "type": "string" }, "resets_at": { "type": "string" }, "archived_at": { "type": [ "string", "null" ] } }, "required": [ "id", "organization_id", "scope_type", "scope_id", "name", "description", "window", "on_breach", "limit_usd", "spent_usd", "resets_at", "archived_at" ] } }, "required": [ "budget" ] } } } }, "400": { "description": "Validation error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "type": { "type": "string" }, "code": { "type": "string" }, "message": { "type": "string" } }, "required": [ "type", "code", "message" ] } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiGatewayV1Budgets", "tags": [ "Budgets" ], "parameters": [], "summary": "Create budget", "description": "Creates an organization-owned budget. The scope discriminates which resource the budget covers (organization / team / project / virtual_key / principal)." } }, "/api/gateway/v1/budgets/{id}": { "patch": { "responses": { "200": { "description": "Updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "budget": { "type": "object", "properties": { "id": { "type": "string" }, "organization_id": { "type": "string" }, "scope_type": { "type": "string" }, "scope_id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "window": { "type": "string" }, "on_breach": { "type": "string", "enum": [ "BLOCK", "WARN" ] }, "limit_usd": { "type": "string" }, "spent_usd": { "type": "string" }, "resets_at": { "type": "string" }, "archived_at": { "type": [ "string", "null" ] } }, "required": [ "id", "organization_id", "scope_type", "scope_id", "name", "description", "window", "on_breach", "limit_usd", "spent_usd", "resets_at", "archived_at" ] } }, "required": [ "budget" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "patchApiGatewayV1BudgetsById", "tags": [ "Budgets" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Update budget", "description": "Partial update — scope and window are immutable after create. Use explicit null to clear timezone / description." }, "delete": { "responses": { "200": { "description": "Archived", "content": { "application/json": { "schema": { "type": "object", "properties": { "budget": { "type": "object", "properties": { "id": { "type": "string" }, "organization_id": { "type": "string" }, "scope_type": { "type": "string" }, "scope_id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "window": { "type": "string" }, "on_breach": { "type": "string", "enum": [ "BLOCK", "WARN" ] }, "limit_usd": { "type": "string" }, "spent_usd": { "type": "string" }, "resets_at": { "type": "string" }, "archived_at": { "type": [ "string", "null" ] } }, "required": [ "id", "organization_id", "scope_type", "scope_id", "name", "description", "window", "on_breach", "limit_usd", "spent_usd", "resets_at", "archived_at" ] } }, "required": [ "budget" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiGatewayV1BudgetsById", "tags": [ "Budgets" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Archive budget", "description": "Soft-delete — the row is marked archived and no longer counted by the budget engine. Historical ledger entries are retained." } }, "/api/gateway/v1/cache-rules": { "get": { "responses": { "200": { "description": "Cache rules for the organisation", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "organization_id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "priority": { "type": "integer" }, "enabled": { "type": "boolean" }, "matchers": { "type": "object", "additionalProperties": {} }, "action": { "type": "object", "properties": { "mode": { "type": "string", "enum": [ "respect", "force", "disable" ] }, "ttl": { "type": "integer" }, "salt": { "type": "string" } }, "required": [ "mode" ] }, "mode_enum": { "type": "string", "enum": [ "RESPECT", "FORCE", "DISABLE" ] }, "archived_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "organization_id", "name", "description", "priority", "enabled", "matchers", "action", "mode_enum", "archived_at", "created_at", "updated_at" ] } } }, "required": [ "data" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiGatewayV1Cache-rules", "tags": [ "Cache Rules" ], "parameters": [], "summary": "List cache-control rules", "description": "Organization-scoped operator-authored rules. Returned sorted priority DESC; archived rules excluded. Matchers and action are returned verbatim as JSON." }, "post": { "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "type": "object", "properties": { "cache_rule": { "type": "object", "properties": { "id": { "type": "string" }, "organization_id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "priority": { "type": "integer" }, "enabled": { "type": "boolean" }, "matchers": { "type": "object", "additionalProperties": {} }, "action": { "type": "object", "properties": { "mode": { "type": "string", "enum": [ "respect", "force", "disable" ] }, "ttl": { "type": "integer" }, "salt": { "type": "string" } }, "required": [ "mode" ] }, "mode_enum": { "type": "string", "enum": [ "RESPECT", "FORCE", "DISABLE" ] }, "archived_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "organization_id", "name", "description", "priority", "enabled", "matchers", "action", "mode_enum", "archived_at", "created_at", "updated_at" ] } }, "required": [ "cache_rule" ] } } } }, "400": { "description": "Validation error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "type": { "type": "string" }, "code": { "type": "string" }, "message": { "type": "string" } }, "required": [ "type", "code", "message" ] } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiGatewayV1Cache-rules", "tags": [ "Cache Rules" ], "parameters": [], "summary": "Create a cache rule", "description": "Matchers are ANDed across non-null fields; at least one matcher is required. Mode is one of respect/force/disable. TTL is clamped to [0, 86400]. Salt is an optional cache-bust tag (max 64 chars). All writes emit a ChangeEvent so the gateway picks up the new rule within 30 s via its /changes long-poll." } }, "/api/gateway/v1/cache-rules/{id}": { "get": { "responses": { "200": { "description": "The rule", "content": { "application/json": { "schema": { "type": "object", "properties": { "cache_rule": { "type": "object", "properties": { "id": { "type": "string" }, "organization_id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "priority": { "type": "integer" }, "enabled": { "type": "boolean" }, "matchers": { "type": "object", "additionalProperties": {} }, "action": { "type": "object", "properties": { "mode": { "type": "string", "enum": [ "respect", "force", "disable" ] }, "ttl": { "type": "integer" }, "salt": { "type": "string" } }, "required": [ "mode" ] }, "mode_enum": { "type": "string", "enum": [ "RESPECT", "FORCE", "DISABLE" ] }, "archived_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "organization_id", "name", "description", "priority", "enabled", "matchers", "action", "mode_enum", "archived_at", "created_at", "updated_at" ] } }, "required": [ "cache_rule" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiGatewayV1Cache-rulesById", "tags": [ "Cache Rules" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Get a cache rule", "description": "Returns the rule if it belongs to the caller's organisation; 404 otherwise. Archived rules are NOT returned (use the audit log to inspect removed rules)." }, "patch": { "responses": { "200": { "description": "Updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "cache_rule": { "type": "object", "properties": { "id": { "type": "string" }, "organization_id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "priority": { "type": "integer" }, "enabled": { "type": "boolean" }, "matchers": { "type": "object", "additionalProperties": {} }, "action": { "type": "object", "properties": { "mode": { "type": "string", "enum": [ "respect", "force", "disable" ] }, "ttl": { "type": "integer" }, "salt": { "type": "string" } }, "required": [ "mode" ] }, "mode_enum": { "type": "string", "enum": [ "RESPECT", "FORCE", "DISABLE" ] }, "archived_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "organization_id", "name", "description", "priority", "enabled", "matchers", "action", "mode_enum", "archived_at", "created_at", "updated_at" ] } }, "required": [ "cache_rule" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "patchApiGatewayV1Cache-rulesById", "tags": [ "Cache Rules" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Update a cache rule", "description": "Partial update. `matchers` and `action` REPLACE the stored value when provided (not merged field-by-field). Omitting them leaves the stored value untouched. The rule id + organisation are immutable." }, "delete": { "responses": { "200": { "description": "Archived", "content": { "application/json": { "schema": { "type": "object", "properties": { "cache_rule": { "type": "object", "properties": { "id": { "type": "string" }, "organization_id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "priority": { "type": "integer" }, "enabled": { "type": "boolean" }, "matchers": { "type": "object", "additionalProperties": {} }, "action": { "type": "object", "properties": { "mode": { "type": "string", "enum": [ "respect", "force", "disable" ] }, "ttl": { "type": "integer" }, "salt": { "type": "string" } }, "required": [ "mode" ] }, "mode_enum": { "type": "string", "enum": [ "RESPECT", "FORCE", "DISABLE" ] }, "archived_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "organization_id", "name", "description", "priority", "enabled", "matchers", "action", "mode_enum", "archived_at", "created_at", "updated_at" ] } }, "required": [ "cache_rule" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiGatewayV1Cache-rulesById", "tags": [ "Cache Rules" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Archive a cache rule", "description": "Soft-delete — sets archivedAt. The rule stops matching new requests. Audit log retains before/after snapshots. Returns the archived row." } }, "/api/gateway/v1/providers": { "get": { "responses": { "200": { "description": "Provider bindings", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "model_provider_id": { "type": "string" }, "model_provider_name": { "type": "string" }, "slot": { "type": "string" }, "rate_limit_rpm": { "type": [ "number", "null" ] }, "rate_limit_tpm": { "type": [ "number", "null" ] }, "rate_limit_rpd": { "type": [ "number", "null" ] }, "rotation_policy": { "type": "string" }, "fallback_priority_global": { "type": [ "number", "null" ] }, "health_status": { "type": "string" }, "disabled_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" } }, "required": [ "id", "model_provider_id", "model_provider_name", "slot", "rate_limit_rpm", "rate_limit_tpm", "rate_limit_rpd", "rotation_policy", "fallback_priority_global", "health_status", "disabled_at", "created_at" ] } } }, "required": [ "data" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiGatewayV1Providers", "tags": [ "Providers" ], "parameters": [], "summary": "List provider bindings", "description": "Lists every gateway-bound model-provider credential for the caller's project, including health and rate-limit settings." }, "post": { "responses": { "201": { "description": "Binding created", "content": { "application/json": { "schema": { "type": "object", "properties": { "provider_credential": { "type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] } }, "required": [ "provider_credential" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiGatewayV1Providers", "tags": [ "Providers" ], "parameters": [], "summary": "Bind a model provider to the gateway", "description": "Creates a GatewayProviderCredential binding. Reuses the ModelProvider API key already configured in project settings; this only adds gateway-specific settings (rate limits, rotation, fallback priority)." } }, "/api/gateway/v1/providers/{id}": { "patch": { "responses": { "200": { "description": "Updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "provider_credential": { "type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] } }, "required": [ "provider_credential" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "patchApiGatewayV1ProvidersById", "tags": [ "Providers" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Update provider binding", "description": "Partial update of gateway-specific settings (rate limits, rotation, slot, extra headers). The underlying ModelProvider credentials are managed in project settings, not here." }, "delete": { "responses": { "200": { "description": "Disabled", "content": { "application/json": { "schema": { "type": "object", "properties": { "provider_credential": { "type": "object", "properties": { "id": { "type": "string" }, "disabled_at": { "type": [ "string", "null" ] } }, "required": [ "id", "disabled_at" ] } }, "required": [ "provider_credential" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiGatewayV1ProvidersById", "tags": [ "Providers" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Disable provider binding", "description": "Marks the binding disabled. Requests routing to this slot are skipped (fallback chain continues). Historical ledger rows are retained." } }, "/api/gateway/v1/virtual-keys": { "get": { "responses": { "200": { "description": "Virtual keys for the project", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "display_prefix": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "environment": { "type": "string", "enum": [ "live", "test" ] }, "status": { "type": "string", "enum": [ "active", "revoked" ] }, "principal_user_id": { "type": [ "string", "null" ] }, "provider_credential_ids": { "type": "array", "items": { "type": "string" } }, "revision": { "type": "string" }, "last_used_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" } }, "required": [ "id", "display_prefix", "name", "description", "environment", "status", "principal_user_id", "provider_credential_ids", "revision", "last_used_at", "created_at" ] } } }, "required": [ "data" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiGatewayV1Virtual-keys", "tags": [ "Virtual Keys" ], "parameters": [], "summary": "List virtual keys", "description": "Returns every non-archived virtual key in the caller's project, ordered by creation time." }, "post": { "responses": { "201": { "description": "Virtual key created", "content": { "application/json": { "schema": { "type": "object", "properties": { "virtual_key": { "type": "object", "properties": { "id": { "type": "string" }, "display_prefix": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "environment": { "type": "string", "enum": [ "live", "test" ] }, "status": { "type": "string", "enum": [ "active", "revoked" ] }, "principal_user_id": { "type": [ "string", "null" ] }, "provider_credential_ids": { "type": "array", "items": { "type": "string" } }, "revision": { "type": "string" }, "last_used_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" } }, "required": [ "id", "display_prefix", "name", "description", "environment", "status", "principal_user_id", "provider_credential_ids", "revision", "last_used_at", "created_at" ] }, "secret": { "type": "string" } }, "required": [ "virtual_key", "secret" ] } } } }, "400": { "description": "Validation error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "type": { "type": "string" }, "code": { "type": "string" }, "message": { "type": "string" } }, "required": [ "type", "code", "message" ] } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiGatewayV1Virtual-keys", "tags": [ "Virtual Keys" ], "parameters": [], "summary": "Create virtual key", "description": "Mints a new virtual key and returns the secret exactly once. The caller MUST persist the `secret` value — LangWatch stores only a hash." } }, "/api/gateway/v1/virtual-keys/{id}": { "get": { "responses": { "200": { "description": "Virtual key detail", "content": { "application/json": { "schema": { "type": "object", "properties": { "virtual_key": { "type": "object", "properties": { "id": { "type": "string" }, "display_prefix": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "environment": { "type": "string", "enum": [ "live", "test" ] }, "status": { "type": "string", "enum": [ "active", "revoked" ] }, "principal_user_id": { "type": [ "string", "null" ] }, "provider_credential_ids": { "type": "array", "items": { "type": "string" } }, "revision": { "type": "string" }, "last_used_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" } }, "required": [ "id", "display_prefix", "name", "description", "environment", "status", "principal_user_id", "provider_credential_ids", "revision", "last_used_at", "created_at" ] } }, "required": [ "virtual_key" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "type": { "type": "string" }, "code": { "type": "string" }, "message": { "type": "string" } }, "required": [ "type", "code", "message" ] } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiGatewayV1Virtual-keysById", "tags": [ "Virtual Keys" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Get virtual key" }, "patch": { "responses": { "200": { "description": "Updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "virtual_key": { "type": "object", "properties": { "id": { "type": "string" }, "display_prefix": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "environment": { "type": "string", "enum": [ "live", "test" ] }, "status": { "type": "string", "enum": [ "active", "revoked" ] }, "principal_user_id": { "type": [ "string", "null" ] }, "provider_credential_ids": { "type": "array", "items": { "type": "string" } }, "revision": { "type": "string" }, "last_used_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" } }, "required": [ "id", "display_prefix", "name", "description", "environment", "status", "principal_user_id", "provider_credential_ids", "revision", "last_used_at", "created_at" ] } }, "required": [ "virtual_key" ] } } } }, "400": { "description": "Validation error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "object", "properties": { "type": { "type": "string" }, "code": { "type": "string" }, "message": { "type": "string" } }, "required": [ "type", "code", "message" ] } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "patchApiGatewayV1Virtual-keysById", "tags": [ "Virtual Keys" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Update virtual key", "description": "Partial update — send only the fields you want to change. `provider_credential_ids` replaces the entire fallback chain. `config` is deep-merged." } }, "/api/gateway/v1/virtual-keys/{id}/revoke": { "post": { "responses": { "200": { "description": "Revoked", "content": { "application/json": { "schema": { "type": "object", "properties": { "virtual_key": { "type": "object", "properties": { "id": { "type": "string" }, "display_prefix": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "environment": { "type": "string", "enum": [ "live", "test" ] }, "status": { "type": "string", "enum": [ "active", "revoked" ] }, "principal_user_id": { "type": [ "string", "null" ] }, "provider_credential_ids": { "type": "array", "items": { "type": "string" } }, "revision": { "type": "string" }, "last_used_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" } }, "required": [ "id", "display_prefix", "name", "description", "environment", "status", "principal_user_id", "provider_credential_ids", "revision", "last_used_at", "created_at" ] } }, "required": [ "virtual_key" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiGatewayV1Virtual-keysByIdRevoke", "tags": [ "Virtual Keys" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Revoke virtual key", "description": "Marks the virtual key as revoked. Clients using it start receiving 401 within ~60s (the gateway's change-event long-poll period)." } }, "/api/gateway/v1/virtual-keys/{id}/rotate": { "post": { "responses": { "200": { "description": "Rotated", "content": { "application/json": { "schema": { "type": "object", "properties": { "virtual_key": { "type": "object", "properties": { "id": { "type": "string" }, "display_prefix": { "type": "string" }, "name": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "environment": { "type": "string", "enum": [ "live", "test" ] }, "status": { "type": "string", "enum": [ "active", "revoked" ] }, "principal_user_id": { "type": [ "string", "null" ] }, "provider_credential_ids": { "type": "array", "items": { "type": "string" } }, "revision": { "type": "string" }, "last_used_at": { "type": [ "string", "null" ] }, "created_at": { "type": "string" } }, "required": [ "id", "display_prefix", "name", "description", "environment", "status", "principal_user_id", "provider_credential_ids", "revision", "last_used_at", "created_at" ] }, "secret": { "type": "string" } }, "required": [ "virtual_key", "secret" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiGatewayV1Virtual-keysByIdRotate", "tags": [ "Virtual Keys" ], "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "summary": "Rotate virtual key secret", "description": "Mints a fresh secret for an existing VK. The old secret remains valid for 24h (grace window) so in-flight clients can roll over." } }, "/api/graphs": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "graph": { "type": "object", "additionalProperties": {} }, "filters": { "type": [ "object", "null" ], "additionalProperties": {} }, "dashboardId": { "type": [ "string", "null" ] }, "gridColumn": { "type": "number" }, "gridRow": { "type": "number" }, "colSpan": { "type": "number" }, "rowSpan": { "type": "number" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "name", "graph", "filters", "dashboardId", "gridColumn", "gridRow", "colSpan", "rowSpan", "createdAt", "updatedAt" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiGraphs", "parameters": [ { "in": "query", "name": "dashboardId", "schema": { "type": "string" } } ], "description": "List all custom graphs, optionally filtered by dashboard" }, "post": { "responses": { "201": { "description": "Graph created", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "graph": { "type": "object", "additionalProperties": {} }, "filters": { "type": [ "object", "null" ], "additionalProperties": {} }, "dashboardId": { "type": [ "string", "null" ] }, "gridColumn": { "type": "number" }, "gridRow": { "type": "number" }, "colSpan": { "type": "number" }, "rowSpan": { "type": "number" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "name", "graph", "filters", "dashboardId", "gridColumn", "gridRow", "colSpan", "rowSpan", "createdAt", "updatedAt" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiGraphs", "parameters": [], "description": "Create a custom graph on a dashboard", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "graph": { "type": "object", "additionalProperties": {} }, "dashboardId": { "type": "string" }, "filters": { "type": "object", "additionalProperties": {} }, "gridColumn": { "type": "number", "minimum": 0, "maximum": 1 }, "gridRow": { "type": "number", "minimum": 0 }, "colSpan": { "type": "number", "minimum": 1, "maximum": 2 }, "rowSpan": { "type": "number", "minimum": 1, "maximum": 2 } }, "required": [ "name", "graph" ] } } } } } }, "/api/graphs/{id}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "graph": { "type": "object", "additionalProperties": {} }, "filters": { "type": [ "object", "null" ], "additionalProperties": {} }, "dashboardId": { "type": [ "string", "null" ] }, "gridColumn": { "type": "number" }, "gridRow": { "type": "number" }, "colSpan": { "type": "number" }, "rowSpan": { "type": "number" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "name", "graph", "filters", "dashboardId", "gridColumn", "gridRow", "colSpan", "rowSpan", "createdAt", "updatedAt" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Graph not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiGraphsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Get a custom graph by its ID" }, "patch": { "responses": { "200": { "description": "Graph updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "graph": { "type": "object", "additionalProperties": {} }, "filters": { "type": [ "object", "null" ], "additionalProperties": {} }, "dashboardId": { "type": [ "string", "null" ] }, "gridColumn": { "type": "number" }, "gridRow": { "type": "number" }, "colSpan": { "type": "number" }, "rowSpan": { "type": "number" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "name", "graph", "filters", "dashboardId", "gridColumn", "gridRow", "colSpan", "rowSpan", "createdAt", "updatedAt" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Graph not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "patchApiGraphsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update a custom graph's name, definition, or filters", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "graph": { "type": "object", "additionalProperties": {} }, "filters": { "type": "object", "additionalProperties": {} } } } } } } }, "delete": { "responses": { "200": { "description": "Graph deleted", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "deleted": { "type": "boolean" } }, "required": [ "id", "deleted" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Graph not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiGraphsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Delete a custom graph" } }, "/api/model-providers": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": { "type": "object", "properties": { "id": { "type": "string" }, "provider": { "type": "string" }, "enabled": { "type": "boolean" }, "customKeys": { "type": [ "object", "null" ], "additionalProperties": {} }, "deploymentMapping": { "type": "null" }, "models": { "type": [ "array", "null" ], "items": { "type": "string" } }, "embeddingsModels": { "type": [ "array", "null" ], "items": { "type": "string" } }, "customModels": { "type": [ "array", "null" ], "items": { "type": "object", "properties": { "modelId": { "type": "string", "minLength": 1 }, "displayName": { "type": "string", "minLength": 1 }, "mode": { "type": "string", "enum": [ "chat", "embedding" ] }, "maxTokens": { "type": [ "number", "null" ], "exclusiveMinimum": 0 }, "supportedParameters": { "type": "array", "items": { "type": "string", "enum": [ "temperature", "max_tokens", "top_p", "frequency_penalty", "presence_penalty", "top_k", "min_p", "repetition_penalty", "seed", "reasoning", "verbosity" ] } }, "multimodalInputs": { "type": "array", "items": { "type": "string", "enum": [ "image", "file", "audio" ] } } }, "required": [ "modelId", "displayName", "mode" ] } }, "customEmbeddingsModels": { "type": [ "array", "null" ], "items": { "type": "object", "properties": { "modelId": { "type": "string", "minLength": 1 }, "displayName": { "type": "string", "minLength": 1 }, "mode": { "type": "string", "enum": [ "chat", "embedding" ] }, "maxTokens": { "type": [ "number", "null" ], "exclusiveMinimum": 0 }, "supportedParameters": { "type": "array", "items": { "type": "string", "enum": [ "temperature", "max_tokens", "top_p", "frequency_penalty", "presence_penalty", "top_k", "min_p", "repetition_penalty", "seed", "reasoning", "verbosity" ] } }, "multimodalInputs": { "type": "array", "items": { "type": "string", "enum": [ "image", "file", "audio" ] } } }, "required": [ "modelId", "displayName", "mode" ] } }, "disabledByDefault": { "type": "boolean" }, "extraHeaders": { "type": [ "array", "null" ], "items": { "type": "object", "properties": { "key": { "type": "string" }, "value": { "type": "string" } }, "required": [ "key", "value" ] } } }, "required": [ "provider", "enabled", "customKeys" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiModel-providers", "parameters": [], "description": "List all model providers for a project with masked API keys" } }, "/api/model-providers/{provider}": { "put": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": { "type": "object", "properties": { "id": { "type": "string" }, "provider": { "type": "string" }, "enabled": { "type": "boolean" }, "customKeys": { "type": [ "object", "null" ], "additionalProperties": {} }, "deploymentMapping": { "type": "null" }, "models": { "type": [ "array", "null" ], "items": { "type": "string" } }, "embeddingsModels": { "type": [ "array", "null" ], "items": { "type": "string" } }, "customModels": { "type": [ "array", "null" ], "items": { "type": "object", "properties": { "modelId": { "type": "string", "minLength": 1 }, "displayName": { "type": "string", "minLength": 1 }, "mode": { "type": "string", "enum": [ "chat", "embedding" ] }, "maxTokens": { "type": [ "number", "null" ], "exclusiveMinimum": 0 }, "supportedParameters": { "type": "array", "items": { "type": "string", "enum": [ "temperature", "max_tokens", "top_p", "frequency_penalty", "presence_penalty", "top_k", "min_p", "repetition_penalty", "seed", "reasoning", "verbosity" ] } }, "multimodalInputs": { "type": "array", "items": { "type": "string", "enum": [ "image", "file", "audio" ] } } }, "required": [ "modelId", "displayName", "mode" ] } }, "customEmbeddingsModels": { "type": [ "array", "null" ], "items": { "type": "object", "properties": { "modelId": { "type": "string", "minLength": 1 }, "displayName": { "type": "string", "minLength": 1 }, "mode": { "type": "string", "enum": [ "chat", "embedding" ] }, "maxTokens": { "type": [ "number", "null" ], "exclusiveMinimum": 0 }, "supportedParameters": { "type": "array", "items": { "type": "string", "enum": [ "temperature", "max_tokens", "top_p", "frequency_penalty", "presence_penalty", "top_k", "min_p", "repetition_penalty", "seed", "reasoning", "verbosity" ] } }, "multimodalInputs": { "type": "array", "items": { "type": "string", "enum": [ "image", "file", "audio" ] } } }, "required": [ "modelId", "displayName", "mode" ] } }, "disabledByDefault": { "type": "boolean" }, "extraHeaders": { "type": [ "array", "null" ], "items": { "type": "object", "properties": { "key": { "type": "string" }, "value": { "type": "string" } }, "required": [ "key", "value" ] } } }, "required": [ "provider", "enabled", "customKeys" ] } } } } }, "400": { "description": "Bad request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "putApiModel-providersByProvider", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "provider", "required": true } ], "description": "Create or update a model provider", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "customKeys": { "type": "object", "additionalProperties": {} }, "customModels": { "anyOf": [ { "type": "array", "items": { "type": "object", "properties": { "modelId": { "type": "string", "minLength": 1 }, "displayName": { "type": "string", "minLength": 1 }, "mode": { "type": "string", "enum": [ "chat", "embedding" ] }, "maxTokens": { "type": [ "number", "null" ], "exclusiveMinimum": 0 }, "supportedParameters": { "type": "array", "items": { "type": "string", "enum": [ "temperature", "max_tokens", "top_p", "frequency_penalty", "presence_penalty", "top_k", "min_p", "repetition_penalty", "seed", "reasoning", "verbosity" ] } }, "multimodalInputs": { "type": "array", "items": { "type": "string", "enum": [ "image", "file", "audio" ] } } }, "required": [ "modelId", "displayName", "mode" ] } }, { "type": "array", "items": { "type": "string" } } ] }, "customEmbeddingsModels": { "anyOf": [ { "type": "array", "items": { "type": "object", "properties": { "modelId": { "type": "string", "minLength": 1 }, "displayName": { "type": "string", "minLength": 1 }, "mode": { "type": "string", "enum": [ "chat", "embedding" ] }, "maxTokens": { "type": [ "number", "null" ], "exclusiveMinimum": 0 }, "supportedParameters": { "type": "array", "items": { "type": "string", "enum": [ "temperature", "max_tokens", "top_p", "frequency_penalty", "presence_penalty", "top_k", "min_p", "repetition_penalty", "seed", "reasoning", "verbosity" ] } }, "multimodalInputs": { "type": "array", "items": { "type": "string", "enum": [ "image", "file", "audio" ] } } }, "required": [ "modelId", "displayName", "mode" ] } }, { "type": "array", "items": { "type": "string" } } ] }, "extraHeaders": { "type": "array", "items": { "type": "object", "properties": { "key": { "type": "string" }, "value": { "type": "string" } }, "required": [ "key", "value" ] } }, "defaultModel": { "type": "string" } }, "required": [ "enabled" ] } } } } } }, "/api/monitors": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": "string" }, "checkType": { "type": "string" }, "enabled": { "type": "boolean" }, "executionMode": { "type": "string", "enum": [ "ON_MESSAGE", "AS_GUARDRAIL", "MANUALLY" ] }, "sample": { "type": "number" }, "level": { "type": "string" }, "evaluatorId": { "type": [ "string", "null" ] }, "preconditions": {}, "parameters": {}, "mappings": { "type": "null" }, "threadIdleTimeout": { "type": [ "number", "null" ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "slug", "checkType", "enabled", "executionMode", "sample", "level", "evaluatorId", "threadIdleTimeout", "createdAt", "updatedAt", "platformUrl" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiMonitors", "parameters": [], "description": "List all online evaluation monitors for the project" }, "post": { "responses": { "201": { "description": "Monitor created", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": "string" }, "checkType": { "type": "string" }, "enabled": { "type": "boolean" }, "executionMode": { "type": "string", "enum": [ "ON_MESSAGE", "AS_GUARDRAIL", "MANUALLY" ] }, "sample": { "type": "number" }, "level": { "type": "string" }, "evaluatorId": { "type": [ "string", "null" ] }, "preconditions": {}, "parameters": {}, "mappings": { "type": "null" }, "threadIdleTimeout": { "type": [ "number", "null" ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "slug", "checkType", "enabled", "executionMode", "sample", "level", "evaluatorId", "threadIdleTimeout", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiMonitors", "parameters": [], "description": "Create a new online evaluation monitor", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "checkType": { "type": "string", "minLength": 1 }, "executionMode": { "type": "string", "enum": [ "ON_MESSAGE", "AS_GUARDRAIL", "MANUALLY" ], "default": "ON_MESSAGE" }, "preconditions": { "type": "array", "items": {}, "default": [] }, "parameters": { "type": "object", "additionalProperties": {}, "default": {} }, "mappings": { "type": [ "object", "null" ], "properties": { "mapping": { "type": "object", "additionalProperties": { "anyOf": [ { "type": "object", "properties": { "source": { "anyOf": [ { "type": "string", "enum": [ "trace_id", "thread_id", "timestamp", "input", "output", "contexts", "contexts.string_list", "metrics.total_cost", "metrics.first_token_ms", "metrics.total_time_ms", "metrics.prompt_tokens", "metrics.completion_tokens", "metrics.total_tokens", "spans", "spans.llm.input", "spans.llm.output", "metadata", "evaluations", "annotations", "events", "threads", "threads_until_current", "formatted_trace" ] }, { "type": "string", "const": "" } ] }, "key": { "type": "string" }, "subkey": { "type": "string" }, "selectedFields": { "type": "array", "items": { "type": "string" } }, "type": { "type": "string", "const": "trace" } }, "required": [ "source" ] }, { "type": "object", "properties": { "source": { "anyOf": [ { "type": "string", "enum": [ "thread_id", "traces", "formatted_traces" ] }, { "type": "string", "const": "" } ] }, "key": { "type": "string" }, "subkey": { "type": "string" }, "selectedFields": { "type": "array", "items": { "type": "string" } }, "type": { "type": "string", "const": "thread" } }, "required": [ "source", "type" ] } ] } }, "expansions": { "type": "array", "items": { "type": "string", "enum": [ "spans.llm.span_id", "spans.all.span_id", "annotations.id", "events.event_id" ] } } }, "required": [ "mapping", "expansions" ] }, "sample": { "type": "number", "minimum": 0, "maximum": 1, "default": 1 }, "evaluatorId": { "type": "string" }, "level": { "type": "string", "enum": [ "trace", "thread" ], "default": "trace" }, "threadIdleTimeout": { "type": [ "integer", "null" ], "exclusiveMinimum": 0 } }, "required": [ "name", "checkType" ] } } } } } }, "/api/monitors/{id}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": "string" }, "checkType": { "type": "string" }, "enabled": { "type": "boolean" }, "executionMode": { "type": "string", "enum": [ "ON_MESSAGE", "AS_GUARDRAIL", "MANUALLY" ] }, "sample": { "type": "number" }, "level": { "type": "string" }, "evaluatorId": { "type": [ "string", "null" ] }, "preconditions": {}, "parameters": {}, "mappings": { "type": "null" }, "threadIdleTimeout": { "type": [ "number", "null" ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "slug", "checkType", "enabled", "executionMode", "sample", "level", "evaluatorId", "threadIdleTimeout", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Monitor not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiMonitorsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Get a monitor by its ID" }, "patch": { "responses": { "200": { "description": "Monitor updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": "string" }, "checkType": { "type": "string" }, "enabled": { "type": "boolean" }, "executionMode": { "type": "string", "enum": [ "ON_MESSAGE", "AS_GUARDRAIL", "MANUALLY" ] }, "sample": { "type": "number" }, "level": { "type": "string" }, "evaluatorId": { "type": [ "string", "null" ] }, "preconditions": {}, "parameters": {}, "mappings": { "type": "null" }, "threadIdleTimeout": { "type": [ "number", "null" ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "slug", "checkType", "enabled", "executionMode", "sample", "level", "evaluatorId", "threadIdleTimeout", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Monitor not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "patchApiMonitorsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update a monitor (name, enabled state, settings, etc.)", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "enabled": { "type": "boolean" }, "checkType": { "type": "string" }, "executionMode": { "type": "string", "enum": [ "ON_MESSAGE", "AS_GUARDRAIL", "MANUALLY" ] }, "preconditions": { "type": "array", "items": {} }, "parameters": { "type": "object", "additionalProperties": {} }, "mappings": { "type": [ "object", "null" ], "properties": { "mapping": { "type": "object", "additionalProperties": { "anyOf": [ { "type": "object", "properties": { "source": { "anyOf": [ { "type": "string", "enum": [ "trace_id", "thread_id", "timestamp", "input", "output", "contexts", "contexts.string_list", "metrics.total_cost", "metrics.first_token_ms", "metrics.total_time_ms", "metrics.prompt_tokens", "metrics.completion_tokens", "metrics.total_tokens", "spans", "spans.llm.input", "spans.llm.output", "metadata", "evaluations", "annotations", "events", "threads", "threads_until_current", "formatted_trace" ] }, { "type": "string", "const": "" } ] }, "key": { "type": "string" }, "subkey": { "type": "string" }, "selectedFields": { "type": "array", "items": { "type": "string" } }, "type": { "type": "string", "const": "trace" } }, "required": [ "source" ] }, { "type": "object", "properties": { "source": { "anyOf": [ { "type": "string", "enum": [ "thread_id", "traces", "formatted_traces" ] }, { "type": "string", "const": "" } ] }, "key": { "type": "string" }, "subkey": { "type": "string" }, "selectedFields": { "type": "array", "items": { "type": "string" } }, "type": { "type": "string", "const": "thread" } }, "required": [ "source", "type" ] } ] } }, "expansions": { "type": "array", "items": { "type": "string", "enum": [ "spans.llm.span_id", "spans.all.span_id", "annotations.id", "events.event_id" ] } } }, "required": [ "mapping", "expansions" ] }, "sample": { "type": "number", "minimum": 0, "maximum": 1 }, "evaluatorId": { "type": [ "string", "null" ] }, "level": { "type": "string", "enum": [ "trace", "thread" ] }, "threadIdleTimeout": { "type": [ "integer", "null" ], "exclusiveMinimum": 0 } } } } } } }, "delete": { "responses": { "200": { "description": "Monitor deleted", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "deleted": { "type": "boolean" } }, "required": [ "id", "deleted" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Monitor not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiMonitorsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Delete a monitor" } }, "/api/monitors/{id}/toggle": { "post": { "responses": { "200": { "description": "Monitor toggled", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "enabled": { "type": "boolean" } }, "required": [ "id", "enabled" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Monitor not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiMonitorsByIdToggle", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Enable or disable a monitor", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "enabled": { "type": "boolean" } }, "required": [ "enabled" ] } } } } } }, "/api/projects": { "get": { "operationId": "listProjects", "summary": "List projects", "description": "List all non-archived projects for the organization (paginated). Requires an admin API key with project:view permission.", "security": [ { "admin_api_key": [] } ], "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1, "default": 1 } }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 1000, "default": 50 } } ], "responses": { "200": { "description": "Paginated list of projects", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Project" } }, "pagination": { "$ref": "#/components/schemas/Pagination" } } } } } }, "401": { "description": "Invalid or missing API key token" }, "403": { "description": "Insufficient permissions for this operation" } } }, "post": { "operationId": "createProject", "summary": "Create a project", "description": "Create a new project in the organization. Returns the project with its API key (sk-lw-...) for sending traces. Provide either teamId (existing team) or newTeamName (creates a new team). Requires project:create permission.", "security": [ { "admin_api_key": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 255, "description": "Project name" }, "teamId": { "type": "string", "description": "ID of an existing team to assign the project to" }, "newTeamName": { "type": "string", "maxLength": 255, "description": "Name for a new team to create and assign the project to" }, "language": { "type": "string", "description": "Programming language (e.g. python, typescript)" }, "framework": { "type": "string", "description": "Framework (e.g. langchain, vercel-ai, openai)" } }, "required": [ "name", "language", "framework" ] } } } }, "responses": { "201": { "description": "Project created. Returns a scoped service API key for this project.", "content": { "application/json": { "schema": { "allOf": [ { "$ref": "#/components/schemas/Project" }, { "type": "object", "properties": { "serviceApiKey": { "type": "string", "description": "Scoped service API key with ADMIN on this project (sk-lw-..._...). Store securely — shown only once." }, "serviceApiKeyId": { "type": "string", "description": "ID of the auto-created service key, for management via DELETE /api/api-keys/{id}." } } } ] } } } }, "400": { "description": "Team does not belong to this organization" }, "401": { "description": "Invalid or missing API key token" }, "403": { "description": "Insufficient permissions (requires project:create)" }, "409": { "description": "A project with this name already exists in the team" }, "422": { "description": "Validation error (missing required fields)" } } } }, "/api/projects/{id}": { "get": { "operationId": "getProject", "summary": "Get a project", "description": "Get a project by ID, including its API key. Requires project:view permission.", "security": [ { "admin_api_key": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Project ID (project_...)" } ], "responses": { "200": { "description": "Project details.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Project" } } } }, "401": { "description": "Invalid or missing API key token" }, "403": { "description": "Insufficient permissions for this operation" }, "404": { "description": "Project not found" } } }, "patch": { "operationId": "updateProject", "summary": "Update a project", "description": "Update project fields. Only provided fields are changed. Requires project:update permission.", "security": [ { "admin_api_key": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Project ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 255 }, "language": { "type": "string" }, "framework": { "type": "string" }, "piiRedactionLevel": { "type": "string", "enum": [ "STRICT", "ESSENTIAL", "DISABLED" ] } } } } } }, "responses": { "200": { "description": "Updated project", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Project" } } } }, "401": { "description": "Invalid or missing API key token" }, "403": { "description": "Insufficient permissions (requires project:update)" }, "404": { "description": "Project not found" } } }, "delete": { "operationId": "archiveProject", "summary": "Archive a project", "description": "Soft-delete (archive) a project. Archived projects are excluded from list responses. Requires project:delete permission.", "security": [ { "admin_api_key": [] } ], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "Project ID" } ], "responses": { "200": { "description": "Project archived", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "archivedAt": { "type": "string", "format": "date-time" } } } } } }, "401": { "description": "Invalid or missing API key token" }, "403": { "description": "Insufficient permissions (requires project:delete)" }, "404": { "description": "Project not found" } } } }, "/api/prompts": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "handle": { "type": [ "string", "null" ] }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ] }, "name": { "type": "string" }, "updatedAt": { "type": "string" }, "projectId": { "type": "string" }, "organizationId": { "type": "string" }, "versionId": { "type": "string" }, "authorId": { "type": [ "string", "null" ] }, "version": { "type": "number" }, "createdAt": { "type": "string" }, "commitMessage": { "type": [ "string", "null" ] }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] }, "default": [] }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] }, "default": [] }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] }, "minItems": 1 }, "model": { "type": "string", "minLength": 1 }, "temperature": { "type": "number" }, "maxTokens": { "type": "number" }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } }, "promptingTechnique": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "few_shot", "in_context", "chain_of_thought" ] }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } } }, "required": [ "type" ] }, "responseFormat": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": [ "object", "null" ], "properties": { "name": { "type": "string" }, "schema": { "type": "object", "additionalProperties": true } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "versionId": { "type": "string" } }, "required": [ "name", "versionId" ] }, "default": [] } }, "required": [ "id", "handle", "scope", "name", "updatedAt", "projectId", "organizationId", "versionId", "version", "createdAt", "prompt", "messages", "inputs", "outputs", "model", "tags" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiPrompts", "parameters": [], "description": "Get all prompts for a project" }, "post": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "handle": { "type": [ "string", "null" ] }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ] }, "name": { "type": "string" }, "updatedAt": { "type": "string" }, "projectId": { "type": "string" }, "organizationId": { "type": "string" }, "versionId": { "type": "string" }, "authorId": { "type": [ "string", "null" ] }, "version": { "type": "number" }, "createdAt": { "type": "string" }, "commitMessage": { "type": [ "string", "null" ] }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] }, "default": [] }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] }, "default": [] }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] }, "minItems": 1 }, "model": { "type": "string", "minLength": 1 }, "temperature": { "type": "number" }, "maxTokens": { "type": "number" }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } }, "promptingTechnique": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "few_shot", "in_context", "chain_of_thought" ] }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } } }, "required": [ "type" ] }, "responseFormat": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": [ "object", "null" ], "properties": { "name": { "type": "string" }, "schema": { "type": "object", "additionalProperties": true } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "versionId": { "type": "string" } }, "required": [ "name", "versionId" ] }, "default": [] } }, "required": [ "id", "handle", "scope", "name", "updatedAt", "projectId", "organizationId", "versionId", "version", "createdAt", "prompt", "messages", "inputs", "outputs", "model", "tags" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "409": { "description": "Conflict", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error", "message" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiPrompts", "parameters": [], "description": "Create a new prompt with default initial version", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "handle": { "type": "string", "pattern": "^[a-z0-9_-]+(?:\\/[a-z0-9_-]+)?$" }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ], "default": "PROJECT" }, "model": { "type": "string" }, "temperature": { "type": "number" }, "maxTokens": { "type": "number" }, "commitMessage": { "type": "string" }, "authorId": { "type": "string" }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] } }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] } }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] } }, "schemaVersion": { "type": "string", "enum": [ "1.0" ] }, "tags": { "type": "array", "items": { "type": "string", "minLength": 1 } } }, "required": [ "handle" ], "additionalProperties": false } } } } } }, "/api/prompts/tags": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "createdAt": { "type": "string" } }, "required": [ "id", "name", "createdAt" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiPromptsTags", "parameters": [], "description": "List all prompt tag definitions for the organization" }, "post": { "responses": { "201": { "description": "Tag created", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "createdAt": { "type": "string" } }, "required": [ "id", "name", "createdAt" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiPromptsTags", "parameters": [], "description": "Create a custom prompt tag definition for the organization", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" } }, "required": [ "name" ] } } } } } }, "/api/prompts/tags/{tag}": { "put": { "responses": { "200": { "description": "Tag renamed", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "createdAt": { "type": "string" } }, "required": [ "id", "name", "createdAt" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "putApiPromptsTagsByTag", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "tag", "required": true } ], "description": "Rename a prompt tag definition", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string" } }, "required": [ "name" ] } } } } }, "delete": { "responses": { "204": { "description": "Tag deleted" }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiPromptsTagsByTag", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "tag", "required": true } ], "description": "Delete a prompt tag definition and cascade to assignments" } }, "/api/prompts/{id}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "handle": { "type": [ "string", "null" ] }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ] }, "name": { "type": "string" }, "updatedAt": { "type": "string" }, "projectId": { "type": "string" }, "organizationId": { "type": "string" }, "versionId": { "type": "string" }, "authorId": { "type": [ "string", "null" ] }, "version": { "type": "number" }, "createdAt": { "type": "string" }, "commitMessage": { "type": [ "string", "null" ] }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] }, "default": [] }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] }, "default": [] }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] }, "minItems": 1 }, "model": { "type": "string", "minLength": 1 }, "temperature": { "type": "number" }, "maxTokens": { "type": "number" }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } }, "promptingTechnique": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "few_shot", "in_context", "chain_of_thought" ] }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } } }, "required": [ "type" ] }, "responseFormat": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": [ "object", "null" ], "properties": { "name": { "type": "string" }, "schema": { "type": "object", "additionalProperties": true } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "versionId": { "type": "string" } }, "required": [ "name", "versionId" ] }, "default": [] } }, "required": [ "id", "handle", "scope", "name", "updatedAt", "projectId", "organizationId", "versionId", "version", "createdAt", "prompt", "messages", "inputs", "outputs", "model", "tags" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Prompt not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiPromptsById", "parameters": [ { "name": "id", "in": "path", "description": "Prompt slug or shorthand. Supports three formats: (1) bare slug — \"pizza-prompt\" returns the latest version; (2) slug:tag — \"pizza-prompt:production\" returns the version pointed to by that tag; (3) slug:version — \"pizza-prompt:2\" returns that specific version number. \"slug:latest\" is equivalent to the bare slug. Cannot be combined with the tag or version query parameters.", "required": true, "schema": { "type": "string" } }, { "name": "version", "in": "query", "description": "Specific version number to retrieve. Cannot be used when the id path already contains a shorthand suffix.", "required": false, "schema": { "type": "integer", "minimum": 0 } }, { "name": "tag", "in": "query", "description": "Fetch the version pointed to by this tag (e.g., \"production\", \"staging\"). Cannot be used when the id path already contains a shorthand suffix.", "required": false, "schema": { "type": "string" } } ], "description": "Get a specific prompt by slug, with optional shorthand syntax for tags and versions. Pass a bare slug like \"pizza-prompt\" to get the latest version, \"pizza-prompt:production\" to resolve a tagged version, or \"pizza-prompt:2\" to fetch version 2. Alternatively, use the tag or version query parameters with a bare slug." }, "put": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "handle": { "type": [ "string", "null" ] }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ] }, "name": { "type": "string" }, "updatedAt": { "type": "string" }, "projectId": { "type": "string" }, "organizationId": { "type": "string" }, "versionId": { "type": "string" }, "authorId": { "type": [ "string", "null" ] }, "version": { "type": "number" }, "createdAt": { "type": "string" }, "commitMessage": { "type": [ "string", "null" ] }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] }, "default": [] }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] }, "default": [] }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] }, "minItems": 1 }, "model": { "type": "string", "minLength": 1 }, "temperature": { "type": "number" }, "maxTokens": { "type": "number" }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } }, "promptingTechnique": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "few_shot", "in_context", "chain_of_thought" ] }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } } }, "required": [ "type" ] }, "responseFormat": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": [ "object", "null" ], "properties": { "name": { "type": "string" }, "schema": { "type": "object", "additionalProperties": true } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "versionId": { "type": "string" } }, "required": [ "name", "versionId" ] }, "default": [] } }, "required": [ "id", "handle", "scope", "name", "updatedAt", "projectId", "organizationId", "versionId", "version", "createdAt", "prompt", "messages", "inputs", "outputs", "model", "tags" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Prompt not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "409": { "description": "Conflict", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error", "message" ] } } } }, "422": { "description": "Invalid input", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "putApiPromptsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update a prompt", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "model": { "type": "string" }, "temperature": { "type": "number" }, "maxTokens": { "type": "number" }, "commitMessage": { "type": "string" }, "authorId": { "type": "string" }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] } }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] } }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] } }, "schemaVersion": { "type": "string", "enum": [ "1.0" ] }, "tags": { "type": "array", "items": { "type": "string", "minLength": 1 } }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ] }, "handle": { "type": "string", "pattern": "^[a-z0-9_-]+(?:\\/[a-z0-9_-]+)?$" } }, "required": [ "commitMessage" ], "additionalProperties": false } } } } }, "delete": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" } }, "required": [ "success" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Prompt not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiPromptsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Delete a prompt" } }, "/api/prompts/{id}/sync": { "post": { "responses": { "200": { "description": "Sync result", "content": { "application/json": { "schema": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "created", "updated", "conflict", "up_to_date" ] }, "prompt": { "type": "object", "properties": { "id": { "type": "string" }, "handle": { "type": [ "string", "null" ] }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ] }, "name": { "type": "string" }, "updatedAt": { "type": "string" }, "projectId": { "type": "string" }, "organizationId": { "type": "string" }, "versionId": { "type": "string" }, "authorId": { "type": [ "string", "null" ] }, "version": { "type": "number" }, "createdAt": { "type": "string" }, "commitMessage": { "type": [ "string", "null" ] }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] }, "default": [] }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] }, "default": [] }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] }, "minItems": 1 }, "model": { "type": "string", "minLength": 1 }, "temperature": { "type": "number" }, "maxTokens": { "type": "number" }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } }, "promptingTechnique": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "few_shot", "in_context", "chain_of_thought" ] }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } } }, "required": [ "type" ] }, "responseFormat": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": [ "object", "null" ], "properties": { "name": { "type": "string" }, "schema": { "type": "object", "additionalProperties": true } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "versionId": { "type": "string" } }, "required": [ "name", "versionId" ] }, "default": [] } }, "required": [ "id", "handle", "scope", "name", "updatedAt", "projectId", "organizationId", "versionId", "version", "createdAt", "prompt", "messages", "inputs", "outputs", "model", "tags" ] }, "conflictInfo": { "type": "object", "properties": { "localVersion": { "type": "number" }, "remoteVersion": { "type": "number" }, "differences": { "type": "array", "items": { "type": "string" } }, "remoteConfigData": { "type": "object", "properties": { "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] }, "default": [] }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] }, "default": [] }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] }, "minItems": 1 }, "model": { "type": "string", "minLength": 1 }, "temperature": { "type": "number" }, "max_tokens": { "type": "number" }, "top_p": { "type": "number" }, "frequency_penalty": { "type": "number" }, "presence_penalty": { "type": "number" }, "seed": { "type": "number" }, "top_k": { "type": "number" }, "min_p": { "type": "number" }, "repetition_penalty": { "type": "number" }, "reasoning": { "type": "string" }, "reasoning_effort": { "type": "string" }, "thinkingLevel": { "type": "string" }, "effort": { "type": "string" }, "verbosity": { "type": "string" }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } }, "prompting_technique": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "few_shot", "in_context", "chain_of_thought" ] }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } } }, "required": [ "type" ] }, "response_format": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": [ "object", "null" ], "properties": { "name": { "type": "string" }, "schema": { "type": "object", "additionalProperties": true } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] } }, "required": [ "prompt", "messages", "inputs", "outputs", "model" ] } }, "required": [ "localVersion", "remoteVersion", "differences", "remoteConfigData" ] } }, "required": [ "action" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiPromptsByIdSync", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Sync/upsert a prompt with local content", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "configData": { "type": "object", "properties": { "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] }, "default": [] }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] }, "default": [] }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] }, "minItems": 1 }, "model": { "type": "string", "minLength": 1 }, "temperature": { "type": "number" }, "max_tokens": { "type": "number" }, "top_p": { "type": "number" }, "frequency_penalty": { "type": "number" }, "presence_penalty": { "type": "number" }, "seed": { "type": "number" }, "top_k": { "type": "number" }, "min_p": { "type": "number" }, "repetition_penalty": { "type": "number" }, "reasoning": { "type": "string" }, "reasoning_effort": { "type": "string" }, "thinkingLevel": { "type": "string" }, "effort": { "type": "string" }, "verbosity": { "type": "string" }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } }, "prompting_technique": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "few_shot", "in_context", "chain_of_thought" ] }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } } }, "required": [ "type" ] }, "response_format": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": [ "object", "null" ], "properties": { "name": { "type": "string" }, "schema": { "type": "object", "additionalProperties": true } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] } }, "required": [ "prompt", "outputs", "model" ] }, "localVersion": { "type": "number", "minimum": 0 }, "commitMessage": { "type": "string" } }, "required": [ "configData" ] } } } } } }, "/api/prompts/{id}/tags/{tag}": { "put": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "configId": { "type": "string" }, "versionId": { "type": "string" }, "tag": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "configId", "versionId", "tag", "updatedAt" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Prompt not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Invalid tag or version", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "putApiPromptsByIdTagsByTag", "parameters": [ { "name": "tag", "in": "path", "description": "The tag to assign (e.g., \"production\", \"staging\", or a custom tag)", "required": true, "schema": { "type": "string" } }, { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Assign a tag (e.g. \"production\", \"staging\") to a specific prompt version", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "versionId": { "type": "string" } }, "required": [ "versionId" ] } } } } } }, "/api/prompts/{id}/versions": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "handle": { "type": [ "string", "null" ] }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ] }, "name": { "type": "string" }, "updatedAt": { "type": "string" }, "projectId": { "type": "string" }, "organizationId": { "type": "string" }, "versionId": { "type": "string" }, "authorId": { "type": [ "string", "null" ] }, "version": { "type": "number" }, "createdAt": { "type": "string" }, "commitMessage": { "type": [ "string", "null" ] }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] }, "default": [] }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] }, "default": [] }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] }, "minItems": 1 }, "model": { "type": "string", "minLength": 1 }, "temperature": { "type": "number" }, "maxTokens": { "type": "number" }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } }, "promptingTechnique": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "few_shot", "in_context", "chain_of_thought" ] }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } } }, "required": [ "type" ] }, "responseFormat": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": [ "object", "null" ], "properties": { "name": { "type": "string" }, "schema": { "type": "object", "additionalProperties": true } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "versionId": { "type": "string" } }, "required": [ "name", "versionId" ] }, "default": [] } }, "required": [ "id", "handle", "scope", "name", "updatedAt", "projectId", "organizationId", "versionId", "version", "createdAt", "prompt", "messages", "inputs", "outputs", "model", "tags" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Prompt not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiPromptsByIdVersions", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Get all versions for a prompt. Does not include base prompt data, only versioned data." } }, "/api/prompts/{id}/versions/{versionId}/restore": { "post": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "handle": { "type": [ "string", "null" ] }, "scope": { "type": "string", "enum": [ "ORGANIZATION", "PROJECT" ] }, "name": { "type": "string" }, "updatedAt": { "type": "string" }, "projectId": { "type": "string" }, "organizationId": { "type": "string" }, "versionId": { "type": "string" }, "authorId": { "type": [ "string", "null" ] }, "version": { "type": "number" }, "createdAt": { "type": "string" }, "commitMessage": { "type": [ "string", "null" ] }, "prompt": { "type": "string" }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "enum": [ "user", "assistant", "system" ] }, "content": { "type": "string" } }, "required": [ "role", "content" ] }, "default": [] }, "inputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "image", "list", "list[str]", "list[float]", "list[int]", "list[bool]", "dict", "chat_messages" ] } }, "required": [ "identifier", "type" ] }, "default": [] }, "outputs": { "type": "array", "items": { "type": "object", "properties": { "identifier": { "type": "string", "minLength": 1 }, "type": { "type": "string", "enum": [ "str", "float", "bool", "json_schema" ] }, "json_schema": { "type": "object", "properties": { "type": { "type": "string", "minLength": 1 } }, "required": [ "type" ], "additionalProperties": true } }, "required": [ "identifier", "type" ] }, "minItems": 1 }, "model": { "type": "string", "minLength": 1 }, "temperature": { "type": "number" }, "maxTokens": { "type": "number" }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } }, "promptingTechnique": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "few_shot", "in_context", "chain_of_thought" ] }, "demonstrations": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "inline": { "type": "object", "properties": { "records": { "type": "object", "additionalProperties": { "type": "array", "items": {} } }, "columnTypes": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "type": { "anyOf": [ { "type": "string", "const": "string" }, { "type": "string", "const": "boolean" }, { "type": "string", "const": "number" }, { "type": "string", "const": "date" }, { "type": "string", "const": "list" }, { "type": "string", "const": "json" }, { "type": "string", "const": "spans" }, { "type": "string", "const": "rag_contexts" }, { "type": "string", "const": "chat_messages" }, { "type": "string", "const": "annotations" }, { "type": "string", "const": "evaluations" }, { "type": "string", "const": "image" } ] } }, "required": [ "name", "type" ] } } }, "required": [ "records", "columnTypes" ] } } } }, "required": [ "type" ] }, "responseFormat": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "json_schema" ] }, "json_schema": { "type": [ "object", "null" ], "properties": { "name": { "type": "string" }, "schema": { "type": "object", "additionalProperties": true } }, "required": [ "name", "schema" ] } }, "required": [ "type", "json_schema" ] }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "versionId": { "type": "string" } }, "required": [ "name", "versionId" ] }, "default": [] } }, "required": [ "id", "handle", "scope", "name", "updatedAt", "projectId", "organizationId", "versionId", "version", "createdAt", "prompt", "messages", "inputs", "outputs", "model", "tags" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Prompt or version not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiPromptsByIdVersionsByVersionIdRestore", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true }, { "schema": { "type": "string" }, "in": "path", "name": "versionId", "required": true } ], "description": "Restore a prompt to a previous version. Creates a new version with the same config data as the specified version." } }, "/api/scenario-events": { "post": { "responses": { "201": { "description": "Event created successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "url": { "type": [ "string", "null" ] } }, "required": [ "success" ] } } } }, "400": { "description": "Invalid event data", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiScenario-events", "parameters": [], "description": "Create a new scenario event", "requestBody": { "content": { "application/json": { "schema": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "SCENARIO_RUN_STARTED" }, "timestamp": { "type": "number" }, "rawEvent": {}, "batchRunId": { "type": "string" }, "scenarioId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "scenarioSetId": { "type": "string", "default": "default" }, "metadata": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" }, "langwatch": { "type": "object", "properties": { "targetReferenceId": { "type": "string" }, "targetType": { "type": "string", "enum": [ "prompt", "http", "code", "workflow" ] }, "simulationSuiteId": { "type": "string" } }, "required": [ "targetReferenceId", "targetType" ] } }, "additionalProperties": true } }, "required": [ "type", "timestamp", "batchRunId", "scenarioId", "scenarioRunId", "metadata" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "SCENARIO_RUN_FINISHED" }, "timestamp": { "type": "number" }, "rawEvent": {}, "batchRunId": { "type": "string" }, "scenarioId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "scenarioSetId": { "type": "string", "default": "default" }, "status": { "type": "string", "enum": [ "SUCCESS", "ERROR", "CANCELLED", "IN_PROGRESS", "PENDING", "FAILED", "STALLED", "QUEUED", "RUNNING" ] }, "results": { "type": [ "object", "null" ], "properties": { "verdict": { "type": "string", "enum": [ "success", "failure", "inconclusive" ] }, "reasoning": { "type": "string" }, "metCriteria": { "type": "array", "items": { "type": "string" } }, "unmetCriteria": { "type": "array", "items": { "type": "string" } }, "error": { "type": "string" } }, "required": [ "verdict", "metCriteria", "unmetCriteria" ] } }, "required": [ "type", "timestamp", "batchRunId", "scenarioId", "scenarioRunId", "status" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "SCENARIO_MESSAGE_SNAPSHOT" }, "timestamp": { "type": "number" }, "rawEvent": {}, "messages": { "type": "array", "items": { "allOf": [ { "anyOf": [ { "oneOf": [ { "type": "object", "properties": { "id": { "type": "string" }, "role": { "type": "string", "const": "developer" }, "content": { "type": "string" }, "name": { "type": "string" }, "encryptedValue": { "type": "string" } }, "required": [ "id", "role", "content" ] }, { "type": "object", "properties": { "id": { "type": "string" }, "role": { "type": "string", "const": "system" }, "content": { "type": "string" }, "name": { "type": "string" }, "encryptedValue": { "type": "string" } }, "required": [ "id", "role", "content" ] }, { "type": "object", "properties": { "id": { "type": "string" }, "role": { "type": "string", "const": "assistant" }, "content": { "type": "string" }, "name": { "type": "string" }, "encryptedValue": { "type": "string" }, "toolCalls": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string", "const": "function" }, "function": { "type": "object", "properties": { "name": { "type": "string" }, "arguments": { "type": "string" } }, "required": [ "name", "arguments" ] }, "encryptedValue": { "type": "string" } }, "required": [ "id", "type", "function" ] } } }, "required": [ "id", "role" ] }, { "type": "object", "properties": { "id": { "type": "string" }, "role": { "type": "string", "const": "user" }, "content": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type", "text" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "image" }, "source": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "data" }, "value": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "value", "mimeType" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "url" }, "value": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "value" ] } ] }, "metadata": {} }, "required": [ "type", "source" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "audio" }, "source": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "data" }, "value": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "value", "mimeType" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "url" }, "value": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "value" ] } ] }, "metadata": {} }, "required": [ "type", "source" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "video" }, "source": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "data" }, "value": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "value", "mimeType" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "url" }, "value": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "value" ] } ] }, "metadata": {} }, "required": [ "type", "source" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "document" }, "source": { "oneOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "data" }, "value": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "value", "mimeType" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "url" }, "value": { "type": "string" }, "mimeType": { "type": "string" } }, "required": [ "type", "value" ] } ] }, "metadata": {} }, "required": [ "type", "source" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "binary" }, "mimeType": { "type": "string" }, "id": { "type": "string" }, "url": { "type": "string" }, "data": { "type": "string" }, "filename": { "type": "string" } }, "required": [ "type", "mimeType" ] } ] } } ] }, "name": { "type": "string" }, "encryptedValue": { "type": "string" } }, "required": [ "id", "role", "content" ] }, { "type": "object", "properties": { "id": { "type": "string" }, "content": { "type": "string" }, "role": { "type": "string", "const": "tool" }, "toolCallId": { "type": "string" }, "error": { "type": "string" }, "encryptedValue": { "type": "string" } }, "required": [ "id", "content", "role", "toolCallId" ] }, { "type": "object", "properties": { "id": { "type": "string" }, "role": { "type": "string", "const": "activity" }, "activityType": { "type": "string" }, "content": { "type": "object", "additionalProperties": {} } }, "required": [ "id", "role", "activityType", "content" ] }, { "type": "object", "properties": { "id": { "type": "string" }, "role": { "type": "string", "const": "reasoning" }, "content": { "type": "string" }, "encryptedValue": { "type": "string" } }, "required": [ "id", "role", "content" ] } ] }, { "type": "object", "properties": { "role": { "anyOf": [ { "type": "string", "const": "system" }, { "type": "string", "const": "user" }, { "type": "string", "const": "assistant" }, { "type": "string", "const": "function" }, { "type": "string", "const": "tool" }, { "type": "string", "const": "unknown" } ] }, "content": { "anyOf": [ { "type": "string" }, { "type": "array", "items": { "anyOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "content": { "type": "string" } }, "required": [ "type" ] }, { "type": "object", "properties": { "text": { "type": "string" } }, "required": [ "text" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "image_url" }, "image_url": { "type": "object", "properties": { "url": { "type": "string" }, "detail": { "anyOf": [ { "type": "string", "const": "auto" }, { "type": "string", "const": "low" }, { "type": "string", "const": "high" } ] } }, "required": [ "url" ] } }, "required": [ "type" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "args": { "type": "string" } }, "required": [ "type" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_result" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "result": {} }, "required": [ "type" ] } ] } }, { "type": "null" } ] }, "parts": { "type": "array", "items": { "anyOf": [ { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "text": { "type": "string" } }, "required": [ "type" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "text" }, "content": { "type": "string" } }, "required": [ "type" ] }, { "type": "object", "properties": { "text": { "type": "string" } }, "required": [ "text" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "image_url" }, "image_url": { "type": "object", "properties": { "url": { "type": "string" }, "detail": { "anyOf": [ { "type": "string", "const": "auto" }, { "type": "string", "const": "low" }, { "type": "string", "const": "high" } ] } }, "required": [ "url" ] } }, "required": [ "type" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_call" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "args": { "type": "string" } }, "required": [ "type" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "tool_result" }, "toolName": { "type": "string" }, "toolCallId": { "type": "string" }, "result": {} }, "required": [ "type" ] } ] } }, "function_call": { "type": [ "object", "null" ], "properties": { "name": { "type": "string" }, "arguments": { "type": "string" } } }, "tool_calls": { "type": [ "array", "null" ], "items": { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string" }, "function": { "type": "object", "properties": { "name": { "type": "string" }, "arguments": { "type": "string" } } } }, "required": [ "id", "type", "function" ] } }, "tool_call_id": { "type": [ "string", "null" ] }, "name": { "type": [ "string", "null" ] }, "reasoning_content": { "type": [ "string", "null" ] } } } ] }, { "type": "object", "properties": { "id": { "type": "string" }, "trace_id": { "type": "string" } } } ] } }, "batchRunId": { "type": "string" }, "scenarioId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "scenarioSetId": { "type": "string", "default": "default" } }, "required": [ "type", "timestamp", "messages", "batchRunId", "scenarioId", "scenarioRunId" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "SCENARIO_TEXT_MESSAGE_START" }, "timestamp": { "type": "number" }, "rawEvent": {}, "batchRunId": { "type": "string" }, "scenarioId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "scenarioSetId": { "type": "string", "default": "default" }, "messageId": { "type": "string" }, "role": { "type": "string" }, "messageIndex": { "type": "number" } }, "required": [ "type", "timestamp", "batchRunId", "scenarioId", "scenarioRunId", "messageId", "role" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "SCENARIO_TEXT_MESSAGE_END" }, "timestamp": { "type": "number" }, "rawEvent": {}, "batchRunId": { "type": "string" }, "scenarioId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "scenarioSetId": { "type": "string", "default": "default" }, "messageId": { "type": "string" }, "role": { "type": "string" }, "content": { "type": "string" }, "message": { "type": "object", "additionalProperties": {} }, "traceId": { "type": "string" }, "messageIndex": { "type": "number" } }, "required": [ "type", "timestamp", "batchRunId", "scenarioId", "scenarioRunId", "messageId", "role" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "SCENARIO_TEXT_MESSAGE_CONTENT" }, "timestamp": { "type": "number" }, "rawEvent": {}, "batchRunId": { "type": "string" }, "scenarioId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "scenarioSetId": { "type": "string", "default": "default" }, "messageId": { "type": "string" }, "delta": { "type": "string" } }, "required": [ "type", "timestamp", "batchRunId", "scenarioId", "scenarioRunId", "messageId", "delta" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "SCENARIO_TOOL_CALL_START" }, "timestamp": { "type": "number" }, "rawEvent": {}, "batchRunId": { "type": "string" }, "scenarioId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "scenarioSetId": { "type": "string", "default": "default" }, "toolCallId": { "type": "string" }, "toolCallName": { "type": "string" }, "parentMessageId": { "type": "string" } }, "required": [ "type", "timestamp", "batchRunId", "scenarioId", "scenarioRunId", "toolCallId", "toolCallName" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "SCENARIO_TOOL_CALL_ARGS" }, "timestamp": { "type": "number" }, "rawEvent": {}, "batchRunId": { "type": "string" }, "scenarioId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "scenarioSetId": { "type": "string", "default": "default" }, "toolCallId": { "type": "string" }, "delta": { "type": "string" } }, "required": [ "type", "timestamp", "batchRunId", "scenarioId", "scenarioRunId", "toolCallId", "delta" ] }, { "type": "object", "properties": { "type": { "type": "string", "const": "SCENARIO_TOOL_CALL_END" }, "timestamp": { "type": "number" }, "rawEvent": {}, "batchRunId": { "type": "string" }, "scenarioId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "scenarioSetId": { "type": "string", "default": "default" }, "toolCallId": { "type": "string" } }, "required": [ "type", "timestamp", "batchRunId", "scenarioId", "scenarioRunId", "toolCallId" ] } ] } } } } }, "delete": { "responses": { "200": { "description": "Events deleted successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "url": { "type": [ "string", "null" ] } }, "required": [ "success" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiScenario-events", "parameters": [], "description": "Delete all events" } }, "/api/scenarios": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "situation": { "type": "string" }, "criteria": { "type": "array", "items": { "type": "string" } }, "labels": { "type": "array", "items": { "type": "string" } }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "situation", "criteria", "labels", "platformUrl" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiScenarios", "parameters": [], "description": "Get all scenarios for a project" }, "post": { "responses": { "201": { "description": "Scenario created", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "situation": { "type": "string" }, "criteria": { "type": "array", "items": { "type": "string" } }, "labels": { "type": "array", "items": { "type": "string" } }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "situation", "criteria", "labels", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiScenarios", "parameters": [], "description": "Create a new scenario", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "situation": { "type": "string" }, "criteria": { "type": "array", "items": { "type": "string" }, "default": [] }, "labels": { "type": "array", "items": { "type": "string" }, "default": [] } }, "required": [ "name", "situation" ] } } } } } }, "/api/scenarios/{id}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "situation": { "type": "string" }, "criteria": { "type": "array", "items": { "type": "string" } }, "labels": { "type": "array", "items": { "type": "string" } }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "situation", "criteria", "labels", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Scenario not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiScenariosById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Get a specific scenario by ID" }, "put": { "responses": { "200": { "description": "Scenario updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "situation": { "type": "string" }, "criteria": { "type": "array", "items": { "type": "string" } }, "labels": { "type": "array", "items": { "type": "string" } }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "situation", "criteria", "labels", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Scenario not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "putApiScenariosById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update an existing scenario", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "situation": { "type": "string" }, "criteria": { "type": "array", "items": { "type": "string" } }, "labels": { "type": "array", "items": { "type": "string" } } } } } } } }, "delete": { "responses": { "200": { "description": "Scenario archived", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "archived": { "type": "boolean" } }, "required": [ "id", "archived" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Scenario not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiScenariosById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Archive (soft-delete) a scenario" } }, "/api/secrets": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "name": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "projectId", "name", "createdAt", "updatedAt" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiSecrets", "parameters": [], "description": "List all secrets for the project (values are never returned)" }, "post": { "responses": { "201": { "description": "Secret created", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "name": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "projectId", "name", "createdAt", "updatedAt" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "409": { "description": "Secret with this name already exists", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiSecrets", "parameters": [], "description": "Create a new project secret. The value is encrypted at rest and never returned.", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]*$", "minLength": 1 }, "value": { "type": "string", "minLength": 1, "maxLength": 10000 } }, "required": [ "name", "value" ] } } } } } }, "/api/secrets/{id}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "name": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "projectId", "name", "createdAt", "updatedAt" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Secret not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiSecretsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Get a secret by its ID (value is never returned)" }, "put": { "responses": { "200": { "description": "Secret updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "projectId": { "type": "string" }, "name": { "type": "string" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "projectId", "name", "createdAt", "updatedAt" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Secret not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "putApiSecretsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update a secret's value", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "value": { "type": "string", "minLength": 1, "maxLength": 10000 } }, "required": [ "value" ] } } } } }, "delete": { "responses": { "200": { "description": "Secret deleted", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "deleted": { "type": "boolean" } }, "required": [ "id", "deleted" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Secret not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiSecretsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Delete a secret" } }, "/api/simulation-runs": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "runs": { "type": "array", "items": { "type": "object", "properties": { "scenarioId": { "type": "string" }, "batchRunId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "name": { "type": [ "string", "null" ] }, "description": { "type": [ "string", "null" ] }, "status": { "type": "string" }, "results": { "type": [ "object", "null" ], "properties": { "verdict": { "type": [ "string", "null" ] }, "reasoning": { "type": [ "string", "null" ] }, "metCriteria": { "type": "array", "items": { "type": "string" } }, "unmetCriteria": { "type": "array", "items": { "type": "string" } }, "error": { "type": [ "string", "null" ] } } }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" }, "content": { "type": "string" } }, "required": [ "role", "content" ] } }, "timestamp": { "type": "number" }, "updatedAt": { "type": "number" }, "durationInMs": { "type": "number" }, "totalCost": { "type": "number" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "scenarioId", "batchRunId", "scenarioRunId", "name", "description", "status", "results", "messages", "timestamp", "updatedAt", "durationInMs", "platformUrl" ] } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": "string" } }, "required": [ "runs" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiSimulation-runs", "parameters": [ { "in": "query", "name": "scenarioSetId", "schema": { "type": "string" } }, { "in": "query", "name": "batchRunId", "schema": { "type": "string" } }, { "in": "query", "name": "limit", "schema": { "type": "integer", "exclusiveMinimum": 0, "maximum": 100, "default": 20 } }, { "in": "query", "name": "cursor", "schema": { "type": "string" } } ], "description": "List simulation runs, optionally filtered by scenarioSetId or batchRunId" } }, "/api/simulation-runs/batches/list": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "batches": { "type": "array", "items": { "type": "object", "properties": { "batchRunId": { "type": "string" }, "totalCount": { "type": "number" }, "passCount": { "type": "number" }, "failCount": { "type": "number" }, "runningCount": { "type": "number" }, "stalledCount": { "type": "number" }, "lastRunAt": { "type": "number" }, "lastUpdatedAt": { "type": "number" }, "firstCompletedAt": { "type": [ "number", "null" ] }, "allCompletedAt": { "type": [ "number", "null" ] } }, "required": [ "batchRunId", "totalCount", "passCount", "failCount", "runningCount", "stalledCount", "lastRunAt", "lastUpdatedAt", "firstCompletedAt", "allCompletedAt" ] } }, "hasMore": { "type": "boolean" }, "nextCursor": { "type": "string" } }, "required": [ "batches" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiSimulation-runsBatchesList", "parameters": [ { "in": "query", "name": "scenarioSetId", "schema": { "type": "string" }, "required": true }, { "in": "query", "name": "limit", "schema": { "type": "integer", "exclusiveMinimum": 0, "maximum": 50, "default": 10 }, "required": false }, { "in": "query", "name": "cursor", "schema": { "type": "string" }, "required": false } ], "description": "List batch summaries for a scenario set (pass/fail counts per batch)" } }, "/api/simulation-runs/{scenarioRunId}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "scenarioId": { "type": "string" }, "batchRunId": { "type": "string" }, "scenarioRunId": { "type": "string" }, "name": { "type": [ "string", "null" ] }, "description": { "type": [ "string", "null" ] }, "status": { "type": "string" }, "results": { "type": [ "object", "null" ], "properties": { "verdict": { "type": [ "string", "null" ] }, "reasoning": { "type": [ "string", "null" ] }, "metCriteria": { "type": "array", "items": { "type": "string" } }, "unmetCriteria": { "type": "array", "items": { "type": "string" } }, "error": { "type": [ "string", "null" ] } } }, "messages": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string" }, "content": { "type": "string" } }, "required": [ "role", "content" ] } }, "timestamp": { "type": "number" }, "updatedAt": { "type": "number" }, "durationInMs": { "type": "number" }, "totalCost": { "type": "number" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "scenarioId", "batchRunId", "scenarioRunId", "name", "description", "status", "results", "messages", "timestamp", "updatedAt", "durationInMs", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Run not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiSimulation-runsByScenarioRunId", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "scenarioRunId", "required": true } ], "description": "Get a single simulation run by its ID" } }, "/api/suites": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "scenarioIds": { "type": "array", "items": { "type": "string" } }, "targets": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "prompt", "http", "code", "workflow" ] }, "referenceId": { "type": "string" } }, "required": [ "type", "referenceId" ] } }, "repeatCount": { "type": "number" }, "labels": { "type": "array", "items": { "type": "string" } }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "slug", "description", "scenarioIds", "targets", "repeatCount", "labels", "createdAt", "updatedAt", "platformUrl" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiSuites", "parameters": [], "description": "List all non-archived suites (run plans) for the project" }, "post": { "responses": { "201": { "description": "Suite created", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "scenarioIds": { "type": "array", "items": { "type": "string" } }, "targets": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "prompt", "http", "code", "workflow" ] }, "referenceId": { "type": "string" } }, "required": [ "type", "referenceId" ] } }, "repeatCount": { "type": "number" }, "labels": { "type": "array", "items": { "type": "string" } }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "slug", "description", "scenarioIds", "targets", "repeatCount", "labels", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiSuites", "parameters": [], "description": "Create a new suite (run plan)", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "description": { "type": "string" }, "scenarioIds": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, "targets": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "prompt", "http", "code", "workflow" ] }, "referenceId": { "type": "string" } }, "required": [ "type", "referenceId" ] }, "minItems": 1 }, "repeatCount": { "type": "integer", "minimum": 1, "maximum": 100, "default": 1 }, "labels": { "type": "array", "items": { "type": "string" }, "default": [] } }, "required": [ "name", "scenarioIds", "targets" ] } } } } } }, "/api/suites/{id}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "scenarioIds": { "type": "array", "items": { "type": "string" } }, "targets": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "prompt", "http", "code", "workflow" ] }, "referenceId": { "type": "string" } }, "required": [ "type", "referenceId" ] } }, "repeatCount": { "type": "number" }, "labels": { "type": "array", "items": { "type": "string" } }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "slug", "description", "scenarioIds", "targets", "repeatCount", "labels", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Suite not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiSuitesById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Get a suite (run plan) by its ID" }, "patch": { "responses": { "200": { "description": "Suite updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "scenarioIds": { "type": "array", "items": { "type": "string" } }, "targets": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "prompt", "http", "code", "workflow" ] }, "referenceId": { "type": "string" } }, "required": [ "type", "referenceId" ] } }, "repeatCount": { "type": "number" }, "labels": { "type": "array", "items": { "type": "string" } }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "slug", "description", "scenarioIds", "targets", "repeatCount", "labels", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Suite not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "patchApiSuitesById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update a suite (run plan)", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "description": { "type": [ "string", "null" ] }, "scenarioIds": { "type": "array", "items": { "type": "string" }, "minItems": 1 }, "targets": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "prompt", "http", "code", "workflow" ] }, "referenceId": { "type": "string" } }, "required": [ "type", "referenceId" ] }, "minItems": 1 }, "repeatCount": { "type": "integer", "minimum": 1, "maximum": 100 }, "labels": { "type": "array", "items": { "type": "string" } } } } } } } }, "delete": { "responses": { "200": { "description": "Suite archived", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "archived": { "type": "boolean" } }, "required": [ "id", "archived" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Suite not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiSuitesById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Archive (soft-delete) a suite (run plan)" } }, "/api/suites/{id}/duplicate": { "post": { "responses": { "201": { "description": "Suite duplicated", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "slug": { "type": "string" }, "description": { "type": [ "string", "null" ] }, "scenarioIds": { "type": "array", "items": { "type": "string" } }, "targets": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "prompt", "http", "code", "workflow" ] }, "referenceId": { "type": "string" } }, "required": [ "type", "referenceId" ] } }, "repeatCount": { "type": "number" }, "labels": { "type": "array", "items": { "type": "string" } }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "slug", "description", "scenarioIds", "targets", "repeatCount", "labels", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Suite not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiSuitesByIdDuplicate", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Duplicate a suite (run plan)" } }, "/api/suites/{id}/run": { "post": { "responses": { "200": { "description": "Suite run scheduled", "content": { "application/json": { "schema": { "type": "object", "properties": { "scheduled": { "type": "boolean" }, "batchRunId": { "type": "string" }, "setId": { "type": "string" }, "jobCount": { "type": "number" }, "skippedArchived": { "type": "object", "properties": { "scenarios": { "type": "array", "items": { "type": "string" } }, "targets": { "type": "array", "items": { "type": "string" } } }, "required": [ "scenarios", "targets" ] }, "items": { "type": "array", "items": { "type": "object", "properties": { "scenarioRunId": { "type": "string" }, "scenarioId": { "type": "string" }, "target": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "prompt", "http", "code", "workflow" ] }, "referenceId": { "type": "string" } }, "required": [ "type", "referenceId" ] }, "name": { "type": [ "string", "null" ] } }, "required": [ "scenarioRunId", "scenarioId", "target", "name" ] } } }, "required": [ "scheduled", "batchRunId", "setId", "jobCount", "skippedArchived", "items" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Suite not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiSuitesByIdRun", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Trigger a suite run. Schedules scenario executions for all active scenarios × targets × repeatCount.", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "idempotencyKey": { "type": "string" } } } } } } } }, "/api/trace/search": { "post": { "summary": "Search traces", "description": "Search for traces based on given criteria", "tags": [ "Traces" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchRequest" } } } }, "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SearchResponse" } } } } } } }, "/api/trace/{id}": { "get": { "description": "Returns single trace details based on the ID supplied", "parameters": [ { "name": "id", "in": "path", "description": "ID of trace to share", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Trace details with spans and evaluations", "content": { "application/json": { "schema": { "type": "object", "properties": { "trace_id": { "type": "string", "example": "trace_BKZL_X0TKSD4oa1aBJTc_" }, "project_id": { "type": "string", "example": "KAXYxPR8MUgTcP8CF193y" }, "metadata": { "type": "object", "properties": { "sdk_version": { "type": "string", "example": "0.1.11" }, "sdk_language": { "type": "string", "example": "python" } } }, "timestamps": { "type": "object", "properties": { "started_at": { "type": "integer", "example": 1721382486868 }, "inserted_at": { "type": "integer", "example": 1721382492894 }, "updated_at": { "type": "integer", "example": 1721382492894 } } }, "input": { "type": "object", "properties": { "value": { "type": "string", "example": "hi" } } }, "output": { "type": "object", "properties": { "value": { "type": "string", "example": "Hey there! 👋😊" } } }, "metrics": { "type": "object", "properties": { "first_token_ms": { "type": "integer", "example": 1449 }, "total_time_ms": { "type": "integer", "example": 1543 }, "prompt_tokens": { "type": "integer", "example": 20 }, "completion_tokens": { "type": "integer", "example": 7 }, "tokens_estimated": { "type": "boolean", "example": true } } }, "error": { "type": "object", "nullable": true, "properties": { "stacktrace": { "type": "array", "items": { "type": "string" } }, "message": { "type": "string" }, "has_error": { "type": "boolean" } }, "example": null }, "indexing_md5s": { "type": "array", "items": { "type": "string" }, "example": [ "cccd21e0b70c706034dfd9f7772816a3" ] }, "spans": { "type": "array", "items": { "type": "object", "properties": { "trace_id": { "type": "string", "example": "trace_BKZL_X0TKSD4oa1aBJTc_" }, "span_id": { "type": "string", "example": "span_h1xUkcUJilhudDrLeQbR_" }, "timestamps": { "type": "object", "properties": { "finished_at": { "type": "integer", "example": 1721382488392 }, "updated_at": { "type": "integer", "example": 1721382492027 }, "started_at": { "type": "integer", "example": 1721382486895 }, "first_token_at": { "type": "integer", "example": 1721382488317 }, "inserted_at": { "type": "integer", "example": 1721382492027 } } }, "type": { "type": "string", "example": "llm" }, "error": { "type": "object", "nullable": true, "properties": { "stacktrace": { "type": "array", "items": { "type": "string" } }, "message": { "type": "string" }, "has_error": { "type": "boolean" } }, "example": null }, "params": { "type": "object", "properties": { "stream": { "type": "boolean", "example": true }, "temperature": { "type": "number", "example": 1 } } }, "project_id": { "type": "string", "example": "KAXYxPR8MUgTcP8CF193y" }, "parent_id": { "type": "string", "nullable": true, "example": "span_ijZNjUMTz3ys0Z0YKwF_T" }, "name": { "type": "string", "nullable": true, "example": null }, "model": { "type": "string", "example": "openai/gpt-4o" }, "metrics": { "type": "object", "properties": { "tokens_estimated": { "type": "boolean", "example": true }, "completion_tokens": { "type": "integer", "example": 7 }, "prompt_tokens": { "type": "integer", "example": 20 } } }, "input": { "type": "object", "properties": { "type": { "type": "string", "example": "chat_messages" }, "value": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "example": "system" }, "content": { "type": "string", "example": "You are a helpful assistant that only reply in short tweet-like responses, using lots of emojis." } } }, "example": [ { "role": "system", "content": "You are a helpful assistant that only reply in short tweet-like responses, using lots of emojis." }, { "role": "user", "content": "hi" } ] } } }, "output": { "type": "object", "properties": { "type": { "type": "string", "example": "chat_messages" }, "value": { "type": "array", "items": { "type": "object", "properties": { "role": { "type": "string", "example": "assistant" }, "content": { "type": "string", "example": "Hey there! 👋😊" } } }, "example": [ { "role": "assistant", "content": "Hey there! 👋😊" } ] } } } } } }, "evaluations": { "type": "array", "items": { "type": "object", "properties": { "evaluation_id": { "type": "string", "example": "check_VCagriZHNWICSOM09dXjM" }, "name": { "type": "string", "example": "Ragas Answer Relevancy" }, "type": { "type": "string", "example": "ragas/answer_relevancy" }, "trace_id": { "type": "string", "example": "trace_BKZL_X0TKSD4oa1aBJTc_" }, "project_id": { "type": "string", "example": "KAXYxPR8MUgTcP8CF193y" }, "status": { "type": "string", "example": "error" }, "timestamps": { "type": "object", "properties": { "updated_at": { "type": "integer", "example": 1721383657788 }, "inserted_at": { "type": "integer", "example": 1721382493358 } } }, "error": { "type": "object", "properties": { "stacktrace": { "type": "array", "items": { "type": "string" }, "example": [ "TypeError: fetch failed" ] }, "message": { "type": "string", "example": "fetch failed" }, "has_error": { "type": "boolean", "example": true } } } } } } } } } } }, "400": { "description": "Unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/trace/{id}/share": { "post": { "description": "Returns a public path for a trace", "parameters": [ { "name": "id", "in": "path", "description": "ID of trace to share", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Public path created", "content": { "application/json": { "schema": { "type": "object", "properties": { "path": { "type": "string" } } } } } }, "400": { "description": "Unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/trace/{id}/unshare": { "post": { "description": "Deletes a public path for a trace", "parameters": [ { "name": "id", "in": "path", "description": "ID of trace to unshare", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "Public path deleted", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } } } } } }, "400": { "description": "Unexpected error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } } } } }, "/api/traces/search": { "post": { "responses": { "200": { "description": "Matching traces with pagination", "content": { "application/json": { "schema": { "type": "object", "properties": { "traces": { "type": "array", "items": {} }, "pagination": { "type": "object", "properties": { "totalHits": { "type": "number" }, "scrollId": { "type": "string" } }, "required": [ "totalHits" ] } }, "required": [ "traces", "pagination" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiTracesSearch", "parameters": [], "description": "Search traces for a project", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "query": { "type": "string" }, "filters": { "type": "object", "properties": { "topics.topics": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "topics.subtopics": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.user_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.thread_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.customer_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.labels": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.key": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.value": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "metadata.prompt_ids": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "traces.origin": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "traces.error": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "traces.name": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "spans.type": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "spans.model": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.guardrails_only": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.has_passed": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.has_score": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.evaluator_id.has_label": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.passed": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.score": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.state": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "evaluations.label": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.event_type": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.metrics.key": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.metrics.value": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "events.event_details.key": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] }, "annotations.hasAnnotation": { "anyOf": [ { "type": "array", "items": { "type": "string" } }, { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } ] } }, "additionalProperties": false, "default": {} }, "traceIds": { "type": "array", "items": { "type": "string" } }, "negateFilters": { "type": "boolean" }, "pageOffset": { "type": "number" }, "pageSize": { "type": "number" }, "groupBy": { "type": "string" }, "sortBy": { "type": "string" }, "sortDirection": { "type": "string" }, "updatedAt": { "type": "number" }, "scrollId": { "type": [ "string", "null" ] }, "startDate": { "anyOf": [ { "type": "number" }, { "type": "string" } ] }, "endDate": { "anyOf": [ { "type": "number" }, { "type": "string" } ] }, "format": { "type": "string", "enum": [ "digest", "json" ], "description": "Output format: 'digest' (AI-readable trace digest) or 'json' (full raw data)" }, "includeSpans": { "type": "boolean", "description": "When true, fetches full span data for each trace. Useful for bulk export. Default false." }, "llmMode": { "type": "boolean" } }, "required": [ "startDate", "endDate" ] } } } } } }, "/api/traces/{traceId}": { "get": { "responses": { "200": { "description": "Trace detail with spans, evaluations, and ASCII tree", "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Trace not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" } }, "required": [ "message" ] } } } }, "409": { "description": "Ambiguous trace ID prefix — the prefix matches more than one trace", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string" }, "candidateTraceIds": { "type": "array", "items": { "type": "string" } } }, "required": [ "message", "candidateTraceIds" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiTracesByTraceId", "parameters": [ { "name": "traceId", "in": "path", "description": "The trace ID — either the full 32-char ID or a unique prefix (≥ 8 chars). Prefix lookup is scoped to the authenticated project.", "required": true, "schema": { "type": "string" } }, { "name": "format", "in": "query", "description": "Output format: 'digest' (default, AI-readable) or 'json' (full raw data)", "required": false, "schema": { "type": "string", "enum": [ "digest", "json" ] } }, { "name": "llmMode", "in": "query", "description": "Deprecated: use format=digest instead", "required": false, "schema": { "type": "string", "enum": [ "true", "false", "1", "0" ] } } ], "description": "Get a single trace by ID." } }, "/api/triggers": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "action": { "type": "string", "enum": [ "SEND_EMAIL", "ADD_TO_DATASET", "ADD_TO_ANNOTATION_QUEUE", "SEND_SLACK_MESSAGE" ] }, "actionParams": { "type": "object", "additionalProperties": {} }, "filters": { "type": "object", "additionalProperties": {} }, "active": { "type": "boolean" }, "message": { "type": [ "string", "null" ] }, "alertType": { "type": [ "string", "null" ], "enum": [ "CRITICAL", "WARNING", "INFO", null ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "action", "actionParams", "filters", "active", "message", "alertType", "createdAt", "updatedAt", "platformUrl" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiTriggers", "parameters": [], "description": "List all active triggers (automations) for the project" }, "post": { "responses": { "201": { "description": "Trigger created", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "action": { "type": "string", "enum": [ "SEND_EMAIL", "ADD_TO_DATASET", "ADD_TO_ANNOTATION_QUEUE", "SEND_SLACK_MESSAGE" ] }, "actionParams": { "type": "object", "additionalProperties": {} }, "filters": { "type": "object", "additionalProperties": {} }, "active": { "type": "boolean" }, "message": { "type": [ "string", "null" ] }, "alertType": { "type": [ "string", "null" ], "enum": [ "CRITICAL", "WARNING", "INFO", null ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "action", "actionParams", "filters", "active", "message", "alertType", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiTriggers", "parameters": [], "description": "Create a new trigger (automation)", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "action": { "type": "string", "enum": [ "SEND_EMAIL", "ADD_TO_DATASET", "ADD_TO_ANNOTATION_QUEUE", "SEND_SLACK_MESSAGE" ] }, "actionParams": { "type": "object", "additionalProperties": {}, "default": {} }, "filters": { "type": "object", "additionalProperties": {}, "default": {} }, "message": { "type": "string" }, "alertType": { "type": "string", "enum": [ "CRITICAL", "WARNING", "INFO" ] } }, "required": [ "name", "action" ] } } } } } }, "/api/triggers/{id}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "action": { "type": "string", "enum": [ "SEND_EMAIL", "ADD_TO_DATASET", "ADD_TO_ANNOTATION_QUEUE", "SEND_SLACK_MESSAGE" ] }, "actionParams": { "type": "object", "additionalProperties": {} }, "filters": { "type": "object", "additionalProperties": {} }, "active": { "type": "boolean" }, "message": { "type": [ "string", "null" ] }, "alertType": { "type": [ "string", "null" ], "enum": [ "CRITICAL", "WARNING", "INFO", null ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "action", "actionParams", "filters", "active", "message", "alertType", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Trigger not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiTriggersById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Get a trigger by its ID" }, "patch": { "responses": { "200": { "description": "Trigger updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "action": { "type": "string", "enum": [ "SEND_EMAIL", "ADD_TO_DATASET", "ADD_TO_ANNOTATION_QUEUE", "SEND_SLACK_MESSAGE" ] }, "actionParams": { "type": "object", "additionalProperties": {} }, "filters": { "type": "object", "additionalProperties": {} }, "active": { "type": "boolean" }, "message": { "type": [ "string", "null" ] }, "alertType": { "type": [ "string", "null" ], "enum": [ "CRITICAL", "WARNING", "INFO", null ] }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "action", "actionParams", "filters", "active", "message", "alertType", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Trigger not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "patchApiTriggersById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update a trigger (name, active state, message, filters)", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "active": { "type": "boolean" }, "message": { "type": [ "string", "null" ] }, "alertType": { "type": [ "string", "null" ], "enum": [ "CRITICAL", "WARNING", "INFO", null ] }, "filters": { "type": "object", "additionalProperties": {} }, "actionParams": { "type": "object", "additionalProperties": {} } } } } } } }, "delete": { "responses": { "200": { "description": "Trigger deleted", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "deleted": { "type": "boolean" } }, "required": [ "id", "deleted" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Trigger not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiTriggersById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Delete (soft-delete) a trigger" } }, "/api/workflows": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "icon": { "type": [ "string", "null" ] }, "description": { "type": [ "string", "null" ] }, "isEvaluator": { "type": "boolean" }, "isComponent": { "type": "boolean" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "icon", "description", "isEvaluator", "isComponent", "createdAt", "updatedAt", "platformUrl" ] } } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiWorkflows", "parameters": [], "description": "List all non-archived workflows for the project" } }, "/api/workflows/{id}": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "icon": { "type": [ "string", "null" ] }, "description": { "type": [ "string", "null" ] }, "isEvaluator": { "type": "boolean" }, "isComponent": { "type": "boolean" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "icon", "description", "isEvaluator", "isComponent", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Workflow not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiWorkflowsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Get a workflow by its ID" }, "patch": { "responses": { "200": { "description": "Workflow updated", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "icon": { "type": [ "string", "null" ] }, "description": { "type": [ "string", "null" ] }, "isEvaluator": { "type": "boolean" }, "isComponent": { "type": "boolean" }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" }, "platformUrl": { "type": "string", "format": "uri" } }, "required": [ "id", "name", "icon", "description", "isEvaluator", "isComponent", "createdAt", "updatedAt", "platformUrl" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Workflow not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "patchApiWorkflowsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update a workflow's metadata (name, icon, description)", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "minLength": 1 }, "icon": { "type": "string" }, "description": { "type": "string" } } } } } } }, "delete": { "responses": { "200": { "description": "Workflow archived", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" }, "archived": { "type": "boolean" } }, "required": [ "id", "archived" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "404": { "description": "Workflow not found", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiWorkflowsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Archive (soft-delete) a workflow" } }, "/api/model-defaults": { "get": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "scope": { "type": "object", "properties": { "projectId": { "type": "string" }, "teamId": { "type": [ "string", "null" ] }, "organizationId": { "type": [ "string", "null" ] }, "organizationName": { "type": [ "string", "null" ] } }, "required": [ "projectId", "teamId", "organizationId", "organizationName" ] }, "effective": { "type": "object", "properties": { "DEFAULT": { "type": [ "object", "null" ], "properties": { "model": { "type": "string" }, "source": { "type": "string" }, "scope": { "type": [ "string", "null" ] } }, "required": [ "model", "source", "scope" ] }, "FAST": { "type": [ "object", "null" ], "properties": { "model": { "type": "string" }, "source": { "type": "string" }, "scope": { "type": [ "string", "null" ] } }, "required": [ "model", "source", "scope" ] }, "EMBEDDINGS": { "type": [ "object", "null" ], "properties": { "model": { "type": "string" }, "source": { "type": "string" }, "scope": { "type": [ "string", "null" ] } }, "required": [ "model", "source", "scope" ] } }, "required": [ "DEFAULT", "FAST", "EMBEDDINGS" ] }, "configs": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "config": { "type": "object", "additionalProperties": { "type": "string" } }, "scopes": { "type": "array", "items": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "ORGANIZATION", "TEAM", "PROJECT" ] }, "id": { "type": "string" }, "name": { "type": "string" } }, "required": [ "type", "id", "name" ] } }, "createdAt": { "type": "string" }, "updatedAt": { "type": "string" } }, "required": [ "id", "config", "scopes", "createdAt", "updatedAt" ] } } }, "required": [ "scope", "effective", "configs" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "getApiModel-defaults", "parameters": [], "description": "Snapshot of the default-model cascade for this project: effective resolution per role, plus the configs the caller can read." }, "post": { "responses": { "200": { "description": "Success", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "postApiModel-defaults", "parameters": [], "description": "Create a default-model config attached to one or more scopes. JSON keys may be roles (DEFAULT, FAST, EMBEDDINGS) or registered feature keys; missing keys inherit from a higher scope.", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "config": { "type": "object", "additionalProperties": { "type": "string" } }, "scopes": { "type": "array", "items": { "type": "object", "properties": { "scopeType": { "type": "string", "enum": [ "ORGANIZATION", "TEAM", "PROJECT" ] }, "scopeId": { "type": "string", "minLength": 1 } }, "required": [ "scopeType", "scopeId" ] }, "minItems": 1 } }, "required": [ "config", "scopes" ] } } } } } }, "/api/model-defaults/{id}": { "put": { "responses": { "204": { "description": "Updated" }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "putApiModel-defaultsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Update a config's JSON payload and/or its scope attachments. Sending `scopes: []` deletes the config.", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "config": { "type": "object", "additionalProperties": { "type": "string" } }, "scopes": { "type": "array", "items": { "type": "object", "properties": { "scopeType": { "type": "string", "enum": [ "ORGANIZATION", "TEAM", "PROJECT" ] }, "scopeId": { "type": "string", "minLength": 1 } }, "required": [ "scopeType", "scopeId" ] } } } } } } } }, "delete": { "responses": { "204": { "description": "Deleted" }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "422": { "description": "Unprocessable Entity", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } }, "500": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "error" ] } } } } }, "operationId": "deleteApiModel-defaultsById", "parameters": [ { "schema": { "type": "string" }, "in": "path", "name": "id", "required": true } ], "description": "Delete a default-model config. Scope attachments cascade." } } }, "components": { "schemas": { "Annotation": { "required": [ "name" ], "type": "object", "properties": { "id": { "description": "The ID of the annotation", "type": "string" }, "projectId": { "description": "The ID of the project", "type": "string" }, "traceId": { "description": "The ID of the trace", "type": "string" }, "comment": { "description": "The comment of the annotation", "type": "string" }, "isThumbsUp": { "description": "The thumbs up status of the annotation", "type": "boolean" }, "userId": { "description": "The ID of the user", "type": "string" }, "createdAt": { "description": "The created at of the annotation", "type": "string" }, "updatedAt": { "description": "The updated at of the annotation", "type": "string" }, "email": { "description": "The email of the user", "type": "string" } } }, "Error": { "required": [ "error", "message" ], "type": "object", "properties": { "error": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } }, "SearchRequest": { "type": "object", "properties": { "query": { "type": "string" }, "startDate": { "type": "string", "format": "date-time" }, "endDate": { "type": "string", "format": "date-time" }, "pageSize": { "type": "integer", "example": 1000 }, "scrollId": { "type": "string", "example": "123" }, "filters": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } } } }, "SearchResponse": { "type": "object", "properties": { "traces": { "type": "array", "items": { "$ref": "#/components/schemas/Trace" } }, "pagination": { "$ref": "#/components/schemas/Pagination" } } }, "Trace": { "type": "object", "properties": { "trace_id": { "type": "string" }, "project_id": { "type": "string" }, "timestamps": { "$ref": "#/components/schemas/Timestamps" }, "input": { "$ref": "#/components/schemas/Input" }, "output": { "$ref": "#/components/schemas/Output" }, "metadata": { "$ref": "#/components/schemas/Metadata" }, "metrics": { "$ref": "#/components/schemas/Metrics" }, "indexing_md5s": { "type": "array", "items": { "type": "string" } }, "error": { "type": "string", "nullable": true }, "evaluations": { "type": "array", "items": { "$ref": "#/components/schemas/Evaluation" } }, "contexts": { "type": "array", "items": {} } } }, "Timestamps": { "type": "object", "properties": { "inserted_at": { "type": "integer" }, "started_at": { "type": "integer" }, "updated_at": { "type": "integer" } } }, "Input": { "type": "object", "properties": { "value": { "type": "string" } } }, "Output": { "type": "object", "properties": { "value": { "type": "string" } } }, "Metadata": { "type": "object", "properties": { "sdk_language": { "type": "string" }, "sdk_version": { "type": "string" } } }, "Metrics": { "type": "object", "properties": { "tokens_estimated": { "type": "boolean" }, "completion_tokens": { "type": "integer" }, "prompt_tokens": { "type": "integer" }, "total_cost": { "type": "number" }, "total_time_ms": { "type": "integer" }, "first_token_ms": { "type": "integer", "nullable": true } } }, "Evaluation": { "type": "object", "properties": { "evaluation_id": { "type": "string" }, "score": { "type": "number" }, "timestamps": { "$ref": "#/components/schemas/EvaluationTimestamps" }, "evaluator_id": { "type": "string" }, "name": { "type": "string" }, "details": { "type": "string" }, "passed": { "type": "boolean" }, "label": { "type": "string", "nullable": true }, "type": { "type": "string" }, "status": { "type": "string" } } }, "EvaluationTimestamps": { "type": "object", "properties": { "finished_at": { "type": "integer" }, "updated_at": { "type": "integer" } } }, "Pagination": { "type": "object", "properties": { "page": { "type": "integer" }, "limit": { "type": "integer" }, "total": { "type": "integer" } } }, "DatasetPostEntries": { "type": "object", "properties": { "entries": { "type": "array", "items": { "type": "object", "additionalProperties": {} }, "example": [ { "input": "hi", "output": "Hello, how can I help you today?" } ] } }, "required": [ "entries" ] }, "Project": { "type": "object", "properties": { "id": { "type": "string", "description": "Project ID (project_...)" }, "name": { "type": "string" }, "slug": { "type": "string" }, "language": { "type": "string" }, "framework": { "type": "string" }, "teamId": { "type": "string" }, "piiRedactionLevel": { "type": "string", "enum": [ "STRICT", "ESSENTIAL", "DISABLED" ] }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } } }, "ApiKeyInfo": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "description": { "type": "string", "nullable": true }, "createdAt": { "type": "string", "format": "date-time" }, "expiresAt": { "type": "string", "format": "date-time", "nullable": true }, "lastUsedAt": { "type": "string", "format": "date-time", "nullable": true }, "revokedAt": { "type": "string", "format": "date-time", "nullable": true }, "roleBindings": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "role": { "type": "string", "enum": [ "ADMIN", "MEMBER", "VIEWER" ] }, "scopeType": { "type": "string", "enum": [ "ORGANIZATION", "TEAM", "PROJECT" ] }, "scopeId": { "type": "string" } } } } } } }, "securitySchemes": { "project_api_key": { "type": "apiKey", "in": "header", "name": "X-Auth-Token", "description": "Project API key for sending traces and accessing project-scoped resources. Format: sk-lw-... (no underscore). Obtain one by creating a project via the Admin API or the LangWatch UI." }, "admin_api_key": { "type": "http", "scheme": "bearer", "description": "Admin API key for organization-level operations (managing projects, API keys). Create one in Settings > API Keys or via POST /api/api-keys. Format: sk-lw-{id}_{secret}." } } } }