> ## Documentation Index
> Fetch the complete documentation index at: https://cubed3-claude-gallant-ramanujan-cfbiab.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# List dbt syncs for a deployment

Returns this deployment's dbt sync history, newest first, backed by durable records rather than the live workflow engine — so a run stays listable long after `GET /dbt-sync/{syncJobId}` stops answering for it. Cancelled runs are included; narrow the list with `status` or `trigger`.

Results are paged with cursor pagination: pass `first` for the page size and `after` (the previous response's `pageInfo.endCursor`) for the next page.


## OpenAPI

````yaml /api-reference/api.yaml get /api/v1/deployments/{deploymentId}/dbt-sync
openapi: 3.1.0
info:
  title: Cube Platform API
  version: 1.0.0
  description: >-
    Programmatically manage Cube: deployments and everything scoped to them

    (environments, folders, reports, workbooks, notifications, workspace, and
    agents),

    plus account-level users, groups, policies, embedding, and AI settings.
    Data-model

    authoring, dev mode, branches, and uploads live under /build/api/v1 — same
    host and

    token, routed to the build pods.
servers:
  - url: https://{tenant}.cubecloud.dev
    description: Your tenant host. Replace the whole host if you use a custom domain.
    variables:
      tenant:
        default: your-tenant
        description: Your Cube tenant subdomain
security:
  - bearerAuth: []
tags:
  - name: Deployments
  - name: Deployment Creation
  - name: Environments
  - name: Env Variables
  - name: Regions
  - name: Data Model
  - name: Data Model Uploads
  - name: GitHub
  - name: GitHub Connection
  - name: dbt Sync
  - name: Folders
  - name: Reports
  - name: Workbooks
  - name: Notifications
  - name: Workspace
  - name: Users Admin
  - name: User Attributes
  - name: User Attribute Values
  - name: Tenant Settings
  - name: OAuth Integrations
  - name: User OAuth Tokens
  - name: OIDC Token Configs
  - name: App Theme
  - name: Embed
  - name: Embed Tenants
  - name: Dashboard Embed Access
  - name: OpenAPI Spec
paths:
  /api/v1/deployments/{deploymentId}/dbt-sync:
    get:
      tags:
        - dbt Sync
      summary: List dbt syncs for a deployment
      operationId: listDbtSyncs
      parameters:
        - in: path
          name: deploymentId
          required: true
          schema:
            type: integer
        - in: query
          name: status
          required: false
          schema:
            type: string
            enum:
              - RUNNING
              - COMPLETED
              - FAILED
              - CANCELLED
              - UNKNOWN
        - in: query
          name: trigger
          required: false
          schema:
            type: string
            enum:
              - manual
              - api
              - webhook
              - agent
              - unknown
        - in: query
          name: after
          required: false
          schema:
            type: string
          description: >-
            Opaque cursor for the next page; pass the previous response's
            `pageInfo.endCursor`.
        - in: query
          name: first
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 200
          description: Page size for cursor pagination (default 100, max 200).
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DbtSyncRunListResponse'
          description: ''
components:
  schemas:
    DbtSyncRunListResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/DbtSyncRun'
          type: array
        pageInfo:
          $ref: '#/components/schemas/PageInfo'
      required:
        - items
        - pageInfo
      type: object
    DbtSyncRun:
      properties:
        branchName:
          description: The Cube branch this sync wrote its generated cubes to.
          type: string
        completedAt:
          description: >-
            When the sync finished, as an ISO 8601 timestamp, or `null` while it
            is still running. Use `durationMs` to show how long a run took
            rather than subtracting this from `startedAt`.
          oneOf:
            - type: string
            - type: 'null'
        deploymentId:
          type: integer
        durationMs:
          description: >-
            How long the sync took, in milliseconds. `null` while the sync is
            running.
          oneOf:
            - type: integer
            - type: 'null'
        errorMessage:
          description: Why the sync stopped. `null` unless the run failed.
          oneOf:
            - type: string
            - type: 'null'
        failedPhase:
          description: >-
            The phase that failed, e.g. dbt-compile. `null` unless the run
            failed.
          oneOf:
            - type: string
            - type: 'null'
        gitRef:
          description: >-
            The dbt-repository ref this sync was run against, when pinned.
            `null` otherwise.
          oneOf:
            - type: string
            - type: 'null'
        lastStage:
          description: The pipeline stage the run reached, e.g. COMPILING_DBT.
          oneOf:
            - type: string
            - type: 'null'
        phases:
          description: >-
            Per-phase timings, in the order they ran. Omitted while the sync is
            still running.
          items:
            $ref: '#/components/schemas/DbtSyncRunPhase'
          type: array
        startedAt:
          description: When the sync started, as an ISO 8601 timestamp.
          type: string
        stats:
          $ref: '#/components/schemas/DbtSyncRunStats'
        status:
          description: >-
            RUNNING, COMPLETED, FAILED, CANCELLED or UNKNOWN. UNKNOWN means the
            outcome could not be established and is deliberately distinct from
            FAILED. Treat an unrecognized value as non-terminal.
          type: string
        syncJobId:
          type: string
        trigger:
          description: >-
            What started the sync: manual (the Cube UI), api (this REST API),
            webhook (a push to the dbt repository), agent (Cube AI), or unknown.
          type: string
        triggerContext:
          $ref: '#/components/schemas/DbtSyncRunTriggerContext'
        userId:
          description: >-
            The Cube user who started the sync, when a user started it. `null`
            otherwise.
          oneOf:
            - type: integer
            - type: 'null'
      required:
        - syncJobId
        - deploymentId
        - status
        - trigger
        - branchName
        - startedAt
      type: object
    PageInfo:
      properties:
        endCursor:
          oneOf:
            - type: string
            - type: 'null'
        hasNextPage:
          type: boolean
        hasPreviousPage:
          type: boolean
        startCursor:
          oneOf:
            - type: string
            - type: 'null'
      required:
        - hasNextPage
        - hasPreviousPage
      type: object
    DbtSyncRunPhase:
      properties:
        durationMs:
          description: How long the phase took, in milliseconds.
          type: integer
        outcome:
          description: ok or failed.
          type: string
        phase:
          description: Phase token, e.g. repo-clone, dbt-deps, dbt-compile.
          type: string
        startedOffsetMs:
          description: When the phase began, in milliseconds after the sync started.
          type: integer
      required:
        - phase
        - startedOffsetMs
        - durationMs
        - outcome
      type: object
    DbtSyncRunStats:
      properties:
        cubeCount:
          description: How many cubes the sync generated.
          oneOf:
            - type: integer
            - type: 'null'
        generatedFileCount:
          description: How many files the sync wrote to the branch it created.
          oneOf:
            - type: integer
            - type: 'null'
        macros:
          description: dbt macros found in the manifest.
          oneOf:
            - type: integer
            - type: 'null'
        models:
          description: dbt models found in the manifest.
          oneOf:
            - type: integer
            - type: 'null'
        sources:
          description: dbt sources found in the manifest.
          oneOf:
            - type: integer
            - type: 'null'
      type: object
    DbtSyncRunTriggerContext:
      description: Provenance for a webhook-triggered sync. Refs only — never the pusher.
      properties:
        headSha:
          type: string
        pushedBranch:
          type: string
        targetBranch:
          type: string
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Token authentication. Send `Authorization: Bearer <YOUR_TOKEN>`.'

````