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

# Detail scan history API: list and inspect analysis runs

> Retrieve Detail scan history for a repository. List past scans, check their status, and link bug findings to the scan that surfaced them.

The scans endpoint lets you browse the history of Detail analysis runs for a repository. Each scan record tells you when the analysis ran, what commit it covered, how it was triggered, and how many bugs it found. You can also use a scan's `workflowRequestId` to filter bug results to only those surfaced during that specific scan.

***

## GET /public/v1/scans

Returns a paginated list of scans for a repository, ordered newest first.

```bash theme={null}
curl "https://api.detail.dev/public/v1/scans?repo_id=repo_abc123" \
  -H "Authorization: Bearer dtl_live_YOUR_KEY"
```

### Query parameters

<ParamField query="repo_id" type="string" required>
  The repository ID to fetch scans for. Repository IDs are prefixed with `repo_` and are returned by [GET /public/v1/repos](/api/repos). Example: `repo_abc123`.
</ParamField>

<ParamField query="limit" type="integer">
  Number of results to return. Between `1` and `100`. Defaults to `50`.
</ParamField>

<ParamField query="offset" type="integer">
  Number of results to skip for pagination. Defaults to `0`.
</ParamField>

### Response

<ResponseField name="scans" type="Scan[]">
  Array of scan objects for the repository.

  <Expandable title="Scan fields">
    <ResponseField name="workflowRequestId" type="string | null">
      Unique identifier for the scan, prefixed with `wr_`. Pass this as `workflow_request_id` when querying [GET /public/v1/bugs](/api/bugs) to scope results to this scan.
    </ResponseField>

    <ResponseField name="repoId" type="string">
      ID of the repository that was scanned.
    </ResponseField>

    <ResponseField name="repoName" type="string">
      Short name of the repository (without owner prefix).
    </ResponseField>

    <ResponseField name="ownerName" type="string">
      GitHub owner (user or organization) of the repository.
    </ResponseField>

    <ResponseField name="workflowStatus" type="string | null">
      Current status of the scan. One of:

      * `in_progress` — the scan is still running
      * `complete` — the scan finished successfully
      * `failed` — the scan encountered an error
      * `dlq` — the scan was moved to the dead-letter queue after repeated failures
    </ResponseField>

    <ResponseField name="scanType" type="string | null">
      The analysis mode used. One of:

      * `default` — full repository scan
      * `recentChanges` — analysis focused on recently changed code
    </ResponseField>

    <ResponseField name="initiator" type="string">
      What triggered the scan. One of:

      * `scheduler` — triggered automatically on a schedule
      * `scanNow` — triggered manually via the dashboard or CLI
    </ResponseField>

    <ResponseField name="commitSha" type="string | null">
      The full commit SHA that the scan analysed.
    </ResponseField>

    <ResponseField name="createdAt" type="integer">
      Unix timestamp (milliseconds) when the scan was created.
    </ResponseField>

    <ResponseField name="completedAt" type="integer | null">
      Unix timestamp (milliseconds) when the scan completed. `null` if the scan is still in progress.
    </ResponseField>

    <ResponseField name="bugCounts" type="object | null">
      Breakdown of bug counts for this scan. `null` while the scan is in progress.

      <Expandable title="bugCounts fields">
        <ResponseField name="total" type="integer">
          Total number of bugs found.
        </ResponseField>

        <ResponseField name="open" type="integer">
          Bugs with `pending` review state.
        </ResponseField>

        <ResponseField name="resolved" type="integer">
          Bugs marked as `resolved`.
        </ResponseField>

        <ResponseField name="dismissed" type="integer">
          Bugs marked as `dismissed`.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="integer">
  Total number of scans for the repository, regardless of `limit` and `offset`.
</ResponseField>

### Example response

```json theme={null}
{
  "scans": [
    {
      "workflowRequestId": "wr_abc123",
      "repoId": "repo_xyz789",
      "repoName": "my-repo",
      "ownerName": "myorg",
      "workflowStatus": "complete",
      "scanType": "default",
      "initiator": "scheduler",
      "commitSha": "abc1234567890abcdef",
      "createdAt": 1736899200000,
      "completedAt": 1736899800000,
      "bugCounts": {
        "total": 5,
        "open": 3,
        "resolved": 1,
        "dismissed": 1
      }
    },
    {
      "workflowRequestId": "wr_def456",
      "repoId": "repo_xyz789",
      "repoName": "my-repo",
      "ownerName": "myorg",
      "workflowStatus": "in_progress",
      "scanType": "recentChanges",
      "initiator": "scanNow",
      "commitSha": "def4567890abcdef12",
      "createdAt": 1737072000000,
      "completedAt": null,
      "bugCounts": null
    }
  ],
  "total": 8
}
```

<Note>
  To list the bugs surfaced by a specific scan, pass its `workflowRequestId` as the `workflow_request_id` parameter when calling [GET /public/v1/bugs](/api/bugs).

  ```bash theme={null}
  curl "https://api.detail.dev/public/v1/bugs?repo_id=repo_xyz789&status=pending&workflow_request_id=wr_abc123" \
    -H "Authorization: Bearer dtl_live_YOUR_KEY"
  ```
</Note>
