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

# Get saved SQL



## OpenAPI

````yaml /openapi.json get /v1/saved-sql-queries/{id}
openapi: 3.0.3
info:
  title: Orquestr Cloud API
  version: 1.0.0
  description: Orquestr Cloud API — devices, functions, and API keys.
servers:
  - url: https://sand-api.orquestr.dev/cloud
    description: Production
security: []
tags:
  - name: Customers
    description: Customers and members
  - name: Licenses
    description: Issue and revoke licenses
  - name: Devices
    description: Devices and command history
  - name: Functions
    description: List and invoke device functions
  - name: Saved SQL
    description: Org saved read-only queries
paths:
  /v1/saved-sql-queries/{id}:
    get:
      tags:
        - Saved SQL
      summary: Get saved SQL
      operationId: get_v1_saved-sql-queries_id
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Saved query (SQL decrypted)
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - id
                      - customer_id
                      - adapter
                      - name
                      - sql
                      - device_id
                      - created_by
                      - created_at
                      - updated_at
                    properties:
                      id:
                        type: string
                        format: uuid
                      customer_id:
                        type: string
                        format: uuid
                      adapter:
                        type: string
                        enum:
                          - sicarv4
                          - eleventa
                          - microsip
                          - mybusinesspos
                      name:
                        type: string
                      sql:
                        type: string
                        description: Decrypted read-only SQL
                      device_id:
                        type: string
                        format: uuid
                        nullable: true
                        description: null = all devices for adapter
                      created_by:
                        type: string
                        format: uuid
                        nullable: true
                      created_at:
                        type: string
                        format: date-time
                      updated_at:
                        type: string
                        format: date-time
              examples:
                success:
                  summary: 200 OK
                  value:
                    data:
                      id: e9999999-9999-4999-8999-999999999999
                      customer_id: o2222222-2222-2222-2222-222222222222
                      adapter: sicarv4
                      name: Top sellers last week
                      sql: >-
                        SELECT clave, SUM(cantidad) AS qty FROM ventas GROUP BY
                        clave ORDER BY qty DESC LIMIT 20
                      device_id: null
                      created_by: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      created_at: '2026-09-12T10:00:00.000Z'
                      updated_at: '2026-09-14T11:00:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - bearerAuth: []
components:
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Unauthorized
    NotFound:
      description: Resource not found (or hidden)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: Not found
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: bad_request
            message:
              type: string
              example: Invalid body
            details:
              type: object
              additionalProperties: true
      example:
        error:
          code: bad_request
          message: Invalid body
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: 'API key (`sk_live_…`). Send as `Authorization: Bearer <api_key>`.'
      x-default: <api_key>

````