diff --git a/api-keys.mdx b/api-keys.mdx index a51d6b8..8e6f286 100644 --- a/api-keys.mdx +++ b/api-keys.mdx @@ -55,7 +55,7 @@ create a new key instead. Keys created before access levels existed have **Full | --- | --- | | **Full access** | Everything: run APIs, and see balance, usage, billing, and history. | | **Run APIs** | Run APIs, get quotes, browse the API catalog, fetch results, check a request by its id, and use company research. It can't see balance, usage, transactions, or billing. | -| **View account** | See balance, billing settings, transactions and invoices, usage and usage reports, request activity and results, the catalog, and referral earnings. It can't run APIs or spend. | +| **View account** | See balance, billing settings, transactions and invoices, usage and usage reports, the request list and request activity, results, the catalog, and referral earnings. It can't run APIs or spend. | | **View seller earnings** | See your seller earnings, payouts, payout account, and payout quote. Nothing else. | Every level can send feedback and bug reports. A key that calls something outside its diff --git a/quickstart.mdx b/quickstart.mdx index 50fef85..f133f79 100644 --- a/quickstart.mdx +++ b/quickstart.mdx @@ -243,6 +243,39 @@ over 5 MiB is not kept. Reading them is limited to 30 reads a minute for each $1 spent; past the limit you get `429` with `Retry-After`, and an account that has spent nothing cannot read stored responses yet. +## List your requests + +The same list as the dashboard's Usage page is available with your API key: + +```bash +curl -s "https://api.getanyapi.com/v1/requests?limit=50" -H "X-API-Key: YOUR_ANYAPI_KEY" +``` + +It returns your requests newest first, by default from the last 24 hours. A key with **Full +access** or **View account** can read it; a **Run APIs** key cannot. Optional query parameters: + +| Parameter | Meaning | +| --- | --- | +| `from`, `to` | Window as Unix milliseconds. `to` defaults to now and `from` to 24 hours before `to`. A window longer than 30 days is shortened to the 30 days ending at `to`. | +| `limit` | Rows per page, 50 by default and at most 100. | +| `before` | The `nextCursor` from the previous page. | +| `level` | `success`, `error`, or `rejected`. | +| `platform` | The part of the SKU before the dot, for example `tiktok`. | +| `q` | Text matched against the SKU and the request ID, up to 100 characters. | + +Each entry in `requests` has `id`, `sku`, `level`, `httpStatus`, `costUsd`, `items`, +`latencyMs`, `auth` (`key`, `oauth`, or `dashboard`), `input`, and `createdAt`, plus `error` +when the request failed. Read the full response of one request with `GET /v1/requests/{id}` +as shown above. + +`nextCursor` is set when older requests match your parameters, and it is `null` once none +remain. Pass it as `before`, with the same other parameters, to get the next page. A page can +hold more rows than `limit`, so that requests sharing one timestamp are never split across two +pages. + +`to` defaults to now and `from` to 24 hours before `to`, so both move with the clock. To walk a +fixed window, pass explicit `from` and `to` on every call. + ## Check your balance ```bash