---
title: "Collect a charged request"
method: GET
path: "/v1/requests/{id}/collect"
---

# Collect a charged request

`GET /v1/requests/{id}/collect`

## Request

- Base URL: `https://api.getanyapi.com`
- URL: `https://api.getanyapi.com/v1/requests/{id}/collect`
- Auth: none required
- TypeScript: <https://skmtc.dev/getanyapi-com/apis/anyapi/docs/v1/requests/:id/collect/get.ts> (a function with typed inputs; its response is checked against the schema)

Read one charged, still-running Request through the collectUrl it was given, with no API key. Wait Retry-After seconds between reads until status is succeeded; the answer is in result.output. The link stops working once the request is gone or its connection was revoked.

## Path parameters

- `id` string, uuid, required

## Query parameters

- `token` string, required

## Response `200`

Current request snapshot.

- RequestSnapshot
  - `collectUrl` string: Present while a charged request is still running: a link that reads this one request with no API key, so whoever holds it can collect the answer. Read it no faster than Retry-After.
  - `completedAt` string, date-time
  - `costUsd` number: What a request with no result yet, or a failed one, was already charged in USD. Some lookups are charged as soon as they start and are never charged again or refunded; a result states its own cost.
  - `createdAt` string, date-time, required
  - `error` object
    - `code` string, required
  - `expiresAt` string, date-time
  - `note` string: How to finish a charged request that is still running; present with collectUrl.
  - `requestId` string, uuid, required
  - `result` object
    - `costUsd` number, required: USD charged on the ORIGINAL run, echoed for envelope parity; this re-read is free.
    - `items` integer, required: Number of result rows returned by the original run; an API that returns one record counts it as one row.
    - `jqError` string: Present only when a `jq` expression failed; `output` then carries the full unshaped result and this explains why the reshape did not apply.
    - `output` unknown, required
    - `provider` string, required: Always "AnyAPI".
    - `replayed` boolean, required: False on this cached-result endpoint; true is reserved for durable idempotency replays from POST /v1/run/{sku}.
    - `resultId` string: The id you requested, echoed so you can keep re-reading the same cached result.
    - `source` object: The source that served this run. Pass its `id` back as `source` to prefer it again, or as `ignoreSources` to avoid it. Absent when no source identity applies to the run.
      - `artworkKey` string, required: Key for this source's artwork.
      - `id` string, required: Stable identifier for this source.
      - `kind` 'anonymous' | 'brand', required: anonymous is a stable identity for an unattributed source; brand names the dataset that supplies the data.
      - `name` string, required: Display name for this source.
  - `resultExpired` boolean
  - `retryAfterSeconds` integer
  - `serviceOutcome` 'served' | 'valid_negative' | 'caller_error' | 'service_failure' | 'rejected': End-to-end AnyAPI service result when known; independent of payment settlement.
  - `settlementState` 'not_required' | 'pending' | 'settled' | 'reconcile' | 'charged_undelivered' | 'writeoff': Payment settlement state when known; independent of request lifecycle status.
  - `sku` string, required
  - `status` 'queued' | 'running' | 'succeeded' | 'failed' | 'expired', required

## Other responses

- `404`: Unknown request id or token.
- `429`: Read again after Retry-After seconds.

---

[API](https://skmtc.dev/getanyapi-com/apis/anyapi.md) - [All operations](https://skmtc.dev/getanyapi-com/apis/anyapi/llms.txt) - [OpenAPI document](https://skmtc.dev/getanyapi-com/apis/anyapi/revisions/911bb5cfb319?raw)
