Lightdash Git Integration API

The Git Integration API from Lightdash — 5 operation(s) for git integration.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

lightdash-git-integration-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Lightdash AiAgents Git Integration API
  version: 0.3156.1
  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: /
tags:
- name: Git Integration
paths:
  /api/v1/projects/{projectUuid}/git-integration/pull-requests/custom-metrics:
    post:
      operationId: CreatePullRequestForCustomMetrics
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                properties:
                  results:
                    $ref: '#/components/schemas/PullRequestCreated'
                  status:
                    type: string
                    enum:
                    - ok
                    nullable: false
                required:
                - results
                - status
                type: object
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Create a pull request for custom metrics
      summary: Create PR for custom metrics
      tags:
      - Git Integration
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                quoteChar:
                  type: string
                  enum:
                  - '"'
                  - ''''
                customMetrics:
                  items:
                    $ref: '#/components/schemas/AdditionalMetric'
                  type: array
              required:
              - customMetrics
              type: object
  /api/v1/projects/{projectUuid}/git-integration/pull-requests/custom-dimensions:
    post:
      operationId: CreatePullRequestForCustomDimensions
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                properties:
                  results:
                    $ref: '#/components/schemas/PullRequestCreated'
                  status:
                    type: string
                    enum:
                    - ok
                    nullable: false
                required:
                - results
                - status
                type: object
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Create a pull request for custom dimensions
      summary: Create PR for custom dimensions
      tags:
      - Git Integration
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                quoteChar:
                  type: string
                  enum:
                  - '"'
                  - ''''
                customDimensions:
                  items:
                    $ref: '#/components/schemas/CustomDimension'
                  type: array
              required:
              - customDimensions
              type: object
  /api/v1/projects/{projectUuid}/git-integration/explores/{exploreName}/files:
    get:
      operationId: GetGitFileForExplore
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                properties:
                  results:
                    $ref: '#/components/schemas/ApiGitFileContent'
                  status:
                    type: string
                    enum:
                    - ok
                    nullable: false
                required:
                - results
                - status
                type: object
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Get the YAML file for an explore's base table
      summary: Get explore file
      tags:
      - Git Integration
      deprecated: true
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - in: path
        name: exploreName
        required: true
        schema:
          type: string
  /api/v1/projects/{projectUuid}/git-integration/explores/{exploreName}/file-path:
    get:
      operationId: GetGitFilePathForExplore
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                properties:
                  results:
                    properties:
                      filePath:
                        type: string
                    required:
                    - filePath
                    type: object
                  status:
                    type: string
                    enum:
                    - ok
                    nullable: false
                required:
                - results
                - status
                type: object
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Get the file path for an explore's YAML file (without fetching content)
      summary: Get explore file path
      tags:
      - Git Integration
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      - in: path
        name: exploreName
        required: true
        schema:
          type: string
  /api/v1/projects/{projectUuid}/git-integration/pull-requests/file-change:
    post:
      operationId: CreatePullRequestForFileChange
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                properties:
                  results:
                    $ref: '#/components/schemas/PullRequestCreated'
                  status:
                    type: string
                    enum:
                    - ok
                    nullable: false
                required:
                - results
                - status
                type: object
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorPayload'
      description: Create a pull request with arbitrary file changes
      summary: Create file PR
      tags:
      - Git Integration
      deprecated: true
      security: []
      parameters:
      - in: path
        name: projectUuid
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                description:
                  type: string
                title:
                  type: string
                originalSha:
                  type: string
                content:
                  type: string
                filePath:
                  type: string
              required:
              - description
              - title
              - originalSha
              - content
              - filePath
              type: object
