---
title: "List dbt syncs for a deployment"
method: GET
path: "/api/v1/deployments/{deploymentId}/dbt-sync"
tags: ["dbt Sync"]
---

# List dbt syncs for a deployment

`GET /api/v1/deployments/{deploymentId}/dbt-sync`

## Path parameters

- `deploymentId` integer, required

## Query parameters

- `status` 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'UNKNOWN'
- `trigger` 'manual' | 'api' | 'webhook' | 'agent' | 'unknown'
- `after` string
- `first` integer

## Response `200`

- DbtSyncRunListResponse
  - `items` DbtSyncRun[], required
    - `branchName` string, required — The Cube branch this sync wrote its generated cubes to.
    - `completedAt` string, nullable — When the sync finished, as an ISO 8601 timestamp, or null while it is still running. This is stamped by the process that ran the sync whereas startedAt is stamped by the process that launched it — two different clocks — so for a run that failed moments after starting, completedAt can even precede startedAt. Use durationMs to show how long a run took rather than subtracting these.
    - `deploymentId` integer, required
    - `durationMs` integer, nullable — How long the sync took, in milliseconds, and the value to use when showing a duration. Measured from a single clock, so it is never negative — prefer it over subtracting startedAt from completedAt, which can disagree with it by a small skew.
    - `errorMessage` string, nullable — Why the sync stopped. Present only for a failed run.
    - `failedPhase` string, nullable — The phase that failed, e.g. dbt-compile.
    - `gitRef` string, nullable — The dbt-repository ref this sync was run against, when pinned.
    - `lastStage` string, nullable — The pipeline stage the run reached, e.g. COMPILING_DBT.
    - `phases` DbtSyncRunPhase[], nullable — Per-phase timings, in the order they ran. Absent while the sync is running.
      - `durationMs` integer, required — How long the phase took, in milliseconds.
      - `outcome` string, required — ok or failed.
      - `phase` string, required — Phase token, e.g. repo-clone, dbt-deps, dbt-compile.
      - `startedOffsetMs` integer, required — When the phase began, in milliseconds after the sync started.
    - `startedAt` string, required — When the sync started, as an ISO 8601 timestamp. See completedAt before comparing the two.
    - `stats` DbtSyncRunStats
      - `cubeCount` integer, nullable — How many cubes the sync generated.
      - `generatedFileCount` integer, nullable — How many files the sync wrote to the branch it created.
      - `macros` integer, nullable — dbt macros found in the manifest.
      - `models` integer, nullable — dbt models found in the manifest.
      - `sources` integer, nullable — dbt sources found in the manifest.
    - `status` string, required — RUNNING, COMPLETED, FAILED, CANCELLED or UNKNOWN. UNKNOWN means the outcome could not be established (the run’s record was lost and the workflow engine no longer knows the workflow) and is deliberately distinct from FAILED. Treat an unrecognized value as non-terminal.
    - `syncJobId` string, required
    - `trigger` string, required — What started the sync: manual (the Cube Cloud UI), api (this REST API), webhook (a push to the dbt repository), agent (Cube AI), or unknown.
    - `triggerContext` DbtSyncRunTriggerContext
      - `headSha` string, nullable
      - `pushedBranch` string, nullable
      - `targetBranch` string, nullable
    - `userId` integer, nullable — The Cube user who started the sync, when a user started it.
  - `pageInfo` PageInfo, required
    - `endCursor` string, nullable
    - `hasNextPage` boolean, required
    - `hasPreviousPage` boolean, required
    - `startCursor` string, nullable

---

[API](https://skmtc.dev/cube-js/apis/cube-cloud-rest-api.md) · [All operations](https://skmtc.dev/cube-js/apis/cube-cloud-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/cube-js/cube-cloud-rest-api/revisions/97e151460143/schema)
