Generic approval queue backing `withAgentRoute({ approval })`. When a route's `required_when` predicate fires, the request is short-circuited with `202 needs_approval` and persisted here for a human (or higher-scoped agent) to approve or reject. The flow, end to end: 1. The call is held, not run. It answers `202` with the error envelope (see the `NeedsApproval` response): `error.code` is `needs_approval`, `error.retryable` is `false`, `error.approval_id` names the queued row and `error.docs_url` is the dashboard page for it, `/app/approvals/{approval_id}` on the app host (links of the older form `/approvals/{approval_id}` redirect there). Treat a 202 with this body as "waiting for a person", not as success. 2. A person decides. In the dashboard, the Approvals screen (`/app/approvals`) lists pending and decided requests with the action, the requester, the method, path and body, and Approve and Reject buttons; a signed-out visitor is sent through sign-in and back. Over the API, `POST /api/approvals/{id}/approve` or `/reject` takes a person's credential (the dashboard session or a JWT not bound to an agent), never an API key or an agent's token. 3. The caller checks and retries. Poll `GET /api/approvals/{id}` until `status` is no longer `pending`. Approving does not replay the held call: once the row is `approved`, send the same request again (`request_method`, `request_path`, `request_body` on the row, from the same credential) and it runs. One approval runs one call: the resend stamps `consumed_at` on the row, and sending it a third time is held again with a new approval. A `rejected` row is final (its `reason` says why, when the reviewer gave one); a retried call after that queues a new approval. A request waits seven days by default (`expires_at`). Past that time a row that was never decided reads as `status: expired` everywhere (the API and the dashboard), approving or rejecting it answers 404, and an approved row that was not used by then no longer lets the call run.
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.
openapi: 3.2.0
info:
title: Last Price Ai Approvals API
version: 1.0.0
contact:
name: API Support
email: support@last-price.ai
license:
name: MIT
x-guidance: 'Last Price computes prices for AI agents. To price one product, service, task or usage-based call, POST /api/compute/price with what is sold and its context (currency, current price or unit cost, product type, optional competitor offer); the answer is a price with its band, the reasons, a trace and a receipt.check_url. To check a price before you pay or quote it, POST /api/price-router/verify. Every operation that carries x-payment-info can be paid on its own with no account: send it with no credential, read the 402, pay, and resend. A workspace key (x-api-key) uses a prepaid balance instead. The MCP server at /api/mcp/rpc offers the same tools.'
x-lastprice-any-of-scopes:
description: On an operation, scopes of which a credential must hold at least one (recording an outcome after a single or a batch compute). Otherwise the same rules as `x-lastprice-scopes`; a refusal is 403 `insufficient_scope` listing every scope that would do.
x-lastprice-any-scope:
description: 'On an operation, `true` when any authenticated credential may call it, a key or token limited to specific scopes included: introspection (`GET /api/me`), usage, and operations that check scopes inside (an agent''s own notifications, settings and inbox). An operation with no `x-lastprice-scopes`, `x-lastprice-any-of-scopes`, `x-required-scopes` or this marker names no scope, so only a key with no scope limits or a dashboard session can call it. The usage operations refuse a credential holding only `workspace:claim`, `team:admin` or `launches:read`. `GET /api/openapi?view=scopes` lists every operation with what it needs.'
x-lastprice-auth:
description: 'How to read an operation that declares `security: []`. In OpenAPI an empty list only says no declared scheme applies; it does not mean the operation is open. Every such operation here carries an `x-lastprice-auth` marker saying which of two cases it is. The dashboard session cookie cannot be declared as a scheme, because it is the project-scoped, chunked `sb-<project-ref>-auth-token` and is browser only, so this marker is the machine-readable record of it. Operations with a declared scheme carry no marker.'
values:
public: Needs no credential. Some of these are rate limited per IP, and the demo operations answer from a pinned demo tenant.
session-cookie: Needs a signed-in dashboard browser session. A JWT or an API key is not accepted and gets 401, so an agent or server-side integration cannot call these at all. Use `GET /api/me` to learn the tenant a credential resolves to instead of `GET /api/user/workspaces`.
x-lastprice-scopes:
description: 'The `AgentScope` values an operation requires, every one of them. A credential that lacks one gets 403 `insufficient_scope` naming the missing scopes in the shared `ErrorEnvelope` (see the `InsufficientScope` response). A credential with no recorded scopes (the dashboard session, or a key or token created without any) holds full access and passes, except an agent principal, which must hold the scopes by name or by a wildcard such as `commerce:*`. An operation without the marker names no scope a key can hold, so a scope-limited credential (a key or token with recorded scopes and no `*`, or any agent credential) gets 403 `insufficient_scope` there with no `required_scopes`, while an unscoped key, a person''s token and the dashboard session pass. The exceptions take any authenticated credential of the workspace and check what they need themselves: `GET /api/me`, the `/api/usage` reads, `POST /api/compute/price`, `POST /api/price-router`, `/api/agents/allowance`, `/api/billing/balance`, `POST /api/billing/topup`, `/api/agents/{id}/capabilities`, the `/api/api-keys` routes, the agent claim (`POST /api/agents/claim`, which needs `workspace:claim` by name) and the operations marked with `x-required-scopes`.'
x-required-roles:
description: On an operation, the workspace roles a person must hold to call it from a dashboard session, or with the person token `POST /api/auth/native-token` issues. Checked before the operation runs; any other role, or none, gets 403 `role_forbidden` with `allowed_roles` and the caller's `role`. API keys and other JWTs name no person and are governed by scopes instead. Credentials (API keys, agent keys, embed tokens) need owner, admin or member; integrations and the tenant record need owner or admin; money (balances, top-ups, refunds, credits, invoices, agent allowances) needs owner, admin or billing.
x-required-scopes:
description: 'On an operation, the scopes an API key must hold BY NAME for the operation to accept it. OpenAPI 3.0 cannot put scopes on an `apiKey` requirement, so this list records them. A wildcard (`*`, or a prefix such as `team:*`) and a key with no scopes recorded never satisfy it. Today only the team administration operations carry it, with `team:admin`. It is stricter than `x-lastprice-scopes`: no wildcard, no unscoped key and no legacy `read`, `write` or `admin` label passes it, so those operations are not marked with `x-lastprice-scopes`.'
description: 'Operations tagged Approvals across 2 of this provider''s published API definitions: last-price-ai-openapi.json, openapi.json. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.last-price.ai
description: Production API, the canonical host and the default base URL for generated clients. The interactive docs at /api-docs rewrite this origin to their own, because most operations answer no cross-origin browser call at all. They send no CORS headers, and they refuse a request carrying an Origin that is not their own with a 403. The two embeddable operations are the exception and answer registered origins; see the EmbedToken security scheme. Server-side callers send no Origin and are unaffected.
tags:
# --- truncated at 32 KB (64 KB total) ---
# Full source: https://artifacts.apis.io/last-price-ai/openapi/last-price-ai-approvals-api-openapi.yml