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

> ## Agent Instructions
> Documentazione di dentalspace. Il testo completo, incluso il riferimento API, è in /llms-full.txt. Per endpoint, campi e codici di errore la fonte di verità è openapi.json: non usare endpoint o campi non documentati.

# Un preventivo, con le voci

> Scope: `treatment_plans:read`.

Con lo scope clinical:read anche denti, superfici, odontogramma e diagnosi (e l'accesso finisce nel registro).



## OpenAPI

````yaml /openapi.json get /treatment-plans/{id}
openapi: 3.1.0
info:
  title: DentalSpace API
  version: 1.0.0
  description: >-
    API pubblica di DentalSpace. Ogni richiesta porta `Authorization: Bearer
    <chiave>`

    (`dsk_live_…`, o `dsk_test_…` per una clinica di prova: nessun messaggio
    parte verso l'esterno).

    La chiave vede solo la sua clinica (e le sue sedi, se limitata): una risorsa
    di altri e' sempre 404.


    Errori: `{ "error": { "code", "message", "details", "requestId" } }`; `code`
    e' stabile, `message` no.

    Limiti: 100 richieste ogni 10 secondi e 20.000 al giorno (UTC) per clinica,
    60 e 12.000 per chiave;

    header `X-RateLimit-*` su ogni risposta, `Retry-After` sul 429 (che non
    consuma).

    Elenchi a cursore: `limit` 1-200, `cursor` = il `nextCursor` precedente,
    `updatedSince` per sincronizzare.

    `Idempotency-Key` sulle creazioni: la stessa chiave entro 24 ore ripete la
    prima risposta.
servers:
  - url: https://api.dentalspace.ai/v1
security:
  - bearerAuth: []
tags:
  - name: Meta
  - name: Studio
  - name: Pazienti
  - name: Agenda
  - name: Preventivi
  - name: Fatture e pagamenti
  - name: Documenti
  - name: Attività
  - name: Contatti commerciali
  - name: Messaggi WhatsApp
  - name: Telefonate
  - name: Agente vocale
  - name: Webhook ed eventi
paths:
  /treatment-plans/{id}:
    get:
      tags:
        - Preventivi
      summary: Un preventivo, con le voci
      description: >-
        Scope: `treatment_plans:read`.


        Con lo scope clinical:read anche denti, superfici, odontogramma e
        diagnosi (e l'accesso finisce nel registro).
      operationId: getTreatmentPlan
      parameters:
        - name: id
          in: path
          required: true
          description: Identificativo della risorsa.
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
      responses:
        '200':
          description: Il preventivo.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TreatmentPlanDetail'
        '400':
          description: 'Codici: `invalid_request`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 'Codici: `unauthenticated`, `api_key_invalid`, `api_key_revoked`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: 'Codici: `plan_required`, `insufficient_scope`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: 'Codici: `not_found`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 'Codici: `rate_limited`.'
          headers:
            Retry-After:
              $ref: '#/components/headers/Retry-After'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: 'Codici: `internal_error`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: 'Codici: `unavailable`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  headers:
    X-Request-Id:
      description: Identificativo della richiesta, da citare all'assistenza.
      schema:
        type: string
    X-RateLimit-Limit:
      description: Il tetto della finestra piu' stretta.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Richieste rimaste nella finestra piu' stretta.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: Quando riparte (secondi epoch, UTC).
      schema:
        type: integer
    Retry-After:
      description: Secondi da aspettare prima di riprovare.
      schema:
        type: integer
  schemas:
    TreatmentPlanDetail:
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
        patientId:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
        facilityId:
          anyOf:
            - type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
            - type: 'null'
        name:
          type: string
        description:
          anyOf:
            - type: string
            - type: 'null'
        status:
          type: string
          enum:
            - draft
            - proposed
            - standby
            - accepted
            - rejected
            - in_progress
            - completed
        totalCost:
          anyOf:
            - type: number
            - type: 'null'
        presentedAmount:
          anyOf:
            - type: number
            - type: 'null'
        presentedAt:
          anyOf:
            - type: string
            - type: 'null'
        acceptedAmount:
          anyOf:
            - type: number
            - type: 'null'
        acceptedAt:
          anyOf:
            - type: string
            - type: 'null'
        doctorId:
          anyOf:
            - type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
            - type: 'null'
        createdAt:
          type: string
        updatedAt:
          type: string
        items:
          type: array
          items:
            $ref: '#/components/schemas/TreatmentPlanItem'
        odontogramType:
          description: Solo con clinical:read.
          anyOf:
            - type: string
            - type: 'null'
        toothData:
          description: Solo con clinical:read.
          anyOf:
            - type: object
              propertyNames:
                type: string
              additionalProperties: {}
            - type: 'null'
        diagnoses:
          description: Solo con clinical:read.
          type: array
          items:
            $ref: '#/components/schemas/TreatmentPlanDiagnosis'
      required:
        - id
        - patientId
        - facilityId
        - name
        - description
        - status
        - totalCost
        - presentedAmount
        - presentedAt
        - acceptedAmount
        - acceptedAt
        - doctorId
        - createdAt
        - updatedAt
        - items
      additionalProperties: false
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              description: Codice stabile, da usare nel codice del client.
              type: string
              enum:
                - invalid_request
                - unauthenticated
                - api_key_invalid
                - api_key_revoked
                - forbidden
                - insufficient_scope
                - organization_suspended
                - plan_required
                - not_found
                - no_availability
                - conflict
                - idempotency_in_progress
                - idempotency_key_reused
                - rate_limited
                - internal_error
                - unavailable
            message:
              description: >-
                Spiegazione per una persona (in italiano). Non confrontarla nel
                codice.
              type: string
            details:
              anyOf:
                - type: object
                  propertyNames:
                    type: string
                  additionalProperties: {}
                - type: 'null'
            requestId:
              description: >-
                Lo stesso valore dell'header X-Request-Id: citalo
                all'assistenza.
              type: string
          required:
            - code
            - message
            - details
            - requestId
          additionalProperties: false
      required:
        - error
      additionalProperties: false
    TreatmentPlanItem:
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
        treatmentId:
          anyOf:
            - type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
            - type: 'null'
        name:
          anyOf:
            - type: string
            - type: 'null'
        cost:
          anyOf:
            - type: number
            - type: 'null'
        status:
          anyOf:
            - type: string
            - type: 'null'
        priority:
          anyOf:
            - type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        doctorId:
          anyOf:
            - type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
            - type: 'null'
        tooth:
          description: Solo con clinical:read.
          anyOf:
            - type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        surface:
          description: Solo con clinical:read.
          anyOf:
            - type: string
            - type: 'null'
        treatmentArea:
          description: Solo con clinical:read.
          anyOf:
            - type: string
            - type: 'null'
        diagnosisId:
          description: Solo con clinical:read.
          anyOf:
            - type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
            - type: 'null'
      required:
        - id
        - treatmentId
        - name
        - cost
        - status
        - priority
        - doctorId
      additionalProperties: false
    TreatmentPlanDiagnosis:
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
        tooth:
          anyOf:
            - type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        issueType:
          anyOf:
            - type: string
            - type: 'null'
        issueCategory:
          anyOf:
            - type: string
            - type: 'null'
        treatmentArea:
          anyOf:
            - type: string
            - type: 'null'
        surfaces:
          anyOf:
            - type: array
              items:
                type: string
            - type: 'null'
        severity:
          anyOf:
            - type: string
            - type: 'null'
        note:
          anyOf:
            - type: string
            - type: 'null'
        status:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - id
        - tooth
        - issueType
        - issueCategory
        - treatmentArea
        - surfaces
        - severity
        - note
        - status
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: dsk_live_… / dsk_test_…

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.