> ## 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.

# Get a sale ticket by id

> Returns one finalized sale ticket (vente / ticket de caisse / reçu) by its id — the same back-office projection the list returns, resolved directly so an agent need not page + filter to fetch a ticket (e.g. before processing a return / remboursement). 404s when no ticket carries the given id.



## OpenAPI

````yaml /openapi.json get /v1/sales/{id}
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/sales/{id}:
    get:
      tags:
        - Finance
      summary: Get a sale ticket by id
      description: >-
        Returns one finalized sale ticket (vente / ticket de caisse / reçu) by
        its id — the same back-office projection the list returns, resolved
        directly so an agent need not page + filter to fetch a ticket (e.g.
        before processing a return / remboursement). 404s when no ticket carries
        the given id.
      operationId: getSaleTicket
      parameters:
        - schema:
            type: string
            minLength: 1
          in: path
          name: id
          required: true
          description: >-
            Sale-ticket id (the finalized transaction id), e.g.
            `T-2026-07-16-0001`.
      responses:
        '200':
          description: The finalized sale ticket read model.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  number:
                    type: string
                  storeId:
                    type: string
                  sellerId:
                    type: string
                  sessionId:
                    type: string
                  registerId:
                    type: string
                  customerId:
                    nullable: true
                    type: string
                  capturedAt:
                    type: string
                  lineCount:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  unitsSold:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  subtotalCents:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  totalCents:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  vatTotalCents:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  vatByRate:
                    type: array
                    items:
                      type: object
                      properties:
                        rate:
                          type: number
                        baseCents:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        vatCents:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        grossCents:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                      required:
                        - rate
                        - baseCents
                        - vatCents
                        - grossCents
                      additionalProperties: false
                  paymentMethod:
                    type: string
                  lines:
                    type: array
                    items:
                      type: object
                      properties:
                        skuId:
                          type: string
                        quantity:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        unitPriceCents:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                      required:
                        - skuId
                        - quantity
                        - unitPriceCents
                      additionalProperties: false
                required:
                  - id
                  - number
                  - storeId
                  - sellerId
                  - sessionId
                  - customerId
                  - capturedAt
                  - lineCount
                  - unitsSold
                  - subtotalCents
                  - totalCents
                  - vatTotalCents
                  - paymentMethod
                  - lines
                additionalProperties: false
                description: The finalized sale ticket read model.
                example:
                  id: list-1
                  number: T-list-1
                  storeId: store-list
                  sellerId: seller-1
                  sessionId: sess-1
                  customerId: null
                  capturedAt: '2026-07-16T09:30:00.000Z'
                  lineCount: 1
                  unitsSold: 2
                  subtotalCents: 3600
                  totalCents: 3600
                  vatTotalCents: 600
                  vatByRate:
                    - rate: 20
                      baseCents: 3000
                      vatCents: 600
                      grossCents: 3600
                  paymentMethod: cash
                  lines:
                    - skuId: sku-espresso-1kg
                      quantity: 2
                      unitPriceCents: 1800
        '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'
        '404':
          description: No resource matches the addressed identifier.
          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.

````