components:
  schemas:
    CustomFormat:
      properties:
        type:
          $ref: '#/components/schemas/CustomFormatType'
          description: Format type
        round:
          type: number
          format: double
          description: Number of decimal places
        separator:
          $ref: '#/components/schemas/NumberSeparator'
          description: Number separator style
        currency:
          type: string
          description: Currency code (e.g., USD, GBP, EUR)
        compact:
          $ref: '#/components/schemas/CompactOrAlias'
          description: Compact format for large numbers (K, M, B, T) or byte units
        prefix:
          type: string
          description: Prefix to prepend to formatted values
        suffix:
          type: string
          description: Suffix to append to formatted values
        timeInterval:
          $ref: '#/components/schemas/TimeFrames'
          description: Time interval for date formatting
        custom:
          type: string
          description: Custom format string
      required:
      - type
      type: object
      additionalProperties: true
    MetricType:
      enum:
      - percentile
      - average
      - count
      - count_distinct
      - sum
      - sum_distinct
      - average_distinct
      - min
      - max
      - percent_of_previous
      - percent_of_total
      - running_total
      - number
      - median
      - string
      - date
      - timestamp
      - boolean
      type: string
    NumberSeparator:
      enum:
      - default
      - commaPeriod
      - spacePeriod
      - periodComma
      - noSeparatorPeriod
      - apostrophePeriod
      type: string
    CustomBinDimension:
      anyOf:
      - $ref: '#/components/schemas/FixedNumberBinDimension'
      - $ref: '#/components/schemas/FixedWidthBinDimension'
      - $ref: '#/components/schemas/CustomRangeBinDimension'
      - $ref: '#/components/schemas/CustomGroupBinDimension'
    CustomRangeBinDimension:
      properties:
        id:
          type: string
          description: Unique identifier for the custom dimension
        name:
          type: string
          description: Display name for the custom dimension
        table:
          type: string
          description: Table this custom dimension belongs to
        type:
          $ref: '#/components/schemas/CustomDimensionType.BIN'
          description: Type of custom dimension (bin or sql)
        dimensionId:
          $ref: '#/components/schemas/FieldId'
          description: Field ID of the parent dimension to bin
        binType:
          $ref: '#/components/schemas/BinType.CUSTOM_RANGE'
        customRange:
          items:
            $ref: '#/components/schemas/BinRange'
          type: array
      required:
      - id
      - name
      - table
      - type
      - dimensionId
      - binType
      - customRange
      type: object
      additionalProperties: true
    FieldId:
      type: string
    GroupValueRule:
      properties:
        value:
          type: string
        matchType:
          $ref: '#/components/schemas/GroupValueMatchType'
      required:
      - value
      - matchType
      type: object
    PullRequestCreated:
      properties:
        prUrl:
          type: string
        prTitle:
          type: string
      required:
      - prUrl
      - prTitle
      type: object
    BinType.FIXED_WIDTH:
      enum:
      - fixed_width
      type: string
    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.'
    BinRange:
      properties:
        to:
          type: number
          format: double
          description: End value for this bin range (undefined for the last range)
        from:
          type: number
          format: double
          description: Start value for this bin range (undefined for the first range)
      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'
    TimeFrames:
      enum:
      - RAW
      - YEAR
      - QUARTER
      - MONTH
      - WEEK
      - DAY
      - HOUR
      - MINUTE
      - SECOND
      - MILLISECOND
      - DAY_OF_WEEK_INDEX
      - DAY_OF_MONTH_NUM
      - DAY_OF_YEAR_NUM
      - WEEK_NUM
      - MONTH_NUM
      - QUARTER_NUM
      - YEAR_NUM
      - DAY_OF_WEEK_NAME
      - MONTH_NAME
      - QUARTER_NAME
      - HOUR_OF_DAY_NUM
      - MINUTE_OF_HOUR_NUM
      type: string
    FilterOperator:
      enum:
      - isNull
      - notNull
      - equals
      - notEquals
      - startsWith
      - endsWith
      - include
      - doesNotInclude
      - lessThan
      - lessThanOrEqual
      - greaterThan
      - greaterThanOrEqual
      - inThePast
      - notInThePast
      - inTheNext
      - inTheCurrent
      - notInTheCurrent
      - inBetween
      - notInBetween
      - inPeriodToDate
      type: string
    FixedWidthBinDimension:
      properties:
        id:
          type: string
          description: Unique identifier for the custom dimension
        name:
          type: string
          description: Display name for the custom dimension
        table:
          type: string
          description: Table this custom dimension belongs to
        type:
          $ref: '#/components/schemas/CustomDimensionType.BIN'
          description: Type of custom dimension (bin or sql)
        dimensionId:
          $ref: '#/components/schemas/FieldId'
          description: Field ID of the parent dimension to bin
        binType:
          $ref: '#/components/schemas/BinType.FIXED_WIDTH'
        binWidth:
          type: number
          format: double
      required:
      - id
      - name
      - table
      - type
      - dimensionId
      - binType
      - binWidth
      type: object
      additionalProperties: true
    CustomDimensionType.BIN:
      enum:
      - bin
      type: string
    CustomFormatType:
      enum:
      - default
      - percent
      - currency
      - number
      - id
      - date
      - timestamp
      - bytes_si
      - bytes_iec
      - custom
      type: string
    FixedNumberBinDimension:
      properties:
        id:
          type: string
          description: Unique identifier for the custom dimension
        name:
          type: string
          description: Display name for the custom dimension
        table:
          type: string
          description: Table this custom dimension belongs to
        type:
          $ref: '#/components/schemas/CustomDimensionType.BIN'
          description: Type of custom dimension (bin or sql)
        dimensionId:
          $ref: '#/components/schemas/FieldId'
          description: Field ID of the parent dimension to bin
        binType:
          $ref: '#/components/schemas/BinType.FIXED_NUMBER'
        binNumber:
          type: number
          format: double
      required:
      - id
      - name
      - table
      - type
      - dimensionId
      - binType
      - binNumber
      type: object
      additionalProperties: true
    ApiGitFileContent:
      properties:
        filePath:
          type: string
        sha:
          type: string
        content:
          type: string
      required:
      - filePath
      - sha
      - content
      type: object
    BinType.CUSTOM_RANGE:
      enum:
      - custom_range
      type: string
    CompactOrAlias:
      anyOf:
      - $ref: '#/components/schemas/Compact'
      - type: string
        enum:
        - K
        - thousand
        - M
        - million
        - B
        - billion
        - T
        - trillion
        - KB
        - kilobyte
        - MB
        - megabyte
        - GB
        - gigabyte
        - TB
        - terabyte
        - PB
        - petabyte
        - KiB
        - kibibyte
        - MiB
        - mebibyte
        - GiB
        - gibibyte
        - TiB
        - tebibyte
        - PiB
        - pebibyte
    BinGroup:
      properties:
        values:
          items:
            $ref: '#/components/schemas/GroupValueRule'
          type: array
          description: Rules that match values into this group
        name:
          type: string
          description: Display name for this group (e.g. "North America")
      required:
      - values
      - name
      type: object
    AdditionalMetric:
      properties:
        label:
          type: string
          description: Display label for the metric
        type:
          $ref: '#/components/schemas/MetricType'
          description: Aggregation type
        description:
          type: string
          description: Description of what the metric measures
        sql:
          type: string
          description: SQL expression (e.g., ${TABLE}.column_name)
        hidden:
          type: boolean
          description: Whether the metric is hidden from users
        round:
          type: number
          format: double
          description: Number of decimal places
        compact:
          $ref: '#/components/schemas/CompactOrAlias'
          description: Compact format for large numbers
        format:
          anyOf:
          - $ref: '#/components/schemas/Format'
          - type: string
          description: Format string (legacy format specification)
        separator:
          $ref: '#/components/schemas/NumberSeparator'
          description: Number separator style for grouping/decimal characters
        table:
          type: string
          description: Table name the metric belongs to
        name:
          type: string
          description: Internal name of the metric
        index:
          type: number
          format: double
          description: Display order index
        filters:
          items:
            $ref: '#/components/schemas/MetricFilterRule'
          type: array
          description: Filters to apply to this metric
        baseDimensionName:
          type: string
          description: Name of the base dimension/column this metric aggregates
        uuid:
          type: string
          nullable: true
          description: Unique identifier for the metric
        percentile:
          type: number
          format: double
          description: Percentile value for percentile metrics
        distinctKeys:
          items:
            type: string
          type: array
        formatOptions:
          $ref: '#/components/schemas/CustomFormat'
          description: Formatting configuration
        generationType:
          type: string
          enum:
          - periodOverPeriod
          nullable: false
          description: 'Optional marker for metrics generated by the system.

            Currently used for Period-over-Period (PoP) previous-period metrics.'
        baseMetricId:
          $ref: '#/components/schemas/FieldId'
          description: For PoP-generated metrics, the base metric id that this metric is derived from.
        timeDimensionId:
          $ref: '#/components/schemas/FieldId'
          description: For PoP-generated metrics, the time dimension id used for the comparison.
        granularity:
          $ref: '#/components/schemas/TimeFrames'
          description: For PoP-generated metrics, the granularity used for the comparison.
        periodOffset:
          type: number
          format: double
          description: For PoP-generated metrics, the number of periods to offset by (>= 1).
      required:
      - type
      - sql
      - table
      - name
      type: object
      additionalProperties: true
    GroupValueMatchType:
      enum:
      - exact
      - startsWith
      - endsWith
      - includes
      type: string
    Compact:
      enum:
      - thousands
      - millions
      - billions
      - trillions
      - kilobytes
      - megabytes
      - gigabytes
      - terabytes
      - petabytes
      - kibibytes
      - mebibytes
      - gibibytes
      - tebibytes
      - pebibytes
      type: string
    BinType.FIXED_NUMBER:
      enum:
      - fixed_number
      type: string
    CustomSqlDimension:
      properties:
        id:
          type: string
          description: Unique identifier for the custom dimension
        name:
          type: string
          description: Display name for the custom dimension
        table:
          type: string
          description: Table this custom dimension belongs to
        type:
          $ref: '#/components/schemas/CustomDimensionType.SQL'
          description: Type of custom dimension (bin or sql)
        sql:
          type: string
          description: SQL expression for the custom dimension
        dimensionType:
          $ref: '#/components/schemas/DimensionType'
          description: Data type of the dimension result
      required:
      - id
      - name
      - table
      - type
      - sql
      - dimensionType
      type: object
      additionalProperties: true
    DimensionType:
      enum:
      - string
      - number
      - timestamp
      - date
      - boolean
      type: string
    Format:
      enum:
      - km
      - mi
      - usd
      - gbp
      - eur
      - jpy
      - dkk
      - id
      - percent
      type: string
    CustomDimension:
      anyOf:
      - $ref: '#/components/schemas/CustomBinDimension'
      - $ref: '#/components/schemas/CustomSqlDimension'
    CustomGroupBinDimension:
      properties:
        id:
          type: string
          description: Unique identifier for the custom dimension
        name:
          type: string
          description: Display name for the custom dimension
        table:
          type: string
          description: Table this custom dimension belongs to
        type:
          $ref: '#/components/schemas/CustomDimensionType.BIN'
          description: Type of custom dimension (bin or sql)
        dimensionId:
          $ref: '#/components/schemas/FieldId'
          description: Field ID of the parent dimension to bin
        binType:
          $ref: '#/components/schemas/BinType.CUSTOM_GROUP'
        customGroups:
          items:
            $ref: '#/components/schemas/BinGroup'
          type: array
      required:
      - id
      - name
      - table
      - type
      - dimensionId
      - binType
      - customGroups
      type: object
      additionalProperties: true
    MetricFilterRule:
      description: Filter rule for metrics, targeting fields by reference
      properties:
        values:
          items:
            $ref: '#/components/schemas/AnyType'
          type: array
          description: Values to filter by
        operator:
          $ref: '#/components/schemas/FilterOperator'
          description: Filter operator
        id:
          type: string
          description: Unique identifier for the filter
        target:
          properties:
            fieldRef:
              type: string
              description: Field reference to filter on (e.g., 'table_name.field_name')
          required:
          - fieldRef
          type: object
          description: Target field for the filter
        settings:
          $ref: '#/components/schemas/AnyType'
          description: Additional settings for date/time filters
        disabled:
          type: boolean
          description: Whether this filter is disabled
        required:
          type: boolean
          description: Whether this filter is required
        caseSensitive:
          type: boolean
          description: 'Overrides the field/explore case-sensitivity for this rule only.

            Used by internal features like autocomplete search that must always

            match case-insensitively regardless of the field''s configured setting.'
      required:
      - operator
      - id
      - target
      type: object
      additionalProperties: true
    CustomDimensionType.SQL:
      enum:
      - sql
      type: string
    BinType.CUSTOM_GROUP:
      enum:
      - custom_group
      type: string
  securitySchemes:
    session_cookie:
      type: apiKey
      in: cookie
      name: connect.sid
    api_key:
      type: apiKey
      in: header
      name: Authorization
      description: Value should be 'ApiKey <your key>'