> ## Documentation Index
> Fetch the complete documentation index at: https://lightdash-mintlify-9d6f9427.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get SQL chart by slug

> Get saved sql chart



## OpenAPI

````yaml https://raw.githubusercontent.com/lightdash/lightdash/refs/heads/main/packages/backend/src/generated/swagger.json get /api/v1/projects/{projectUuid}/sqlRunner/saved/slug/{slug}
openapi: 3.0.0
info:
  title: Lightdash API
  version: 0.3249.0
  description: >
    Open API documentation for all public Lightdash API endpoints. #
    Authentication Before you get started, you might need to create a Personal
    Access Token to authenticate via the API. You can create a token by
    following this guide: https://docs.lightdash.com/references/personal_tokens
  license:
    name: MIT
  contact:
    name: Lightdash Support
    email: support@lightdash.com
    url: https://docs.lightdash.com/help-and-contact/contact/contact_info/
servers:
  - url: /
security: []
tags:
  - name: My Account
    description: These routes allow users to manage their own user account.
  - name: Organizations
    description: >-
      Each user is a member of a single organization. These routes allow users
      to manage their organization. Most actions are only available to admin
      users.
  - name: Projects
    description: >-
      Projects belong to a single organization. These routes allow users to
      manage their projects, browse content, and execute queries. Users inside
      an organization might have access to a project from an organization-level
      role or they might be granted access to a project directly.
  - name: Spaces
    description: >-
      Spaces allow you to organize charts and dashboards within a project. They
      also allow granular access to content by allowing you to create private
      spaces, which are only accessible to the creator and admins.
  - name: Roles & Permissions
    description: >-
      These routes allow users to manage roles and permissions for their
      organization.
    externalDocs:
      url: https://docs.lightdash.com/references/roles
  - name: Query
    description: >-
      These routes allow users to execute and manage queries against their data
      warehouse. This includes metric queries, SQL queries, and retrieving query
      results.
