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.
Update a monitor
Update a monitor (name, enabled state, settings, etc.)
Try this endpoint
app.langwatch.ai
API key · X-Auth-Token
Kept in this tab. Cleared when you reload.
The monitor id.
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
import osimport requestsorigin = "https://app.langwatch.ai"path = "/api/v1/monitors/<id>"api_key = os.environ["LANGWATCH_API_KEY"]headers = { "X-Auth-Token": api_key, "Content-Type": "application/json",}payload = { "mappings": { "expansions": [], },}response = requests.patch( origin + path, headers=headers, json=payload,)print(response.json())const url = "https://app.langwatch.ai/api/v1/monitors/<id>";const response = await fetch(url, { method: "PATCH", 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 PATCH \ --url 'https://app.langwatch.ai/api/v1/monitors/<id>' \ --header "X-Auth-Token: $LANGWATCH_API_KEY" \ --header 'Content-Type: application/json' \ --data '{"mappings":{"expansions":[]}}'Call the LangWatch API from this project.Request: PATCH https://app.langwatch.ai/api/v1/monitors/<id>Reference: https://langwatch.ai/docs/api-reference/monitors/update-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"}Not Found
application/json · Generated from schema
{ "error": "string", "message": "string"}Path parameters
idstringrequiredThe monitor id.
Request body
application/json
namestringenabledbooleancheckTypestringexecutionModestring"ON_MESSAGE""AS_GUARDRAIL""MANUALLY"preconditionsany[]parametersobjectmappingsobject | nullsamplenumberevaluatorIdstring | nulllevelstring"trace""thread"threadIdleTimeoutinteger | nullevaluatorLabelstring | nullRun the evaluator at this deploy label, such as production; null runs the latest.
Responses
200Success
application/json
idstringrequirednamestringrequiredslugstringrequiredcheckTypestringrequiredenabledbooleanrequiredexecutionModestringrequired"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)required404Not Found
application/json
errorstringrequiredmessagestring