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

# Ask the in-till assistant a question

> Sends a free-text prompt to the till's built-in help assistant and returns its reply as PROSE. It backs the caisse `/ia` screen, where a cashier asks how to use the POS. WHY `avoid`: this operation answers about the product, never about your data — it cannot read a sale, a stock level or a customer, and its reply is natural-language text with no machine-readable field. Anything you might want from it is available as a real, typed operation elsewhere in this API; reach for that instead. Two further reasons to stay away: the behaviour is deployment-dependent (with no agent configured the server answers from a small deterministic French phrasebook that ignores your question's specifics, so a confident-sounding reply may be a canned fallback), and when an agent IS configured the prompt and history are forwarded verbatim to a third-party model — never put customer identifiers, contact details or anything else confidential in them. `prompt` is required, trimmed, 1..2000 characters; `history` is an optional array of at most 50 prior `{ role, text }` turns for context and is NOT stored server-side, so resend it each call. Replies are in French. The call is stateless and free of side effects — nothing is written and nothing is charged — so a retry is safe.



## OpenAPI

````yaml /openapi.json post /v1/assistant/chat
openapi: 3.0.3
info:
  title: Solya POS API
  version: 1.0.0
  description: >-
    The Solya POS backend HTTP surface. Every documented operation is
    agent-ready: it carries an `operationId`, an agent-facing `description`, the
    `pos.*` scopes it enforces (`x-required-permissions`) and an `x-agent-tier`.
    Success responses return the payload as raw JSON; failures return the
    `ErrorResponse` envelope (`{ error: { code, message, statusCode } }`).
servers:
  - url: /
    description: The backend, relative to its deployed origin.
security: []
paths:
  /v1/assistant/chat:
    post:
      tags:
        - Assistant
      summary: Ask the in-till assistant a question
      description: >-
        Sends a free-text prompt to the till's built-in help assistant and
        returns its reply as PROSE. It backs the caisse `/ia` screen, where a
        cashier asks how to use the POS. WHY `avoid`: this operation answers
        about the product, never about your data — it cannot read a sale, a
        stock level or a customer, and its reply is natural-language text with
        no machine-readable field. Anything you might want from it is available
        as a real, typed operation elsewhere in this API; reach for that
        instead. Two further reasons to stay away: the behaviour is
        deployment-dependent (with no agent configured the server answers from a
        small deterministic French phrasebook that ignores your question's
        specifics, so a confident-sounding reply may be a canned fallback), and
        when an agent IS configured the prompt and history are forwarded
        verbatim to a third-party model — never put customer identifiers,
        contact details or anything else confidential in them. `prompt` is
        required, trimmed, 1..2000 characters; `history` is an optional array of
        at most 50 prior `{ role, text }` turns for context and is NOT stored
        server-side, so resend it each call. Replies are in French. The call is
        stateless and free of side effects — nothing is written and nothing is
        charged — so a retry is safe.
      operationId: chatWithAssistant
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  minLength: 1
                  maxLength: 2000
                history:
                  maxItems: 50
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - assistant
                      text:
                        type: string
                        minLength: 1
                    required:
                      - role
                      - text
              required:
                - prompt
              example:
                prompt: Comment ouvrir la caisse ?
                history:
                  - role: user
                    text: Bonjour
      responses:
        '200':
          description: The assistant's free-text reply. Never parse it as data.
          content:
            application/json:
              schema:
                type: object
                properties:
                  text:
                    type: string
                    minLength: 1
                required:
                  - text
                additionalProperties: false
                description: The assistant's free-text reply. Never parse it as data.
                example:
                  text: >-
                    Pour le fond de caisse, ouvrez l’onglet Caisse : vous y
                    gérez le tiroir, les entrées et sorties d’espèces et la
                    clôture.
        '400':
          description: >-
            The request failed schema validation; `error.fieldErrors` lists the
            fields.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: No valid credential was presented — send a bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: The actor is authenticated but lacks the required `pos.*` scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: An unexpected server error — safe to retry idempotent requests.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    ValidationErrorResponse:
      type: object
      required:
        - error
      additionalProperties: false
      description: >-
        A `VALIDATION_FAILED` envelope carrying the offending fields in
        `fieldErrors`.
      properties:
        error:
          type: object
          required:
            - code
            - message
            - statusCode
          additionalProperties: false
          properties:
            code:
              type: string
              enum:
                - VALIDATION_FAILED
            message:
              type: string
            statusCode:
              type: integer
            fieldErrors:
              type: array
              description: >-
                One entry per rejected field: the field path and why it was
                rejected.
              items:
                type: object
                required:
                  - field
                  - message
                additionalProperties: false
                properties:
                  field:
                    type: string
                    description: Dot-path of the offending field.
                  message:
                    type: string
                    description: Why the field was rejected.
    ErrorResponse:
      type: object
      required:
        - error
      additionalProperties: false
      description: The uniform failure envelope every non-2xx response returns.
      properties:
        error:
          type: object
          required:
            - code
            - message
            - statusCode
          additionalProperties: false
          properties:
            code:
              type: string
              enum:
                - VALIDATION_FAILED
                - UNAUTHORIZED
                - FORBIDDEN
                - NOT_FOUND
                - CONFLICT
                - BUSINESS_RULE_VIOLATION
                - INTERNAL_ERROR
              description: >-
                Machine-readable kernel `ResultCode` — branch on this, not on
                `message`.
            message:
              type: string
              description: >-
                Human-readable explanation. Safe to surface; never leaks server
                internals.
            statusCode:
              type: integer
              description: >-
                The HTTP status, mirrored into the body so a client need not
                read headers.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        `Authorization: Bearer <token>`. Accepts EITHER a Keycloak access token
        (scopes-in-token) OR an opaque POS session token; both resolve to the
        same `pos.*` scope vocabulary the route guards enforce.

````