# Get bounded agenda context for AI classification

> Returns up to twelve requested occurrence keys, deterministic overlap
pairs, and skip counts for category (60 questions) and conflict (40
questions) pools.


`GET /calendar/profiles/{studioId}/agenda/ai-context`

## OpenAPI

````yaml openapi/agata-v1.yaml get /calendar/profiles/{studioId}/agenda/ai-context
openapi: 3.0.3
info:
  title: Agata canonical API
  version: 1.0.0
  description: Canonical contract of the Agata Go API. Every documented route is
    registered in internal/delivery/http/handler.go. Monetary amounts are
    expressed in cents and local date keys use YYYY-MM-DD.
servers:
  - url: http://localhost:{port}/api
    description: Local server
    variables:
      port:
        default: "8080"
        description: Local HTTP port
  - url: "{scheme}://{host}/api"
    description: Configurable server
    variables:
      scheme:
        default: https
        enum:
          - http
          - https
      host:
        default: api.example.com
tags:
  - name: Health check
    description: Health-check operations.
  - name: Users
    description: Users domain operations.
  - name: Profiles
    description: Studio domain operations.
  - name: Organizations
    description: Company accounts that own people and Studios. Not followable.
  - name: Public profiles
    description: Public studio reads and one-way follows. Membership is not required.
  - name: Membership
    description: Studio membership plans, Connect status, and fan subscriptions.
  - name: Messages
    description: 1:1 owner chat between a studio owner and a subscriber with the
      owner_chat perk.
  - name: Feedback
    description: Feedback domain operations.
  - name: Internal system
    description: Internal system operations.
  - name: AI capabilities
    description: Durable leases, outcomes, and reversible effects for integrated AI actions.
  - name: Finance
    description: Finance domain operations.
  - name: Goals
    description: Goals domain operations.
  - name: Pomodoro
    description: Pomodoro domain operations.
  - name: Activities
    description: Activities domain operations.
  - name: Calendar
    description: Calendar domain operations.
  - name: Library
    description: Library domain operations.
  - name: Health
    description: Health domain operations.
  - name: Nutrition
    description: Nutrition domain operations.
  - name: Notebook
    description: Notebook domain operations.
  - name: Week plan
    description: Week-plan domain operations.
  - name: Files
    description: Files domain operations.
  - name: Tags
    description: Tags domain operations.
  - name: Tasks
    description: Tasks domain operations.
  - name: Projects
    description: Projects domain operations.
  - name: Internal
    description: Internal integrations protected by Bearer session.
  - name: Internal cron
    description: Internal cron operations.
paths:
  /calendar/profiles/{studioId}/agenda/ai-context:
    get:
      tags:
        - Calendar
        - AI capabilities
      operationId: getCalendarAgendaAIContext
      summary: Get bounded agenda context for AI classification
      description: |
        Returns up to twelve requested occurrence keys, deterministic overlap
        pairs, and skip counts for category (60 questions) and conflict (40
        questions) pools.
      security:
        - sessionBearer: []
      parameters:
        - $ref: "#/components/parameters/AIStudioId"
        - name: startDateKey
          in: query
          required: true
          schema:
            type: string
        - name: endDateKey
          in: query
          required: true
          schema:
            type: string
        - name: ianaTimeZone
          in: query
          required: false
          schema:
            type: string
        - name: occurrenceKeys
          in: query
          required: false
          description: Comma-separated occurrence keys (max twelve per operation).
          schema:
            type: string
      responses:
        "200":
          description: Agenda AI context.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AICalendarContextResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/ServerError"
components:
  parameters:
    AIStudioId:
      name: studioId
      in: path
      required: true
      description: Studio identifier used for authorization and operation scope.
      schema:
        type: string
        format: uuid
  schemas:
    AICalendarContextResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          required:
            - occurrences
            - overlapPairs
            - skippedOccurrences
            - skippedPairs
          properties:
            occurrences:
              type: array
              items:
                $ref: "#/components/schemas/CalendarAgendaItem"
            overlapPairs:
              type: array
              items:
                type: object
                required:
                  - id
                  - leftOccurrenceKey
                  - rightOccurrenceKey
                  - overlapStartMs
                  - overlapEndMs
                properties:
                  id:
                    type: string
                  leftOccurrenceKey:
                    type: string
                  rightOccurrenceKey:
                    type: string
                  overlapStartMs:
                    type: integer
                    format: int64
                  overlapEndMs:
                    type: integer
                    format: int64
            skippedOccurrences:
              type: integer
              minimum: 0
            skippedPairs:
              type: integer
              minimum: 0
        request_id:
          type: string
          format: uuid
    CalendarAgendaItem:
      type: object
      properties:
        id:
          type: string
          example: 11111111-1111-4111-8111-111111111111
        source:
          type: string
          description: Operational origin projected into Calendar. Dated Activities,
            recurring expenses, income, transfers, and Week plan items are
            included automatically; email flags do not control visibility.
          example: example
        sourceId:
          type: string
          example: 11111111-1111-4111-8111-111111111111
        assignedTo:
          type: array
          items:
            type: string
          example: []
        title:
          type: string
          example: Example title
        subtitle:
          type: string
          example: Example title
        dateKey:
          type: string
          example: 2026-01-01
        href:
          type: string
          example: example
        editableInCalendar:
          type: boolean
          example: false
        emailEnabled:
          type: boolean
          example: false
        timestampMs:
          type: integer
          format: int64
          example: 1767225600000
        endTimestampMs:
          type: integer
          format: int64
          example: 1767225600000
        recurringPeriodKey:
          type: string
          example: example
        date:
          type: integer
          format: int64
          example: 1
        description:
          type: string
          example: Example content
        isRecurring:
          type: boolean
          example: false
        agendaTime:
          type: string
          example: example
        agendaTimeZone:
          type: string
          example: Europe/Madrid
        emailSendTime:
          type: string
          example: user@example.com
        localDateKey:
          type: string
          example: 2026-01-01
        endLocalDateKey:
          type: string
          example: 2026-01-05
        allDay:
          type: boolean
          example: false
        emailEachDay:
          type: boolean
          example: false
        eventStartDateKey:
          type: string
          example: 2026-01-01
        eventEndDateKey:
          type: string
          example: 2026-01-05
        notifyDayBefore:
          type: boolean
          example: false
        notifyOnDay:
          type: boolean
          example: false
      required:
        - id
        - source
        - sourceId
        - title
        - dateKey
        - href
        - editableInCalendar
        - emailEnabled
    ErrorDetail:
      type: object
      required:
        - message
      properties:
        code:
          type: string
          example: VALIDATION_ERROR
        message:
          type: string
          example: The request is not valid.
        limit_key:
          type: string
        limit:
          type: integer
        required_plan:
          type: string
          enum:
            - pro
            - business
        resolution:
          type: string
          enum:
            - upgrade_plan
            - purchase_addon
        addon_key:
          type: string
          enum:
            - extra_members
            - ai_credit_packs
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: "#/components/schemas/ErrorDetail"
        request_id:
          type: string
          format: uuid
  responses:
    BadRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    Unauthorized:
      description: Missing or invalid authentication.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    Forbidden:
      description: Acceso denegado.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
    ServerError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorResponse"
````
