# Call log facets (/docs/api/logs/logs_facets)

Counts per value (outcome, status, provider, capability, endpoint, key, client…) and latency/cost ranges for the same filters as logs_list.

`GET /v1/logs/facets`

```json
{
  "operationId": "logs_facets",
  "summary": "Call log facets",
  "description": "Counts per value (outcome, status, provider, capability, endpoint, key, client…) and latency/cost ranges for the same filters as logs_list.",
  "tags": [
    "logs"
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "parameters": [
    {
      "schema": {
        "type": "string",
        "format": "date-time",
        "description": "Start of the window (default: 24 hours ago)"
      },
      "required": false,
      "description": "Start of the window (default: 24 hours ago)",
      "name": "from",
      "in": "query"
    },
    {
      "schema": {
        "type": "string",
        "format": "date-time",
        "description": "End of the window (default: now)"
      },
      "required": false,
      "description": "End of the window (default: now)",
      "name": "to",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "hit",
                "miss",
                "failed"
              ]
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "outcome",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "integer",
              "minimum": 100,
              "maximum": 599
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "http_status",
      "in": "query"
    },
    {
      "schema": {
        "type": "integer",
        "minimum": 100,
        "maximum": 599,
        "description": "Lowest HTTP status (inclusive)"
      },
      "required": false,
      "description": "Lowest HTTP status (inclusive)",
      "name": "status_min",
      "in": "query"
    },
    {
      "schema": {
        "type": "integer",
        "minimum": 100,
        "maximum": 599,
        "description": "Highest HTTP status (inclusive)"
      },
      "required": false,
      "description": "Highest HTTP status (inclusive)",
      "name": "status_max",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^(outcome|http_status|provider|capability|endpoint_id|key_id|agent_id|workspace_id|app_id|client_name|client_kind|mode|client_mode|supply_mode|credential|error_code|country|cache|billing_verdict):[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ],
        "description": "`column:value` pairs to leave out"
      },
      "required": false,
      "description": "`column:value` pairs to leave out",
      "name": "exclude",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "provider",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "capability",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "endpoint_id",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "key_id",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "agent_id",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "workspace_id",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "app_id",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "client_name",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "sdk",
                "mcp",
                "cli",
                "browser",
                "server",
                "unknown"
              ]
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "client_kind",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "mode",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "sync",
                "wait",
                "async",
                "batch",
                "list",
                "mcp"
              ]
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "client_mode",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "byok",
                "managed",
                "connected"
              ]
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "supply_mode",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "managed",
                "byok",
                "none"
              ]
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "credential",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "error_code",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "country",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "hit",
                "partial",
                "miss",
                "stale",
                "bypass"
              ]
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ]
      },
      "required": false,
      "name": "cache",
      "in": "query"
    },
    {
      "schema": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "ok",
                "charged_for_miss",
                "double_charged_retry",
                "price_mismatch",
                "unverifiable",
                "none",
                "managed",
                "mismatch"
              ]
            },
            "maxItems": 25
          },
          {
            "type": "string",
            "maxLength": 4000
          }
        ],
        "description": "Vendor billing verdicts; `mismatch` = charged_for_miss, double_charged_retry or price_mismatch"
      },
      "required": false,
      "description": "Vendor billing verdicts; `mismatch` = charged_for_miss, double_charged_retry or price_mismatch",
      "name": "billing_verdict",
      "in": "query"
    },
    {
      "schema": {
        "type": [
          "integer",
          "null"
        ],
        "minimum": 0
      },
      "required": false,
      "name": "latency_min",
      "in": "query"
    },
    {
      "schema": {
        "type": [
          "integer",
          "null"
        ],
        "minimum": 0
      },
      "required": false,
      "name": "latency_max",
      "in": "query"
    },
    {
      "schema": {
        "type": [
          "integer",
          "null"
        ],
        "minimum": 0
      },
      "required": false,
      "name": "cost_min",
      "in": "query"
    },
    {
      "schema": {
        "type": [
          "integer",
          "null"
        ],
        "minimum": 0
      },
      "required": false,
      "name": "cost_max",
      "in": "query"
    },
    {
      "schema": {
        "type": "string",
        "pattern": "^[A-Za-z0-9_.-]{1,128}$",
        "description": "Search call, parent or run id, endpoint or error code (substring)"
      },
      "required": false,
      "description": "Search call, parent or run id, endpoint or error code (substring)",
      "name": "q",
      "in": "query"
    },
    {
      "schema": {
        "type": "string",
        "pattern": "^[A-Za-z0-9_.:/@-]{1,200}$"
      },
      "required": false,
      "name": "parent_id",
      "in": "query"
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer",
                "minimum": 0
              },
              "facets": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "rows": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "value": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "total": {
                            "type": "integer",
                            "minimum": 0
                          }
                        },
                        "required": [
                          "value",
                          "total"
                        ]
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "min": {
                      "type": "number"
                    },
                    "max": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "rows",
                    "total"
                  ]
                }
              }
            },
            "required": [
              "total",
              "facets"
            ]
          }
        }
      }
    },
    "default": {
      "description": "Error",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "enum": [
                      "invalid_request",
                      "unauthorized",
                      "insufficient_balance",
                      "max_cost_exceeded",
                      "scope_denied",
                      "budget_blocked",
                      "not_found",
                      "idempotency_mismatch",
                      "invalid_meta",
                      "rate_limited",
                      "upstream_error",
                      "response_buffer_limit",
                      "provider_capacity_unavailable",
                      "grid_saturated",
                      "upstream_timeout",
                      "conflict",
                      "internal_error",
                      "account_frozen",
                      "strict_filters",
                      "plan_limit_reached",
                      "validation_failed",
                      "deadline_exceeded",
                      "cancelled"
                    ]
                  },
                  "message": {
                    "type": "string"
                  },
                  "request_id": {
                    "type": "string"
                  },
                  "call_id": {
                    "type": "string"
                  },
                  "retry_after_ms": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "details": {
                    "type": "object",
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "code",
                  "message"
                ]
              }
            },
            "required": [
              "error"
            ]
          }
        }
      }
    }
  }
}
```
