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

# Ask

> Ask a question and get a grounded answer with citations from connected data.

<Snippet file="api/knowledge/ask.mdx" />


## OpenAPI

````yaml POST /v1/knowledge/ask
openapi: 3.1.0
info:
  title: Adapter API
  description: Connect and sync data from any SaaS tool.
  version: 0.1.0
servers:
  - url: https://api.adapter.com
security:
  - ApiKeyAuth: []
tags:
  - name: connections
    description: Manage OAuth connections to data sources.
paths:
  /v1/knowledge/ask:
    post:
      tags:
        - knowledge
      summary: Ask
      description: >-
        Ask a question and get a grounded answer with citations from connected
        data.
      operationId: ask
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicAskRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/PublicAskResponse'
                  - $ref: '#/components/schemas/ProcessingResponse'
                title: Response Ask
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationErrorModel'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PermissionDeniedErrorModel'
          description: Forbidden
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: >-
            Rate limit exceeded for the caller's tier. RFC 9457 problem+json
            body; IETF RateLimit-* headers and Retry-After are set.
          headers:
            Retry-After:
              description: Seconds to wait before retrying (RFC 9110).
              schema:
                type: integer
            RateLimit-Limit:
              description: Requests allowed per window.
              schema:
                type: integer
            RateLimit-Remaining:
              description: Requests remaining in the current window.
              schema:
                type: integer
            RateLimit-Reset:
              description: Delta-seconds until the window resets.
              schema:
                type: integer
            RateLimit-Policy:
              description: Active policy, e.g. '5;w=60'.
              schema:
                type: string
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/RateLimitProblemDetail'
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitProblemDetail'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorModel'
          description: Internal Server Error
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceUnavailableErrorModel'
components:
  schemas:
    PublicAskRequest:
      properties:
        query:
          type: string
          maxLength: 2000
          minLength: 1
          title: Query
          examples:
            - What are our top blockers for Q1?
        timezone:
          anyOf:
            - type: string
            - type: 'null'
          title: Timezone
          description: >-
            IANA timezone identifier (e.g. "America/New_York") for resolving
            relative

            time references like "today" or "last week". Defaults to UTC.
          examples:
            - America/New_York
        metadata:
          anyOf:
            - additionalProperties:
                type: string
              type: object
              maxProperties: 20
            - type: 'null'
          title: Metadata
          description: >-
            Restrict the evidence the model can ground its answer in to rows
            whose `metadata` contains ALL the given key/value pairs
            (AND-of-exact-match). Max 20 keys; string values only.
          examples:
            - env: staging
      additionalProperties: false
      type: object
      required:
        - query
      title: PublicAskRequest
    PublicAskResponse:
      properties:
        response:
          type: string
          title: Response
          description: The grounded answer to your question.
        citations:
          items:
            $ref: '#/components/schemas/Citation'
          type: array
          title: Citations
          description: Per-record citations grounding the answer.
        truncated:
          type: boolean
          title: Truncated
          description: >-
            True when citations were capped — more records were used than are
            returned.
        metadata:
          anyOf:
            - $ref: '#/components/schemas/PublicAskMetadata'
            - type: 'null'
          description: Observability for this answer. May be absent.
      type: object
      required:
        - response
        - citations
        - truncated
      title: PublicAskResponse
    ProcessingResponse:
      properties:
        message:
          type: string
          title: Message
        retry_after_seconds:
          type: integer
          minimum: 0
          title: Retry After Seconds
        status:
          type: string
          title: Status
      type: object
      required:
        - message
        - retry_after_seconds
        - status
      title: ProcessingResponse
      description: >-
        Returned with 202 Accepted while your data is still being contextualized
        and

        is not yet ready to answer. Processing continues automatically; retry
        after

        `retry_after_seconds`.
    AuthenticationErrorModel:
      properties:
        error_code:
          type: string
          const: authentication_error
          title: Error Code
          default: authentication_error
        message:
          type: string
          title: Message
          default: Invalid or missing credentials.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
      type: object
      title: AuthenticationErrorModel
    PermissionDeniedErrorModel:
      properties:
        error_code:
          type: string
          const: permission_denied
          title: Error Code
          default: permission_denied
        message:
          type: string
          title: Message
          default: You do not have permission to perform this action.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
      type: object
      title: PermissionDeniedErrorModel
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RateLimitProblemDetail:
      properties:
        type:
          type: string
          title: Type
          description: >-
            Stable problem-type URI, e.g.
            '{api_base_url}/errors/rate_limit_exceeded'.
        title:
          type: string
          const: Too Many Requests
          title: Title
          default: Too Many Requests
        status:
          type: integer
          const: 429
          title: Status
          default: 429
        detail:
          type: string
          title: Detail
          description: Human-readable explanation, including the retry hint.
        error_code:
          type: string
          const: rate_limit_exceeded
          title: Error Code
          default: rate_limit_exceeded
        endpoint:
          type: string
          title: Endpoint
          description: Logical endpoint the limit applies to (e.g. 'ask', 'search').
        tier:
          type: string
          title: Tier
          description: The caller's billing tier (e.g. 'free').
        limit:
          type: integer
          title: Limit
          description: Requests allowed per window for this tier + endpoint.
        remaining:
          type: integer
          title: Remaining
          description: Requests remaining in the current window (0 when blocked).
        window_seconds:
          type: integer
          title: Window Seconds
          description: Length of the fixed rate-limit window, in seconds.
        retry_after:
          type: integer
          title: Retry After
          description: Seconds to wait before retrying (mirrors the Retry-After header).
        instance:
          anyOf:
            - type: string
            - type: 'null'
          title: Instance
          description: The request path that was limited.
      type: object
      required:
        - type
        - detail
        - endpoint
        - tier
        - limit
        - remaining
        - window_seconds
        - retry_after
      title: RateLimitProblemDetail
      description: >-
        The 429 response body, exactly as ``RateLimitError.problem_detail``
        renders it —

        RFC 9457 Problem Details, served as ``application/problem+json``
        alongside the IETF

        ``RateLimit-*`` headers and ``Retry-After``. (Distinct from the legacy

        ``RateLimitErrorModel`` shape, which does not match what the handler
        emits.)
    InternalServerErrorModel:
      properties:
        error_code:
          type: string
          const: internal_server_error
          title: Error Code
          default: internal_server_error
        message:
          type: string
          title: Message
          default: An unexpected error occurred.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
      type: object
      title: InternalServerErrorModel
    ServiceUnavailableErrorModel:
      properties:
        error_code:
          type: string
          const: service_unavailable
          title: Error Code
          default: service_unavailable
        message:
          type: string
          title: Message
          default: >-
            The service is currently experiencing issues. Please try again
            later.
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
      type: object
      title: ServiceUnavailableErrorModel
    Citation:
      properties:
        entity:
          additionalProperties: true
          type: object
          title: Entity
        type:
          type: string
          title: Type
      type: object
      required:
        - entity
        - type
      title: Citation
      description: |-
        A citation grounding the answer in a specific entity from your connected
        data. `type` is the entity type (e.g. "person", "calendar_event",
        "receipt") — citations in one response typically span multiple types.
        `entity` carries the full hydrated record so clients render it without a
        second lookup.
    PublicAskMetadata:
      properties:
        total_examined:
          type: integer
          title: Total Examined
          description: How many entities were seen during answering.
        examined:
          anyOf:
            - items:
                $ref: '#/components/schemas/ExaminedRecord'
              type: array
            - type: 'null'
          title: Examined
          description: >-
            Records the agent examined while answering, most relevant first:
            cited records, then individually read, then most engaged. Present
            only when the request set `include_examined`; capped at 200 entries
            (`total_examined` is the uncapped count). Experimental — shape may
            change.
      type: object
      required:
        - total_examined
      title: PublicAskMetadata
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ExaminedRecord:
      properties:
        access_count:
          type: integer
          minimum: 0
          title: Access Count
          description: >-
            Times a tool call surfaced this record. This is intentionally loose

            product-compatible accounting: cancellation can mean a surfaced
            record

            was not delivered to a model call.
        cited:
          type: boolean
          title: Cited
          description: The final answer cited this record (matched by id or urn).
        id:
          type: string
          title: Id
          description: >-
            Id as the agent saw it: a row `_id` from `execute_query`, or a
            search

            hit's `evidence_key`.
        urn:
          anyOf:
            - type: string
            - type: 'null'
          title: Urn
          description: URN, when the surfacing tool exposed one (search hits carry it).
      type: object
      required:
        - access_count
        - cited
        - id
      title: ExaminedRecord
      description: >-
        **Experimental.** One record the agent examined while answering.
        Recorded

        server-side at tool-execution time — never produced by the model.
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: Pass your `pk_live_...` API key as a Bearer token.

````