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.
Create a new online evaluation monitor
Create a new online evaluation monitor
Try this endpoint
app.langwatch.ai
API key · X-Auth-Token
Kept in this tab. Cleared when you reload.
Body (application/json)
Run the evaluator at this deploy label, such as production; null runs the latest.
This sends a live request to app.langwatch.ai.
Request and response examples
request.py
import osimport requestsorigin = "https://app.langwatch.ai"path = "/api/v1/monitors"api_key = os.environ["LANGWATCH_API_KEY"]headers = { "X-Auth-Token": api_key, "Content-Type": "application/json",}payload = { "mappings": { "expansions": [], },}response = requests.post( origin + path, headers=headers, json=payload,)print(response.json())const url = "https://app.langwatch.ai/api/v1/monitors";const response = await fetch(url, { method: "POST", headers: { "X-Auth-Token": process.env.LANGWATCH_API_KEY!, "Content-Type": "application/json", }, body: JSON.stringify({ "mappings": { "expansions": [] } }),});const data = await response.json();curl --request POST \ --url 'https://app.langwatch.ai/api/v1/monitors' \ --header "X-Auth-Token: $LANGWATCH_API_KEY" \ --header 'Content-Type: application/json' \ --data '{"mappings":{"expansions":[]}}'Call the LangWatch API from this project.Request: POST https://app.langwatch.ai/api/v1/monitorsReference: https://langwatch.ai/docs/api-reference/monitors/create-monitors.mdAuthentication: send the X-Auth-Token header, read from the LANGWATCH_API_KEY environment variable. Never hard-code the key.Body (application/json):```json{ "mappings": { "expansions": [] }}```Use the HTTP client this project already uses, handle non-2xx responses, and show me the parsed result.Success
application/json · Generated from schema
{ "id": "string", "name": "string", "slug": "string", "checkType": "string", "enabled": false, "executionMode": "ON_MESSAGE", "sample": 0, "level": "string", "evaluatorId": "string", "preconditions": null, "parameters": null, "mappings": null, "threadIdleTimeout": 0, "createdAt": "string", "updatedAt": "string", "autoPausedAt": "string", "autoPausedReason": "string", "evaluatorLabel": "string", "createdById": "string", "updatedById": "string", "platformUrl": "string"}Request body
application/json · Required
namestringrequiredAt least 1 character
checkTypestringrequiredAt least 1 character
executionModestringOne of
"ON_MESSAGE""AS_GUARDRAIL""MANUALLY"Default:
"ON_MESSAGE"preconditionsany[]Default:
[]parametersobjectDefault:
{}mappingsobject | nullsamplenumberMinimum 0Maximum 1
Default:
1evaluatorIdstringAt least 1 character
levelstringOne of
"trace""thread"Default:
"trace"threadIdleTimeoutinteger | nullevaluatorLabelstring | nullRun the evaluator at this deploy label, such as production; null runs the latest.
Responses
201Success
application/json
idstringrequirednamestringrequiredslugstringrequiredcheckTypestringrequiredenabledbooleanrequiredexecutionModestringrequiredOne of
"ON_MESSAGE""AS_GUARDRAIL""MANUALLY"samplenumberrequiredlevelstringrequiredevaluatorIdstring | nullrequiredpreconditionsanyrequiredparametersanyrequiredmappingsany | nullrequiredthreadIdleTimeoutnumber | nullrequiredcreatedAtstringrequiredupdatedAtstringrequiredautoPausedAtstring | nullrequiredWhen the monitor paused itself because its evaluations mostly failed.
autoPausedReasonstring | nullrequiredWhy the monitor paused itself.
evaluatorLabelstring | nullrequiredThe evaluator deploy label the monitor runs; null runs the latest version.
createdByIdstring | nullrequiredThe user who created the monitor, when recorded.
updatedByIdstring | nullrequiredThe user who changed the monitor last.
platformUrlstring (uri)required