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

# Compose a session prompt

> Compose the identity-conditioned system prompt for a coding or chat session.

Returns the prompt text, an optional voice hint derived from the subject's own writing, and a short list of recent org activity worth folding into the agent's context. `expiresAt` says how long the result stays fresh enough to cache.

Composed for the effective subject: the API key owner by default, or the subject named by the `X-Exo-Subject` header.

## Authorization

This route requires the `read` scope.

A missing or invalid credential returns 401 [`authentication_error`](/errors/authentication_error). A valid credential without the scope returns 403 [`permission_denied`](/errors/permission_denied), and the problem body names the exact scope required.

## Headers

These are request conventions the contract does not declare as parameters, so they do not appear in the schema tables below.

| Header            | Applies      | What it does                                                                                                                                           |
| ----------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `X-Exo-API-Key`   | Required     | Your Exo API key, `exo_<env>_<token>`. `Authorization: Bearer exo_...` is accepted as an alternate.                                                    |
| `X-Exo-Subject`   | Optional     | Acts for a provisioned subject instead of the key owner. An unprovisioned id returns 403 [`subject_not_provisioned`](/errors/subject_not_provisioned). |
| `Idempotency-Key` | Not honoured | This route does not replay: reads have no side effect to replay.                                                                                       |
| `X-Request-Id`    | Response     | Returned on every response, including `204`s. Quote it in a support request.                                                                           |

## Success responses

| Status | Meaning                                                                          |
| ------ | -------------------------------------------------------------------------------- |
| `200`  | The composed system prompt with voice hint, recent org context and cache expiry. |

## Errors

| Status | Code                                                   | When                                                           |
| ------ | ------------------------------------------------------ | -------------------------------------------------------------- |
| `400`  | [`invalid_request`](/errors/invalid_request)           | Malformed request, for example an invalid cursor.              |
| `401`  | [`authentication_error`](/errors/authentication_error) | Missing or invalid credentials.                                |
| `403`  | [`permission_denied`](/errors/permission_denied)       | Missing scope, or an unprovisioned subject selector.           |
| `404`  | [`not_found`](/errors/not_found)                       | The resource does not exist, or is not visible to this caller. |
| `409`  | [`conflict`](/errors/conflict)                         | A conflict with the current state of the resource.             |
| `422`  | [`validation_error`](/errors/validation_error)         | The request was understood but failed field validation.        |
| `429`  | [`rate_limit_exceeded`](/errors/rate_limit_exceeded)   | Rate limit exceeded. Retry after the Retry-After interval.     |
| `503`  | [`service_degraded`](/errors/service_degraded)         | A dependency is temporarily unavailable. Safe to retry.        |

Every error is an RFC 9457 `application/problem+json` body carrying a stable `code`, a `requestId`, and a `suggestedAction` where Exo has one. See [Errors](/platform/errors).

## Notes

* **The pack is built to be injected, not parsed.** Put `systemPrompt` into your own model's system message and you get a model that reasons and sounds like the subject.
* **Respect `expiresAt`.** It is how long the pack stays fresh enough to cache. Refetch after a `basin.shifted` event rather than on a timer if you subscribe to events.
* **`userVoiceHint` can be absent.** The voice profile is withheld until the subject has produced enough writing to measure.


## OpenAPI

````yaml openapi.json POST /v1/condition/session
openapi: 3.1.0
info:
  contact:
    name: Exo
    url: https://get-exo.com/
  description: >-
    The Exo public developer API: ingest content, retrieve identity-conditioned
    context, and read the knowledge graph. Authenticate every request with an
    Exo API key, either as the X-Exo-API-Key header or as Authorization: Bearer
    exo_... . Errors follow RFC 9457 problem+json with a stable snake_case code
    on every body.
  title: Exo API
  version: 1.0.0
servers:
  - url: https://api.get-exo.com
security:
  - ApiKeyHeader: []
  - BearerAuth: []
tags:
  - name: retrieve
    x-group: Retrieval
  - name: search
    x-group: Search
  - name: ingest
    x-group: Ingestion
  - name: jobs
    x-group: Jobs
  - name: subjects
    x-group: Subjects
  - name: recall
    x-group: Recall
  - name: graph
    x-group: Graph
  - name: insights
    x-group: Contradictions and proposals
  - name: condition
    x-group: Condition
  - name: brain
    x-group: Brain
  - name: sessions
    x-group: Coding sessions
  - name: connectors
    x-group: Connectors
  - name: events
    x-group: Events and webhooks
  - name: meta
    x-group: Identity
  - name: keys
    x-group: Keys and sandbox
  - name: usage
    x-group: Usage
  - name: settings
    x-group: Settings
  - name: exports
    x-group: Exports
  - name: team
    x-group: Team
  - name: admin
    x-group: Account and purge
