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

# Poll an async request

> Status or final response of a call made with ``Prefer: respond-async``.
While it runs: 202. When done: the original status, headers and body.

The final response carries `X-Callback-Status`, `X-Callback-Attempts` and `X-Callback-Error` for a call submitted with a callback; while it runs, the `202` body has a `callback` object. Full delivery state: `GET /v1/requests/{request_id}/callback`.

Poll a call you submitted asynchronously. While it runs you get `202` with `Retry-After`; when it finishes you get the call's own status, headers and body. Polling is free. See [Async requests and webhooks](https://docs.scrapebadger.com/long-running-requests.md).


## OpenAPI

````yaml get /v1/requests/{request_id}
openapi: 3.1.0
info:
  title: ScrapeBadger Account API
  version: 1.0.0
servers:
  - url: https://scrapebadger.com
security:
  - apiKey: []
paths:
  /v1/requests/{request_id}:
    get:
      tags:
        - Agent
        - Agent
      summary: Poll an async request
      description: >-
        Status or final response of a call made with ``Prefer: respond-async``.

        While it runs: 202. When done: the original status, headers and body.


        The final response carries `X-Callback-Status`, `X-Callback-Attempts`
        and `X-Callback-Error` for a call submitted with a callback; while it
        runs, the `202` body has a `callback` object. Full delivery state: `GET
        /v1/requests/{request_id}/callback`.
      operationId: poll_request_v1_requests__request_id__get
      parameters:
        - name: request_id
          in: path
          required: true
          schema:
            type: string
            title: Request Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '202':
          description: The call is still running.
          headers:
            Location:
              description: '`/v1/requests/{request_id}`.'
              schema:
                type: string
            Retry-After:
              description: Seconds until the next poll.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AsyncAccepted'
        '404':
          description: '`request_not_found`: unknown, another account''s, or expired.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  detail:
                    type: string
                required:
                  - error
                  - detail
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AsyncAccepted:
      title: AsyncAccepted
      type: object
      description: >-
        The call is still running. Poll `next_action.url` (free) until it
        answers with the call's own status and body; do not re-submit the call
        (that would run and bill it again).
      properties:
        request_id:
          type: string
        status:
          type: string
          enum:
            - running
        retry_after_seconds:
          type: integer
          example: 5
        next_action:
          type: object
          properties:
            method:
              type: string
              enum:
                - GET
            url:
              type: string
              example: /v1/requests/6ca4ab7a-...
          required:
            - method
            - url
        detail:
          type: string
        callback:
          type: object
          description: >-
            Only on a poll of a call submitted with a callback: the delivery
            state so far (`status`, `attempts`, `last_error`).
      required:
        - request_id
        - status
        - retry_after_seconds
        - next_action
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your ScrapeBadger API key. You can find this in your dashboard at
        https://scrapebadger.com/dashboard/api-keys?utm_source=docs&utm_medium=referral

````

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