paths:
  /api/v1/projects/{projectUuid}/sqlRunner/saved/slug/{slug}:
    get:
      tags:
        - SQL runner
      summary: Get SQL chart by slug
      description: Get saved sql chart
      operationId: getSavedSqlChartBySlug
      parameters:
        - description: the slug for the saved sql chart
          in: path
          name: slug
          required: true
          schema:
            type: string
        - description: the uuid for the project
          in: path
          name: projectUuid
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiSqlChart'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      security: []
components:
  schemas:
    ApiSqlChart:
      properties:
        results:
          $ref: '#/components/schemas/SqlChart'
        status:
          type: string
          enum:
            - ok
          nullable: false
      required:
        - results
        - status
      type: object
    ApiErrorPayload:
      properties:
        error:
          properties:
            data:
              $ref: '#/components/schemas/AnyType'
              description: Optional data containing details of the error
            message:
              type: string
              description: A friendly message summarising the error
            name:
              type: string
              description: Unique name for the type of error
            statusCode:
              type: number
              format: integer
              description: HTTP status code
          required:
            - name
            - statusCode
          type: object
        status:
          type: string
          enum:
            - error
          nullable: false
      required:
        - error
        - status
      type: object
      description: |-
        The Error object is returned from the api any time there is an error.
        The message contains
    SqlChart:
      properties:
        resolvedColorPalette:
          $ref: '#/components/schemas/ResolvedProjectColorPalette'
          description: |-
            Fully resolved palette for this SQL chart, computed from the
            org → project → space → dashboard hierarchy. SQL charts have no
            per-chart override — set the palette via the containing space,
            dashboard, project, or organization.
        lastViewedAt:
          type: string
          format: date-time
        firstViewedAt:
          type: string
          format: date-time
        views:
          type: number
          format: double
        organization:
          $ref: '#/components/schemas/Pick_Organization.organizationUuid_'
        project:
          $ref: '#/components/schemas/Pick_Project.projectUuid_'
        dashboard:
          allOf:
            - $ref: '#/components/schemas/Pick_Dashboard.uuid-or-name_'
          nullable: true
        space:
          $ref: '#/components/schemas/Pick_SpaceSummary.uuid-or-name-or-userAccess_'
        lastUpdatedBy:
          allOf:
            - $ref: >-
                #/components/schemas/Pick_LightdashUser.userUuid-or-firstName-or-lastName_
          nullable: true
        lastUpdatedAt:
          type: string
          format: date-time
        createdBy:
          allOf:
            - $ref: >-
                #/components/schemas/Pick_LightdashUser.userUuid-or-firstName-or-lastName_
          nullable: true
        createdAt:
          type: string
          format: date-time
        chartKind:
          $ref: '#/components/schemas/ChartKind'
        config:
          allOf:
            - $ref: '#/components/schemas/VizBaseConfig'
            - anyOf:
                - $ref: '#/components/schemas/VizCartesianChartConfig'
                - $ref: '#/components/schemas/VizPieChartConfig'
                - $ref: '#/components/schemas/VizTableConfig'
        limit:
          type: number
          format: double
        sql:
          type: string
        slug:
          type: string
        description:
          type: string
          nullable: true
        name:
          type: string
        savedSqlUuid:
          type: string
      required:
        - resolvedColorPalette
        - lastViewedAt
        - firstViewedAt
        - views
        - organization
        - project
        - dashboard
        - space
        - lastUpdatedBy
        - lastUpdatedAt
        - createdBy
        - createdAt
        - chartKind
        - config
        - limit
        - sql
        - slug
        - description
        - name
        - savedSqlUuid
      type: object
    AnyType:
      description: |-
        This AnyType is an alias for any
        The goal is to make it easier to identify any type in the codebase
        without having to eslint-disable all the time
        These are only used on legacy `any` types, don't use it for new types.
        This is added on a separate file to avoid circular dependencies.
    ResolvedProjectColorPalette:
      properties:
        source:
          $ref: '#/components/schemas/ColorPaletteSource'
        paletteName:
          type: string
          nullable: true
        paletteUuid:
          type: string
          nullable: true
        darkColors:
          items:
            type: string
          type: array
          nullable: true
        colors:
          items:
            type: string
          type: array
      required:
        - source
        - paletteName
        - paletteUuid
        - darkColors
        - colors
      type: object
    Pick_Organization.organizationUuid_:
      properties:
        organizationUuid:
          type: string
          description: The unique identifier of the organization
          format: uuid
      required:
        - organizationUuid
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_Project.projectUuid_:
      properties:
        projectUuid:
          type: string
      required:
        - projectUuid
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_Dashboard.uuid-or-name_:
      properties:
        name:
          type: string
        uuid:
          type: string
      required:
        - name
        - uuid
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_SpaceSummary.uuid-or-name-or-userAccess_:
      properties:
        name:
          type: string
        uuid:
          type: string
        userAccess:
          $ref: '#/components/schemas/SpaceAccess'
      required:
        - name
        - uuid
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    Pick_LightdashUser.userUuid-or-firstName-or-lastName_:
      properties: {}
      type: object
      description: From T, pick a set of properties whose keys are in the union K
    ChartKind:
      enum:
        - line
        - horizontal_bar
        - vertical_bar
        - scatter
        - area
        - mixed
        - pie
        - table
        - big_number
        - funnel
        - custom
        - treemap
        - gauge
        - map
        - sankey
      type: string
    VizBaseConfig:
      properties:
        type:
          $ref: '#/components/schemas/ChartKind'
        metadata:
          properties:
            version:
              type: number
              format: double
          required:
            - version
          type: object
      required:
        - type
        - metadata
      type: object
    VizCartesianChartConfig:
      allOf:
        - $ref: '#/components/schemas/VizBaseConfig'
        - properties:
            display:
              $ref: '#/components/schemas/CartesianChartDisplay'
            fieldConfig:
              $ref: '#/components/schemas/PivotChartLayout'
            type:
              anyOf:
                - $ref: '#/components/schemas/ChartKind.VERTICAL_BAR'
                - $ref: '#/components/schemas/ChartKind.LINE'
          required:
            - type
          type: object
    VizPieChartConfig:
      allOf:
        - $ref: '#/components/schemas/VizBaseConfig'
        - properties:
            display:
              $ref: '#/components/schemas/VizPieChartDisplay'
            fieldConfig:
              $ref: '#/components/schemas/PivotChartLayout'
            type:
              $ref: '#/components/schemas/ChartKind.PIE'
          required:
            - type
          type: object
    VizTableConfig:
      allOf:
        - $ref: '#/components/schemas/VizBaseConfig'
        - properties:
            display:
              $ref: '#/components/schemas/VizTableDisplay'
            columns:
              $ref: '#/components/schemas/VizColumnsConfig'
            type:
              $ref: '#/components/schemas/ChartKind.TABLE'
          required:
            - columns
            - type
          type: object
    ColorPaletteSource:
      anyOf:
        - properties:
            type:
              type: string
              enum:
                - config
              nullable: false
          required:
            - type
          type: object
        - properties:
            type:
              type: string
              enum:
                - default
              nullable: false
          required:
            - type
          type: object
        - properties:
            name:
              type: string
            uuid:
              type: string
            type:
              type: string
              enum:
                - organization
              nullable: false
          required:
            - name
            - uuid
            - type
          type: object
        - properties:
            name:
              type: string
            uuid:
              type: string
            type:
              type: string
              enum:
                - project
              nullable: false
          required:
            - name
            - uuid
            - type
          type: object
        - properties:
            name:
              type: string
            uuid:
              type: string
            type:
              type: string
              enum:
                - space
              nullable: false
          required:
            - name
            - uuid
            - type
          type: object
        - properties:
            name:
              type: string
            uuid:
              type: string
            type:
              type: string
              enum:
                - dashboard
              nullable: false
          required:
            - name
            - uuid
            - type
          type: object
        - properties:
            name:
              type: string
            uuid:
              type: string
            type:
              type: string
              enum:
                - chart
              nullable: false
          required:
            - name
            - uuid
            - type
          type: object
      description: >-
        Where a resolved colour palette came from. The `config` and `default`
        cases

        carry no entity reference; the rest expose the UUID and human-readable
        name

        of the entity (organization, project, space, dashboard or chart) that
        owns

        the winning palette in the resolution chain.
    SpaceAccess:
      properties:
        inheritedFrom:
          type: string
          enum:
            - organization
            - project
            - group
            - space_group
            - parent_space
        inheritedRole:
          anyOf:
            - $ref: '#/components/schemas/OrganizationMemberRole'
            - $ref: '#/components/schemas/ProjectMemberRole'
        projectRole:
          $ref: '#/components/schemas/ProjectMemberRole'
        hasDirectAccess:
          type: boolean
        role:
          $ref: '#/components/schemas/SpaceMemberRole'
        userUuid:
          type: string
      required:
        - hasDirectAccess
        - role
        - userUuid
      type: object
    CartesianChartDisplay:
      properties:
        stack:
          anyOf:
            - type: boolean
            - $ref: '#/components/schemas/StackType'
        legend:
          properties:
            align:
              type: string
              enum:
                - start
                - center
                - end
            position:
              type: string
              enum:
                - top
                - bottom
                - left
                - right
          required:
            - align
            - position
          type: object
        series:
          properties: {}
          additionalProperties:
            properties:
              whichYAxis:
                $ref: '#/components/schemas/AxisSide'
              valueLabelPosition:
                $ref: '#/components/schemas/ValueLabelPositionOptions'
              type:
                anyOf:
                  - $ref: '#/components/schemas/CartesianSeriesType.LINE'
                  - $ref: '#/components/schemas/CartesianSeriesType.BAR'
              color:
                type: string
              yAxisIndex:
                type: number
                format: double
              format:
                $ref: '#/components/schemas/Format'
              label:
                type: string
            type: object
          type: object
        yAxis:
          items:
            properties:
              format:
                $ref: '#/components/schemas/Format'
              position:
                type: string
              label:
                type: string
            type: object
          type: array
        xAxis:
          properties:
            dateFormat:
              type: string
            type:
              $ref: '#/components/schemas/VizIndexType'
            label:
              type: string
          type: object
      type: object
    PivotChartLayout:
      properties:
        stack:
          anyOf:
            - type: boolean
            - $ref: '#/components/schemas/StackType'
        sortBy:
          items:
            $ref: '#/components/schemas/VizSortBy'
          type: array
        groupBy:
          items:
            properties:
              reference:
                type: string
            required:
              - reference
            type: object
          type: array
        'y':
          items:
            properties:
              aggregation:
                $ref: '#/components/schemas/VizAggregationOptions'
              reference:
                type: string
            required:
              - aggregation
              - reference
            type: object
          type: array
        x:
          properties:
            type:
              $ref: '#/components/schemas/VizIndexType'
            reference:
              type: string
          required:
            - type
            - reference
          type: object
      required:
        - 'y'
      type: object
    ChartKind.VERTICAL_BAR:
      enum:
        - vertical_bar
      type: string
    ChartKind.LINE:
      enum:
        - line
      type: string
    VizPieChartDisplay:
      properties:
        isDonut:
          type: boolean
      type: object
    ChartKind.PIE:
      enum:
        - pie
      type: string
    VizTableDisplay:
      properties: {}
      type: object
    VizColumnsConfig:
      properties: {}
      additionalProperties:
        $ref: '#/components/schemas/VizColumnConfig'
      type: object
    ChartKind.TABLE:
      enum:
        - table
      type: string
    OrganizationMemberRole:
      enum:
        - member
        - viewer
        - interactive_viewer
        - editor
        - developer
        - admin
      type: string
    ProjectMemberRole:
      enum:
        - viewer
        - interactive_viewer
        - editor
        - developer
        - admin
      type: string
    SpaceMemberRole:
      enum:
        - viewer
        - editor
        - admin
      type: string
    StackType:
      enum:
        - none
        - stack
        - stack100
      type: string
    AxisSide:
      enum:
        - 0
        - 1
      type: number
    ValueLabelPositionOptions:
      enum:
        - hidden
        - top
        - bottom
        - left
        - right
        - inside
      type: string
    CartesianSeriesType.LINE:
      enum:
        - line
      type: string
    CartesianSeriesType.BAR:
      enum:
        - bar
      type: string
    Format:
      enum:
        - km
        - mi
        - usd
        - gbp
        - eur
        - jpy
        - dkk
        - id
        - percent
      type: string
    VizIndexType:
      enum:
        - time
        - category
      type: string
    VizSortBy:
      properties:
        pivotValues:
          items:
            $ref: '#/components/schemas/PivotSortAnchor'
          type: array
          description: Pins the row-sort anchor to a specific pivot column.
        nullsFirst:
          type: boolean
        direction:
          $ref: '#/components/schemas/SortByDirection'
        reference:
          type: string
      required:
        - direction
        - reference
      type: object
    VizAggregationOptions:
      enum:
        - sum
        - count
        - avg
        - min
        - max
        - any
      type: string
    VizColumnConfig:
      properties:
        barConfig:
          properties:
            color:
              type: string
            max:
              type: number
              format: double
            min:
              type: number
              format: double
          type: object
        displayStyle:
          type: string
          enum:
            - text
            - bar
        aggregation:
          $ref: '#/components/schemas/VizAggregationOptions'
        order:
          type: number
          format: double
        frozen:
          type: boolean
        label:
          type: string
        reference:
          type: string
        visible:
          type: boolean
      required:
        - frozen
        - label
        - reference
        - visible
      type: object
    PivotSortAnchor:
      properties:
        value:
          anyOf:
            - type: string
            - type: number
              format: double
            - type: boolean
          nullable: true
        reference:
          type: string
      required:
        - value
        - reference
      type: object
      description: |-
        Coordinates of a single pivot column, used to anchor a row sort to that
        specific column when results are pivoted.
    SortByDirection:
      enum:
        - ASC
        - DESC
      type: string

````