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

# AI-sessie samenvatten

> Vat een AI-sessie samen en retourneer de verkorte berichten en tokenstatistieken.



## OpenAPI

````yaml nl/api-reference/openapi.yaml post /api/v1/{workspace_slug}/ai/sessions/{session_id}/summarize
openapi: 3.1.0
info:
  title: Anlytic API
  version: '1.0'
  description: >-
    De Anlytic REST API. Alle endpoints zijn beschikbaar onder `/api/v1/`.


    ## Authenticatie


    Voor de meeste endpoints is een **Bearer JWT** nodig die je via de
    authenticatiestroom verkrijgt:

    1. `GET /api/v1/users/otp` — vraag een eenmalige toegangscode aan met HTTP
    Basic Auth.

    2. `GET /api/v1/users/token/{kid}` — wissel de code in voor een
    werkruimte-JWT.


    Stuur de JWT bij elke volgende aanvraag mee als `Authorization: Bearer
    <token>`.


    Je kunt ook een **API-sleutel** via dezelfde header gebruiken:
    `Authorization: API-Key <key>`.
  contact:
    name: Anlytic Support
    url: https://anlytic.com
servers:
  - url: https://app.anlytic.com
    description: Productie
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Configuratie
    description: API-configuratie en beleid
  - name: Triggers
    description: Geplande grafiektriggers en triggeracties
paths:
  /api/v1/{workspace_slug}/ai/sessions/{session_id}/summarize:
    post:
      tags:
        - AI-assistent
      summary: AI-sessie samenvatten
      description: >-
        Vat een AI-sessie samen en retourneer de verkorte berichten en
        tokenstatistieken.
      operationId: summarizeAiSession
      parameters:
        - $ref: '#/components/parameters/workspaceSlug'
        - name: session_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/UUID'
      responses:
        '200':
          description: Samengevatte sessie
          content:
            application/json:
              schema:
                type: object
                properties:
                  session:
                    $ref: '#/components/schemas/AISession'
                  messages:
                    type: array
                    items:
                      $ref: '#/components/schemas/AIMessage'
                  stats:
                    type: object
                    properties:
                      original_messages:
                        type: integer
                      summarized_messages:
                        type: integer
                      original_tokens:
                        type: integer
                      summarized_tokens:
                        type: integer
                      tokens_saved:
                        type: integer
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    workspaceSlug:
      name: workspace_slug
      in: path
      required: true
      schema:
        type: string
        example: acme
      description: URL-vriendelijke werkruimte-identificatie
      example: acme
  schemas:
    UUID:
      type: string
      format: uuid
      example: 550e8400-e29b-41d4-a716-446655440000
    AISession:
      type: object
      properties:
        session_id:
          $ref: '#/components/schemas/UUID'
        title:
          type: string
        workspace_id:
          $ref: '#/components/schemas/UUID'
        user_id:
          $ref: '#/components/schemas/UUID'
        created_at:
          $ref: '#/components/schemas/Timestamp'
        updated_at:
          $ref: '#/components/schemas/Timestamp'
    AIMessage:
      type: object
      properties:
        id:
          type: string
        session_id:
          $ref: '#/components/schemas/UUID'
        role:
          type: string
          enum:
            - user
            - assistant
        created_at:
          $ref: '#/components/schemas/Timestamp'
        parts:
          type:
            - object
            - 'null'
          description: Inhoudsdelen van het bericht
        metadata:
          type:
            - object
            - 'null'
    Timestamp:
      type: string
      format: date-time
      example: '2024-01-15T10:30:00Z'
    Error:
      type: object
      properties:
        error:
          type: string
          description: Voor mensen leesbare foutmelding
        code:
          type: string
          description: Machineleesbare foutcode
  responses:
    Unauthorized:
      description: Authenticatietoken ontbreekt of is ongeldig
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Onvoldoende rechten
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource niet gevonden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Stuur een geldig token mee via de header `Authorization: Bearer
        <token>`.
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Voer `API-Key <key>` in.

````