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

# Get a context from Redis

> Retrieves a context object from Redis by its ID. Returns the context
with name, role, role_level, and council_sage_id.




## OpenAPI

````yaml /openapi/private/specs/services/context.yml get /context/{context_id}
openapi: 3.1.0
info:
  title: Context Service API
  description: >
    Manages context data for council sages. Context represents the job
    description,

    role, and AI-generated analysis (summary, categories, metrics) used during

    screening interviews.


    ## Authentication

    All endpoints require authentication via one of two methods:

    - **API Key**: Pass the key in the `X-Auth` header (service-to-service
    calls)

    - **JWT Token**: Pass a Bearer token in the `Authorization` header
    (user-facing calls)


    The required permission level is noted per endpoint.


    ## Context Lifecycle

    1. **Create** -- Context is created with job description, role, and role
    level

    2. **Store** -- Context is saved to Redis for fast retrieval during
    screening

    3. **Generate** -- AI analyzes the context to produce summary, categories,
    and metrics

    4. **Save** -- Generated data is persisted to the Prompt Library (PL)
    service


    ## Business Rules

    - Context is stored in Redis for low-latency access during interviews

    - `context_id` must be provided and valid for all read operations

    - The generate endpoint calls AI to produce structured analysis from the job
    context

    - Update and Delete endpoints are not yet implemented (return 501)
  version: 1.0.0
  contact:
    name: Platform Team
servers:
  - url: '{protocol}://{host}:{port}'
    description: Context Service
    variables:
      protocol:
        default: https
        enum:
          - http
          - https
      host:
        default: localhost
      port:
        default: '5000'
security: []
tags:
  - name: Context
    description: Context CRUD and AI generation
  - name: Service
    description: Health checks and initialization
paths:
  /context/{context_id}:
    get:
      tags:
        - Context
      summary: Get a context from Redis
      description: |
        Retrieves a context object from Redis by its ID. Returns the context
        with name, role, role_level, and council_sage_id.
      operationId: getContext
      parameters:
        - $ref: '#/components/parameters/ContextId'
        - $ref: '#/components/parameters/RequiredPermission_council_sage'
      responses:
        '200':
          description: Context found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContextResponse'
              example:
                id: a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d
                name: Senior Software Engineer
                context: >-
                  We are looking for a senior software engineer with 5+ years of
                  experience in Python and cloud infrastructure...
                role: Software Engineer
                role_level: senior
                council_sage_id: c3d4e5f6-7890-4abc-def0-123456789abc
        '400':
          description: Missing or invalid context ID
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: context_id must be set before loading
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Context not found in Redis
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Context with ID a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d not found
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - jwtAuth: []
components:
  parameters:
    ContextId:
      name: context_id
      in: path
      required: true
      description: UUID of the context record
      schema:
        type: string
        format: uuid
      example: a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d
    RequiredPermission_council_sage:
      name: X-Permission-Info
      in: header
      required: false
      description: >-
        **Required JWT permission: `council_sage`** (informational only --
        enforced server-side)
      schema:
        type: string
  schemas:
    ContextResponse:
      type: object
      description: Context object as returned from Redis get
      properties:
        id:
          type: string
          format: uuid
          description: Context UUID
        name:
          type: string
          description: Display name
        context:
          type: string
          description: Job description text
        role:
          type: string
          description: Role title
        role_level:
          type: string
          description: Experience level
        council_sage_id:
          type: string
          format: uuid
          description: Owning council sage
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message
  responses:
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            noApiKey:
              summary: Missing API key
              value:
                error: Unauthorized - API key required
            invalidApiKey:
              summary: Invalid API key
              value:
                error: Unauthorized - Invalid API key
            noToken:
              summary: Missing JWT token
              value:
                error: Unauthorized - No valid token
            invalidToken:
              summary: Invalid or expired JWT
              value:
                error: Unauthorized3
            insufficientPermissions:
              summary: Token lacks required permission
              value:
                error: Unauthorized4
    InternalError:
      description: Unexpected server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error: Internal server error
  securitySchemes:
    jwtAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: User JWT token passed in Authorization header

````