> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixpeek.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Monitoring and troubleshooting

> Check Mixpeek health, read retriever and engine analytics, diagnose and retry failed batches, and fix common API errors.

Find out whether Mixpeek is healthy, why a retriever is slow or empty, and why a batch failed, then fix it through the API. Everything here needs an API key and, for namespace resources, an `X-Namespace` header with your namespace id.

## Check health

| Route | Auth | What it checks |
| - | - | - |
| `GET /v1/health` | None | The API process is alive. Under 10 ms, no service calls |
| `GET /v1/health/liveness` | None | The same, shaped for container probes |
| `GET /v1/health/beat` | None | The work scheduler fired in the last 5 minutes |
| `GET /v1/health/deep` | Organization API key | Pings cache, metadata store, vector store, object storage, task queue and inference, with per-component errors |

```bash cURL theme={null}
curl "https://api.mixpeek.com/v1/health/deep" \
  -H "Authorization: Bearer $MIXPEEK_API_KEY"
```

> [!WARNING]
>
> `GET /v1/health` returns `ok` during a full outage of every service behind it, and `GET /v1/health?deep=true` is the same call: that route has no query parameters. Point service monitors at `GET /v1/health/deep`. There, `?deep=true` is real and adds data-plane checks (reading collections, probing vector store namespaces, inspecting the task queue). An anonymous call to `/v1/health/deep` returns `403`, and the platform private token returns `401`.

## Diagnose a failed or stuck batch

**1. Get the diagnosis**

```bash cURL theme={null}
curl "https://api.mixpeek.com/v1/buckets/$BUCKET_ID/batches/$BATCH_ID/diagnose" \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID"
```

```python Python theme={null}
import os
import requests

resp = requests.get(
    f"https://api.mixpeek.com/v1/buckets/{os.environ['BUCKET_ID']}/batches/{os.environ['BATCH_ID']}/diagnose",
    headers={
        "Authorization": f"Bearer {os.environ['MIXPEEK_API_KEY']}",
        "X-Namespace": os.environ["NAMESPACE_ID"],
    },
)
report = resp.json()
print(report["status"], report["failure_category"], report["failed_document_count"])
for rec in report["recommendations"]:
    print("-", rec)
```

