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

# Long-poll for the answer



## OpenAPI

````yaml /api-reference/openapi.yaml get /sessions/{id}/result
openapi: 3.1.0
info:
  title: Five Nine Agent API
  version: '2026-08-26'
  description: >
    Live catalogs from the open web, under signed receipts.

    Conventions (versioning via the dated `fn-version` header, request IDs,

    idempotency, rate limits, pagination, money) are documented across this

    reference; the error envelope at https://docs.fiveninelabs.com/errors; the

    event vocabulary at https://docs.fiveninelabs.com/guides/events; webhooks at

    https://docs.fiveninelabs.com/guides/webhooks.


    Honesty marker: operations tagged `x-fn-status: planned` are specced but NOT

    yet served by the live API — on any method they answer 501 not_implemented
    with

    a `surface` member naming what is missing, never 404. Everything unmarked is

    live. The changelog says when a planned surface ships.
servers:
  - url: https://api.fiveninelabs.com/v1
security:
  - bearerKey: []
paths:
  /sessions/{id}/result:
    get:
      summary: Long-poll for the answer
      parameters:
        - $ref: '#/components/parameters/FnVersion'
        - $ref: '#/components/parameters/RunId'
        - name: timeout
          in: query
          schema:
            type: integer
            minimum: 0
            maximum: 600
            default: 600
            description: >-
              seconds to block awaiting the terminal. Client-runtime footgun,
              stated: stock Node fetch (undici) times out response headers at
              300 s — use timeout ≤ 240 and loop on the 202 + Retry-After, or
              configure an undici Agent with headersTimeout: 0
        - name: format
          in: query
          schema:
            type: string
            enum:
              - json
              - ndjson
            default: json
      responses:
        '200':
          description: The answer — 200 always means the run reached a terminal
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Result'
            application/x-ndjson:
              schema:
                type: string
                description: one row per line
        '202':
          description: >-
            Timeout lapsed before the terminal — the session object plus
            Retry-After; poll again
          headers:
            Retry-After:
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Session'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  parameters:
    FnVersion:
      name: fn-version
      in: header
      required: false
      schema:
        type: string
        example: '2026-08-26'
      description: >-
        Dated API version; defaults to the account pin. Honesty note: with one
        version in existence the gateway echoes any value back as effective
        WITHOUT validating it — validation against the known-versions set is
        planned, so send only real dated versions from
        https://docs.fiveninelabs.com/changelog
    RunId:
      name: id
      in: path
      required: true
      schema:
        type: string
  schemas:
    Result:
      type: object
      required:
        - status
      properties:
        status:
          type: string
        qualified:
          type: integer
        records:
          type: integer
        rows:
          type: array
          items:
            $ref: '#/components/schemas/Row'
        unchecked:
          type: array
          items:
            type: object
        spend_usd:
          type: number
        receipts:
          type: array
          items:
            type: string
          description: receipt ids
    Session:
      type: object
      required:
        - id
        - object
        - status
        - created_at
      properties:
        id:
          type: string
          example: sess_9m2kd
        object:
          type: string
          const: session
        status:
          type: string
          description: >-
            running | judging | answered | abstained | error | stopped (open
            enum)
        query:
          type: string
        turn:
          type: integer
        spend_usd:
          type: number
        reserved_usd:
          type: number
        max_spend_usd:
          type: number
        sources:
          type: integer
        records:
          type: integer
        receipts_signed:
          type: integer
        unchecked:
          type: integer
          description: merchants never dispatched — a fact about us, stated
        key_id:
          type: string
        created_at:
          type: string
          format: date-time
        ended_at:
          type: string
          format: date-time
        metadata:
          type: object
          additionalProperties:
            type: string
        links:
          type: object
          properties:
            stream:
              type: string
            events:
              type: string
            result:
              type: string
            rows:
              type: string
            receipts:
              type: string
            console:
              type: string
              description: dashboard deep link to this run's detail view
    Row:
      type: object
      description: >
        An attributed catalog row as REST serves it (GET …/result, GET …/rows):
        { source: { domain, url }, record: { …per-source fields } }. STREAM rows
        are a different dialect — flat per-source records with no source wrapper
        (search-source.rows), and renamed fields on search-answer.rows (price →
        price_listed, id → product_id). The full three-dialect mapping is in the
        events guide ("The three row dialects"). The two REST surfaces differ:
        GET …/rows emits source.receipt_id on every row (it joins the row to the
        receipt of the pass that delivered it) and carries no fulfillment; GET
        …/result.rows omits source.receipt_id and instead carries fulfillment.
        Page …/rows for anything you intend to audit. Fields beyond these are
        source-schema-specific.
      required:
        - source
      properties:
        source:
          type: object
          properties:
            domain:
              type: string
            url:
              type: string
            receipt_id:
              type: string
        record:
          type: object
          description: the row itself — per-source schema
        fulfillment:
          type: object
          description: how the row satisfies the predicate, with evidence
      additionalProperties: true
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
            - doc_url
            - request_id
          properties:
            type:
              type: string
            code:
              type: string
            message:
              type: string
            doc_url:
              type: string
              format: uri
            request_id:
              type: string
          additionalProperties: true
  responses:
    Unauthorized:
      description: 401 invalid_key | key_revoked — key missing, unknown, or revoked
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >-
        403 missing_scope — or a cap forbids this (session_cap_exceeded |
        monthly_cap_exceeded; caps are permissions, not rates)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerKey:
      type: http
      scheme: bearer
      description: 'fn_live_… or fn_test_… — Authorization: Bearer'

````