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

# Data endpoints

> Discover and run third-party data endpoints — web scrapers, contact and company enrichment, search — through monid.ai, on your AI Reserve key and wallet.

The gateway brokers [monid.ai](https://monid.ai)'s marketplace of pay-per-run **data
endpoints** under `/v1/monid`, with the same API key, rate limits, wallet, and spend caps
as every other route. You never create a monid account or hold a monid key: AI Reserve
holds one workspace, every run is billed to your AI Reserve wallet at monid's published
price for that endpoint, and each run appears in your usage analytics under the model
`monid:<provider><endpoint>`.

Three verbs, mirroring monid's own API so their published request and response shapes
apply unchanged:

1. `POST /v1/monid/discover` — search endpoints in natural language. Free.
2. `POST /v1/monid/inspect` — read one endpoint's input schema and price. Free.
3. `POST /v1/monid/run` — execute an endpoint. Billed. Sync providers answer inline;
   async providers answer **202** and you poll `GET /v1/monid/runs/{job_id}`.

<Note>
  **Availability.** The surface answers `503` with code `SERVICE_UNAVAILABLE` until the
  platform's monid workspace is provisioned in your environment. Discover and inspect are
  free upstream and never touch your wallet.
</Note>

## Quickstart

```bash theme={"dark"}
# 1) Discover — free
curl -s https://api.aireserve.com/v1/monid/discover \
  -H "Authorization: Bearer $AIRESERVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "recent tweets about a topic", "limit": 5}'

# 2) Inspect — free; read the input schema and price
curl -s https://api.aireserve.com/v1/monid/inspect \
  -H "Authorization: Bearer $AIRESERVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"provider": "apify", "endpoint": "/apidojo/tweet-scraper"}'

# 3) Run — billed to your wallet
RUN=$(curl -s -w '\n%{http_code}' https://api.aireserve.com/v1/monid/run \
  -H "Authorization: Bearer $AIRESERVE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "apify",
    "endpoint": "/apidojo/tweet-scraper",
    "input": {"searchTerms": ["AI"], "maxItems": 10}
  }')
BODY=$(echo "$RUN" | sed '$d'); CODE=$(echo "$RUN" | tail -n1)

# 4) Async providers answer 202 — poll by the AI Reserve job id
if [ "$CODE" = "202" ]; then
  JOB_ID=$(echo "$BODY" | jq -r .aireserve.job_id)
  while :; do
    BODY=$(curl -s "https://api.aireserve.com/v1/monid/runs/$JOB_ID" \
      -H "Authorization: Bearer $AIRESERVE_API_KEY")
    case "$(echo "$BODY" | jq -r .aireserve.status)" in succeeded|failed) break ;; esac
    sleep 3
  done
fi
echo "$BODY" | jq .
```

## Run request

| Field      | Required | Description                                                                                                                                                                                          |
| ---------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `provider` | yes      | Provider slug from discover/inspect (e.g. `apify`, `pdl`)                                                                                                                                            |
| `endpoint` | yes      | Endpoint path from discover/inspect (e.g. `/apidojo/tweet-scraper`)                                                                                                                                  |
| `input`    | no       | Parameters matching the endpoint's `input` schema from inspect. Defaults to `{}`                                                                                                                     |
| `price`    | no       | The `price` object returned by discover/inspect for this endpoint. Optional; when supplied it sizes the submit-time wallet reserve exactly. The final charge always comes from monid's reported cost |

## Run response

The body is monid's run object, with one AI Reserve addition:

```json theme={"dark"}
{
  "runId": "01HXYZ1234567890ABCDEF",
  "provider": "pdl",
  "endpoint": "/person/enrich",
  "status": "COMPLETED",
  "output": { "full_name": "…" },
  "providerResponse": { "httpStatus": 200 },
  "price": { "type": "PER_CALL", "amount": { "value": 0.003, "currency": "USD" } },
  "billedUnits": 1,
  "aireserve": {
    "job_id": "0b2f9f7e-1111-4a5b-9c3d-abcdefabcdef",
    "status": "succeeded",
    "created_at": 1789700000,
    "completed_at": 1789700001,
    "error": null
  }
}
```

* `aireserve.job_id` is the identifier you poll and the `request_id` of the run in your
  usage analytics. monid's `runId` is an upstream identifier and is **not** accepted by
  `GET /v1/monid/runs/{job_id}`.
* **HTTP status mirrors the brokered provider on sync runs.** A `404` with
  `status: "COMPLETED"` and `providerResponse.httpStatus: 404` means the run finished and
  the provider found no match — that is a result, not a gateway error, and monid does not
  charge for it (`billedUnits: 0`, and nothing is debited from your wallet). Check
  `aireserve.status` for the run lifecycle and `providerResponse.httpStatus` for the
  provider's answer.
* `202` means the provider executes asynchronously; `aireserve.status` is `queued` or
  `running` until you poll a terminal state. Most runs complete within 1–120 seconds.

## Billing

* **Price** — monid's published price for the endpoint (`PER_CALL` flat, or `PER_RESULT`
  with an optional base fee), shown in every discover, inspect, and run response. There is
  no markup: you pay what monid charges.
* **Reserve, then settle** — a run reserves the endpoint's per-call price (or base fee plus
  one result) against your wallet at submit and settles the actual charge from monid's
  reported cost at completion. Runs the provider errored on settle at `$0`.
* **Analytics** — one usage row per run: model `monid:<provider><endpoint>`, provider
  `monid`, `media_kind: "data"`, `media_count` = units billed. Team, user, and key
  attribution and spend caps apply exactly as for chat.
* **Caps** — runs count against your per-client rate limits, and in-flight runs are capped
  per organization (25 concurrent, \$25 estimated in flight) to bound a runaway loop.

## Data handling

monid is a broker: the `input` you send is forwarded by monid to the third-party data
endpoint you selected, whose own terms apply. AI Reserve keeps only the billing skeleton of
a completed run (endpoint identity, price, units) — never the input or output content. See
the [data-handling matrix](https://privacy.aireserve.com/data-handling#providers) for the
monid.ai row.

## Errors

| Status | Code                                                   | Meaning                                                                                  |
| ------ | ------------------------------------------------------ | ---------------------------------------------------------------------------------------- |
| `400`  | `VALIDATION_ERROR`                                     | Body failed schema validation, or monid rejected the discover/inspect body               |
| `402`  | `WALLET_INSUFFICIENT_FUNDS`                            | Your wallet cannot cover the reserve                                                     |
| `404`  | `NOT_FOUND`                                            | Unknown `job_id` (or another organization's), or monid knows no such endpoint on inspect |
| `429`  | `RATE_LIMIT_EXCEEDED` / plain `{ error }`              | Per-client rate limit, or the in-flight run cap                                          |
| `502`  | `UPSTREAM_ERROR`                                       | monid rejected the run before executing it; you were not charged                         |
| `503`  | `SERVICE_UNAVAILABLE` / `provider_account_unavailable` | Surface not provisioned, or monid is unavailable; you were not charged                   |

Not proxied: monid's account, workspace, and wallet endpoints — those describe the
platform's workspace, not yours. Your balance is your AI Reserve wallet.