paths:
  /v1/condition/session:
    post:
      tags:
        - condition
      summary: Compose a session prompt
      description: >-
        Compose the identity-conditioned system prompt for a coding or chat
        session.


        Returns the prompt text, an optional voice hint derived from the
        subject's own writing, and a short list of recent org activity worth
        folding into the agent's context. `expiresAt` says how long the result
        stays fresh enough to cache.


        Composed for the effective subject: the API key owner by default, or the
        subject named by the `X-Exo-Subject` header.
      operationId: postConditionSession
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConditionSessionRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConditioningPack'
          description: >-
            The composed system prompt with voice hint, recent org context and
            cache expiry.
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Malformed request, for example an invalid cursor.
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Missing or invalid credentials.
        '403':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Missing scope or unprovisioned subject.
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The requested resource does not exist.
        '409':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Conflict, for example a duplicate in-flight idempotent request.
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: Validation Error
        '429':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: >-
            Rate limit exceeded; retry after the interval in the Retry-After
            header.
        '503':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: A dependency is temporarily unavailable; safe to retry with backoff.
components:
  schemas:
    ConditionSessionRequest:
      description: 'POST /v1/condition/session: called by SessionStart hook.'
      properties:
        cwd:
          title: Cwd
          type: string
        gitBranch:
          anyOf:
            - type: string
            - type: 'null'
          title: Gitbranch
        orgId:
          minLength: 1
          title: Orgid
          type: string
        recentOrgActivityHours:
          default: 24
          maximum: 168
          minimum: 1
          title: Recentorgactivityhours
          type: integer
        userId:
          minLength: 1
          title: Userid
          type: string
      required:
        - userId
        - orgId
        - cwd
      title: ConditionSessionRequest
      type: object
    ConditioningPack:
      description: >-
        Everything an agent needs to answer as this subject, composed on demand.


        This is the object that turns a stored knowledge graph into a working

        session: a system prompt built from the subject's identity and current

        manifold basin, a voice hint drawn from how they actually write, and a
        short

        digest of what the rest of the org has been doing. An agent that injects
        the

        pack at session start reasons from the subject's own history instead of
        from

        a blank slate.


        ``expiresAt`` is a freshness bound, not a hard deadline: the pack stays

        usable past it, but the identity underneath may have moved, so
        recompose.

        ``userVoiceHint`` is null until the subject has written enough for a
        voice

        profile to exist, and ``orgRecentContext`` is empty on a single-member
        org or

        a quiet window.
      properties:
        expiresAt:
          format: date-time
          title: Expiresat
          type: string
        orgRecentContext:
          items:
            additionalProperties: true
            type: object
          title: Orgrecentcontext
          type: array
        systemPrompt:
          title: Systemprompt
          type: string
        usage:
          $ref: '#/components/schemas/ConditionUsage'
        userVoiceHint:
          anyOf:
            - type: string
            - type: 'null'
          title: Uservoicehint
      required:
        - systemPrompt
        - expiresAt
      title: ConditioningPack
      type: object
    Problem:
      description: |-
        RFC 9457 problem+json envelope (spec D9), documented in OpenAPI.

        Invariant: ``code`` equals the tail of the ``type`` URI
        (``https://docs.get-exo.com/errors/<code>``).
      properties:
        code:
          title: Code
          type: string
        detail:
          title: Detail
          type: string
        documentationUrl:
          anyOf:
            - type: string
            - type: 'null'
          title: Documentationurl
        errors:
          anyOf:
            - items:
                $ref: '#/components/schemas/FieldViolation'
              type: array
            - type: 'null'
          title: Errors
        requestId:
          default: ''
          title: Requestid
          type: string
        status:
          title: Status
          type: integer
        suggestedAction:
          anyOf:
            - type: string
            - type: 'null'
          title: Suggestedaction
        title:
          title: Title
          type: string
        type:
          title: Type
          type: string
      required:
        - type
        - title
        - status
        - detail
        - code
      title: Problem
      type: object
    ConditionUsage:
      description: >-
        Usage block on condition responses (spec D13), camelCase on the wire.


        The compose builders are pure SQL reads (no LLM call today), so the
        token

        fields are null; ``readUnits`` meters one unit per compose call. If a

        future builder version starts spending LLM tokens, it reports them here.
      properties:
        llmInputTokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Llminputtokens
        llmOutputTokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Llmoutputtokens
        readUnits:
          default: 1
          title: Readunits
          type: integer
      title: ConditionUsage
      type: object
    FieldViolation:
      description: A single field-level violation inside a Problem ``errors[]`` list.
      properties:
        code:
          title: Code
          type: string
        field:
          title: Field
          type: string
        message:
          title: Message
          type: string
        pointer:
          title: Pointer
          type: string
      required:
        - pointer
        - field
        - code
        - message
      title: FieldViolation
      type: object
  securitySchemes:
    ApiKeyHeader:
      description: An Exo API key (exo_...) sent as the X-Exo-API-Key header.
      in: header
      name: X-Exo-API-Key
      type: apiKey
    BearerAuth:
      description: The same Exo API key (exo_...) sent as an Authorization bearer token.
      scheme: bearer
      type: http

````