```javascript JavaScript theme={null}
const { BUCKET_ID, BATCH_ID, MIXPEEK_API_KEY, NAMESPACE_ID } = process.env;
const resp = await fetch(
  `https://api.mixpeek.com/v1/buckets/${BUCKET_ID}/batches/${BATCH_ID}/diagnose`,
  { headers: { Authorization: `Bearer ${MIXPEEK_API_KEY}`, "X-Namespace": NAMESPACE_ID } },
);
const report = await resp.json();
console.log(report.status, report.failure_category, report.failed_document_count);
report.recommendations.forEach((rec) => console.log("-", rec));
```

The report has `status`, `health`, `failure_category` (`infrastructure`, `timeout`, `orphaned` or `pipeline`), `failure_reason`, `stuck_for_seconds`, `per_tier` detail, `infrastructure_events` (out-of-memory, preemption, node failures), `top_errors`, a sample of failed documents, and `recommendations`. `all_balanced` and `has_lost_objects` say whether every submitted object is accounted for.

**2. Run the failed work again**

| Call | Use it when |
| - | - |
| `POST /v1/buckets/{bucket_id}/batches/{batch_id}/retry` | The batch lists failed documents, for example after timeouts. Runs those documents again |
| `POST .../batches/{batch_id}/tiers/{tier_num}/retry` | One tier failed, for example out of memory. Send `{"requires_gpu": true, "priority": 50}` to give it more resources. The tier must be `FAILED`, `CANCELED` or `COMPLETED` |
| `POST .../batches/{batch_id}/resubmit` | A whole tier failed with no failed documents, such as after a node loss, or the batch is `COMPLETED` or `CANCELED` |

When `/retry` finds objects it cannot recover, its response carries a `remedy` with the exact `/resubmit` call. Mixpeek also resubmits a batch failed by a node loss or engine restart by itself at the next repair pass, every 30 minutes, up to its retry limit.

**3. Clear a stuck tier**

A tier that reads `IN_PROGRESS` with a `last_activity_at` minutes old may be stuck. `POST .../tiers/{tier_num}/heal` takes `{"action": "detect_stuck"}`, `{"action": "kill_duplicates"}` (more than one job for the same extractor) or `{"action": "sync_status"}`. Then cancel the tier with `POST .../tiers/{tier_num}/cancel`, or one job with `POST .../tiers/{tier_num}/jobs/{ray_job_id}/cancel`.

### Check it worked

`GET /v1/buckets/{bucket_id}/batches/{batch_id}` shows each tier's status. Its `progress.stage_history` times each stage (`loading`, `processing`, `writing`): a long `processing` stage points at the extractor, a long `writing` stage at the vector store. Each tier's `submission_params` records the resources it ran with. `GET .../batches/{batch_id}/logs` returns the job logs, for all tiers or one `tier_num`, and `GET .../batches/{batch_id}/failed-documents` lists failures. Follow any task with `GET /v1/tasks/{task_id}`, or find failures across the namespace with `POST /v1/tasks/list` and `{"status": "FAILED"}`.

To be told instead of polling, the [default alerts](https://docs.mixpeek.com/docs/enrich/alerts-and-triggers.md#default-alerts) email you on a failed, stalled or error-heavy batch, and the `collection.documents.batch_completed` [webhook event](https://docs.mixpeek.com/docs/enrich/alerts-and-triggers.md#events) fires when a batch finishes each collection.

## Find a slow or empty retriever

### Slow

| Call | Returns |
| - | - |
| `GET /v1/analytics/retrievers/{retriever_id}/performance` | p50, p95 and p99 latency, query and result counts over time |
| `GET /v1/analytics/retrievers/{retriever_id}/stages` | Time and candidate counts per stage |
| `GET /v1/analytics/retrievers/{retriever_id}/slow-queries` | The slowest executions with their inputs (`limit`, `hours`) |
| `GET /v1/analytics/retrievers/{retriever_id}/cache-performance` | Cache hit rate and the latency it saves |
| `POST /v1/analytics/retrievers/{retriever_id}/analyze-tuning` | Suggested parameter, cache and stage changes from the last `days` (default 7) |

`performance` takes `start_date` and `end_date` (ISO 8601) and `group_by`, for example `group_by=day`.

```bash cURL theme={null}
curl "https://api.mixpeek.com/v1/analytics/retrievers/$RETRIEVER_ID/stages" \
  -H "Authorization: Bearer $MIXPEEK_API_KEY" \
  -H "X-Namespace: $NAMESPACE_ID"
```

Common causes are an LLM stage, a large `limit` on an early stage, and filters placed after an expensive search. Put structured filters first, cut early `limit` values and rerank only the top results, and cache stable stages (see [Retrievers](https://docs.mixpeek.com/docs/retrieve/retrievers.md)). `budget_limits` on a retriever (`max_credits`, `max_time_ms`) caps what one execution can spend.

### Empty

Check in this order:

| Cause | How to confirm | Fix |
| - | - | - |
| Documents are not indexed yet | The batch task is not `COMPLETED`, or `POST /v1/collections/{collection_id}/documents/list` returns none | Wait for `COMPLETED` or `COMPLETED_WITH_ERRORS` |
| Wrong feature URI (most common) | A `warnings` entry on the response; no error is raised | Copy `vector_indexes[].feature_uri` from the collection ([Find the feature URI](https://docs.mixpeek.com/docs/extract/collections.md#find-the-feature-uri-to-search)) |
| Filter or threshold too strict | Remove `attribute_filter` stages and `min_score` or `score_threshold`, run again | Loosen, then tighten again |
| Wrong collection | The retriever's `collection_identifiers` point at a collection without those documents | Point it at the collection you processed into |
| Empty query input | An empty `inputs` value gives an empty query | Send a non-empty query |
| Degraded run | `status: "degraded"` with a `warnings` entry | A stage timed out or was skipped; see the warning |

`POST /v1/retrievers/{retriever_id}/execute/explain` shows the execution plan with per-stage candidate counts.

### A list returns an empty page

`GET /v1/collections`, `/v1/buckets` and `/v1/retrievers`, and their `POST .../list` forms, return `200` with an empty page when `X-Namespace` does not resolve for your key. The response then carries a `warnings` entry with `"resource": "namespace"` and `"reason": "unresolved"`, and the header `X-Namespace-Unresolved: true`. A namespace that does not exist and one in another organization look the same. List yours with `GET /v1/namespaces` and send one of those ids. With no warning and no header, the empty page is the true answer.

## Engine and usage analytics

| Call | Returns |
| - | - |
| `GET /v1/analytics/performance/engine` | Task execution time, queue depth, worker use |
| `GET /v1/analytics/performance/engine/bottlenecks` | The stages and operations holding processing up |
| `GET /v1/analytics/performance/engine/slow-operations` | The slowest engine operations |
| `GET /v1/analytics/extractors/performance` | Processing time per object and failure rate, per extractor |
| `GET /v1/analytics/buckets/health` | Ingest health per bucket |
| `GET /v1/analytics/usage/summary` | Spend by resource type |

To chart these in Datadog or Grafana, poll the endpoints and push the values you need:

```python export_metrics.py theme={null}
import os
import requests

