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

# Prepare the read of a turn

> Memory v2: the partial transcript while the customer speaks; the read with the same query answers from work already done. 202 at once, no receipt.



## OpenAPI

````yaml openapi/en/cell.json POST /v1/context/prefetch
openapi: 3.1.0
info:
  title: Niadra data API
  version: '1'
  description: >-
    Writing, context, history, objects, identity, privacy and governance of one
    space. Every space has a stable address, with the space and the region in
    its name.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: The space, which comes in the source key.
      region:
        default: us-east-2
        description: The region of the space, which also comes in the key.
security: []
paths:
  /v1/context/prefetch:
    post:
      tags:
        - read
      summary: Prepare the read of a turn
      description: >-
        Memory v2: send the partial transcript while the customer speaks; the
        server opens the customer's

        memory and computes the turn's slots in the background, so the `POST
        /v1/context` with the same

        `query` answers from that work. Answers 202 at once and never changes
        what a read returns. No

        receipt: only the read that uses the work leaves one. Counted against
        the key's rate limit on its

        own, so prefetches never cost a read its place.


        **Authentication.** Source key: `Authorization: Bearer nia_sk_...`.
        Required scope: `context`.
      operationId: prefetch_v1_context_prefetch_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PrefetchRequest'
        required: true
      responses:
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PrefetchResponse'
          description: Successful Response
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - sourceKey: []
components:
  schemas:
    PrefetchRequest:
      additionalProperties: false
      description: >-
        `POST /v1/context/prefetch`: the customer's turn so far, sent while they
        are still speaking, so the

        read that answers the turn finds its work done (memory v2). Same target,
        view and level as that read.
      properties:
        about:
          anyOf:
            - $ref: '#/components/schemas/Handle'
            - type: 'null'
          description: The account or partner the person acts for.
        conversation_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Conversation Id
        object:
          anyOf:
            - $ref: '#/components/schemas/ObjectRef'
            - type: 'null'
        query:
          description: >-
            The partial transcript. The read with this same `query` is served
            from the prefetch; a longer transcript still finds the customer's
            memory already open.
          maxLength: 2000
          minLength: 1
          title: Query
          type: string
        subject:
          anyOf:
            - $ref: '#/components/schemas/Handle'
            - type: 'null'
        task_id:
          anyOf:
            - maxLength: 512
              minLength: 1
              type: string
            - type: 'null'
          title: Task Id
        verification:
          $ref: '#/components/schemas/Verification'
          default: V0
        view:
          default: voice
          pattern: >-
            ^(voice|chat|brief|full|custom|account|partner|task:[a-z0-9_]{1,40})$
          title: View
          type: string
      required:
        - query
      title: PrefetchRequest
      type: object
    PrefetchResponse:
      additionalProperties: false
      properties:
        queued:
          description: >-
            False when there is nothing to prepare: the space does not have
            memory v2 on, or the server is at its bound of prefetches. The read
            answers the same either way.
          title: Queued
          type: boolean
      required:
        - queued
      title: PrefetchResponse
      type: object
    Problem:
      additionalProperties: false
      description: RFC 9457 problem details; `code` comes from the versioned error catalog.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    Handle:
      additionalProperties: false
      description: >-
        An identifier of a subject in some channel or system: a phone, an
        e-mail, a CRM id.
      properties:
        scope:
          anyOf:
            - maxLength: 256
              minLength: 1
              type: string
            - type: 'null'
          description: >-
            Namespace for scoped identifiers: the WhatsApp Business account for
            `wa_bsuid`, the system for `system_id`, the country for
            `gov_id_hmac`.
          title: Scope
        subject_kind:
          anyOf:
            - $ref: '#/components/schemas/SubjectKind'
            - type: 'null'
          description: Defaults to `person`, except for organization-only handle types.
        type:
          $ref: '#/components/schemas/HandleType'
        value:
          maxLength: 320
          minLength: 1
          title: Value
          type: string
          description: >-
            The identifier. Normalized on the server: E.164 for phones,
            lowercase for e-mail.
      required:
        - type
        - value
      title: Handle
      type: object
    ObjectRef:
      additionalProperties: false
      description: >-
        A business object in a system of record, e.g. `invoice` / `erp` /
        `0823`.
      properties:
        id:
          maxLength: 512
          minLength: 1
          title: Id
          type: string
          description: The id in that system.
        namespace:
          maxLength: 256
          minLength: 1
          title: Namespace
          type: string
          description: The system it lives in, such as `erp`.
        type:
          maxLength: 256
          minLength: 1
          title: Type
          type: string
          description: Object type, such as `invoice`, `order` or `ticket`.
      required:
        - type
        - namespace
        - id
      title: ObjectRef
      type: object
    Verification:
      description: Session verification levels. `no_customer` sits outside the V0-V4 scale.
      enum:
        - V0
        - V1
        - V2
        - V3
        - V4
        - no_customer
      title: Verification
      type: string
    SubjectKind:
      enum:
        - person
        - account
        - partner
      title: SubjectKind
      type: string
      description: >-
        A person, a customer organization (`account`) or an organization that
        takes part without being a customer (`partner`).
    HandleType:
      enum:
        - phone_e164
        - wa_id
        - wa_jid
        - wa_lid
        - wa_bsuid
        - email
        - gov_id_hmac
        - app_user_id
        - system_id
        - org_registry_hmac
        - email_domain
        - anon_id
      title: HandleType
      type: string
      description: >-
        The kind of identifier. The value is classified by its format, never by
        the field it came from.
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...

````