Documentation menu

API · Queries

List a document's queries

GET /api/v1/documents/{id}/queries

Newest first. Every question ever asked of this document, with its answer.

Path parameters

  • id string required

    The document's id.

Query parameters

  • limit integer optional default 20

    How many to return.

    Example: limit=50

Returns 200

The document's questions.

  • object string

    Always list.

  • data array of Query

    Newest first, each with its answer.

    13 fields
    • id string

      The query's id.

    • object string

      Always query.

    • answer QueryAnswer

      The answer, once status is completed. See QueryAnswer.

      4 fields
      • answer object

        A string, or an object following the query's schema.

      • citations array of object

        Every page and quote the answer came from.

        2 fields
        • page integer
        • quote string
      • confidence number

        How sure the model is, from 0 to 1.

        at least 0 · at most 1

      • not_found boolean

        true when the document does not answer the question.

    • completed_at string

      When it was answered.

    • cost object

      Held, then charged, in micro-USD.

      2 fields
      • estimated_micro integer
      • settled_micro integer
    • created_at string

      When you asked.

    • document_id string

      The document it was asked of.

    • error object

      Why it failed.

      2 fields
      • message string
      • type insufficient_credits | document_too_large | document_expired | schema_mismatch | query_failed
    • instructions string

      The instructions you sent, if any.

    • model object

      The model you asked for and the one that answered.

      2 fields
      • requested string
      • used string
    • question string

      What you asked.

    • schema object

      The JSON Schema you asked the answer to follow, if any.

    • status queued | processing | completed | failed

      completed means answer is ready; failed means read error.

  • document_id string

    The document these belong to.

Errors

  • 401

    Missing, revoked or expired key

  • 402

    Payment required. Either the plan's monthly request quota is spent (quota_exceeded, trial plans only — pay as you go is never capped) or the workspace is out of credit (insufficient_credits).

  • 404

    No document or query with that id for this key (documents are scoped to the key's workspace and live/test mode)

  • 429

    Per-second burst limit for the plan exceeded; retry after Retry-After seconds

Every error has the same shape. See Errors.