resp = requests.get(
    f"https://api.mixpeek.com/v1/analytics/retrievers/{os.environ['RETRIEVER_ID']}/performance",
    headers={
        "Authorization": f"Bearer {os.environ['MIXPEEK_API_KEY']}",
        "X-Namespace": os.environ["NAMESPACE_ID"],
    },
)
print(resp.json())
```

Each request's `x-request-id` is carried into engine jobs as `additional_data.request_id`, so you can match an API call to the batch work it started. On [customer-hosted](https://docs.mixpeek.com/docs/production/customer-hosted.md) deployments you also have the Ray dashboard on port 8265 and the Ray, MongoDB and Redis metrics of your own cluster.

## API errors

Errors share one envelope. Branch on `error.code`, and follow `error.help_url` to the code's entry on the [errors page](https://docs.mixpeek.com/docs/resources/errors.md), which says what it means and what to do next. `type` is the broader class in the table below. Quote `details.request_id` to support.

```json Error response theme={null}
{
  "success": false,
  "status": 404,
  "error": {
    "message": "bucket not found",
    "type": "NotFoundError",
    "code": "not_found_error",
    "help_url": "https://mixpeek.com/docs/resources/errors#not-found-error",
    "details": { "request_id": "..." }
  }
}
```

| `type` | Status | Cause | Fix |
| - | - | - | - |
| `ValidationError` | 422 | Missing, invalid or unknown fields (`details.validation_errors` lists each), or a plan resource limit reached (`Resource limit exceeded`) | Fix the named fields, or see [Resource limits](https://docs.mixpeek.com/docs/production/limits-and-billing.md#resource-limits) |
| `AuthenticationError` | 401 | API key missing, malformed or revoked | Check `Authorization: Bearer` |
| `UnauthorizedError`, `ForbiddenError` | 403 | Valid key, but `X-Namespace` is missing or wrong, or the key lacks permission | Check the namespace and the key's [permissions](https://docs.mixpeek.com/docs/production/security.md) |
| `PlanRequiredError` | 403 | The workspace has not picked a plan; `GET /v1/organizations` shows `requires_plan: true` | Choose a plan ([Limits and billing](https://docs.mixpeek.com/docs/production/limits-and-billing.md)) |
| `PaymentRequiredError` | 402 | Mixpeek's monthly spending stop is holding new paid work; search keeps working | It lifts when Mixpeek lifts it or on `details.lifts_on` |
| `NotFoundError` | 404 | No such resource in this namespace | Check the id and namespace |
| `TooManyRequestsError` | 429 | Rate limit | Wait `Retry-After` seconds, then back off exponentially. Limits are in [Limits and billing](https://docs.mixpeek.com/docs/production/limits-and-billing.md) |
| `DependencyUnavailable` | 503 | A store could not be reached; nothing changed. `details.resource` names it | Retry after `Retry-After` |
| `InferenceServiceUnavailableError` | 503 | A model did not answer in time. `details.code` is `model_warming` or `inference_unavailable` | If `details.retryable`, retry after `details.retry_after_seconds` |
| `ProcessingError` | 500 | The engine failed | Read the task's error |

A key a request body does not declare returns `422` with `"type": "extra_forbidden"` and an `accepted_keys` list. The official SDKs send only declared keys, so this affects hand-written requests.

## Related

* [Alerts, triggers and webhooks](https://docs.mixpeek.com/docs/enrich/alerts-and-triggers.md): get notified instead of polling
* [Limits and billing](https://docs.mixpeek.com/docs/production/limits-and-billing.md): rate limits, quotas and spend
* [Retrievers](https://docs.mixpeek.com/docs/retrieve/retrievers.md): caching and stage order
* [Diagnose batch](https://docs.mixpeek.com/docs/api-reference/bucket-batches/diagnose-batch.md) in the API reference


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.