Skip to main content
POST
/
v2
/
auto-monitor-setups
/
bulk
Bulk Upsert Auto Monitor Setups
curl --request POST \
  --url https://app.traceloop.com/api/v2/auto-monitor-setups/bulk \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "setups": [
    {}
  ]
}
'

Documentation Index

Fetch the complete documentation index at: https://www.traceloop.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Creates or updates up to 100 auto monitor setups in one request, keyed by external_id. Designed for IaC-style clients that would otherwise fan out one HTTP call per setup. Each item is upserted independently using the same semantics as Update by External ID: if a setup with the given external_id exists in the project it is replaced (status reset to pending, evaluators replaced wholesale); otherwise it is created.
All API requests require authentication. Pass your API key as a Bearer token in the Authorization header. See Authentication for details.

Partial Success Semantics

The endpoint returns 207 Multi-Status when the batch is accepted, even if some items inside fail. Each item carries its own status (ok or error) — you must iterate the response array to check per-item results. Request-level errors (empty batch, more than 100 items, duplicate external_id within the batch, missing external_id on any item) reject the entire batch with 400 Bad Request. No items are written.

Request Body

setups
object[]
required
Array of setups to upsert. Must contain between 1 and 100 items. Each item has the same shape as the Create request body:
FieldTypeRequiredDescription
external_idstringYesUnique identifier for the setup within the project. Must be unique across items in the same batch.
evaluatorsstring[]YesList of evaluator slugs to run on matched spans. See Evaluator Slugs.
selectorobject[]NoArray of filter rules used to match spans. See the Create endpoint for the selector schema.
evaluator_configsobject[]NoOptional per-evaluator configuration overrides.

Example Request

curl -X POST https://api.traceloop.com/v2/auto-monitor-setups/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "setups": [
      {
        "external_id": "openai-gpt4o-monitor",
        "evaluators": ["answer-relevancy", "toxicity-detector"],
        "selector": [
          {"key": "gen_ai.system", "value": "openai", "source": "span_attributes"},
          {"key": "gen_ai.request.model", "value": "gpt-4o", "source": "span_attributes"}
        ]
      },
      {
        "external_id": "anthropic-monitor",
        "evaluators": ["answer-relevancy"],
        "selector": [
          {"key": "gen_ai.system", "value": "anthropic", "source": "span_attributes"}
        ]
      }
    ]
  }'

Response

207 Multi-Status

Returned when the batch is accepted. The setups array contains one entry per input item, in the same order as the request. Each entry has:
FieldTypeDescription
external_idstringThe external_id of the input item.
statusstringok if the item was upserted, error if it failed.
resultobjectPresent when status is ok. The full upserted setup, matching the Create response shape.
errorstringPresent when status is error. Human-readable message prefixed with the item index, e.g. setups[1]: unknown evaluator slug "...". Internal errors are reported as setups[N]: internal error — the underlying cause is logged server-side but not returned to the client.
{
  "setups": [
    {
      "external_id": "openai-gpt4o-monitor",
      "status": "ok",
      "result": {
        "id": "cmm...",
        "external_id": "openai-gpt4o-monitor",
        "org_id": "c108269c-...",
        "project_id": "cm9v2g95l...",
        "env_project_id": "cm9v2ga9i...",
        "init_rules": [
          { "key": "gen_ai.system", "value": "openai", "source": "span_attributes", "operator": "equals" },
          { "key": "gen_ai.request.model", "value": "gpt-4o", "source": "span_attributes", "operator": "equals" }
        ],
        "evaluators": [
          { "evaluator_type": "answer-relevancy", "status": "pending" },
          { "evaluator_type": "toxicity-detector", "status": "pending" }
        ],
        "status": "pending",
        "created_at": "2026-05-20T10:30:00Z",
        "updated_at": "2026-05-20T10:30:00Z"
      }
    },
    {
      "external_id": "anthropic-monitor",
      "status": "error",
      "error": "setups[1]: unknown evaluator slug \"answer-relevancy-typo\""
    }
  ]
}

400 Bad Request

Returned when the batch is rejected without writing any items. Causes:
  • Empty setups array
  • More than 100 items
  • Any item missing external_id
  • Two items in the batch share the same external_id
{
  "error": "setups[2]: duplicate external_id \"openai-gpt4o-monitor\" (also at setups[0])"
}

500 Internal Server Error

{
  "error": "internal server error"
}