For the complete documentation index, see llms.txt. This page is also available as Markdown.

Repositories

Read APIs for the Repositories page.

List code repositories

get
/api/v2/repositories

List repositories for a project.

Required scopes
This endpoint requires the following scopes:
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
pageinteger · int64Optional

Page number to fetch (starting from 0)

Default: 0Example: 4
pageSizeinteger · int64 · min: 1 · max: 100Optional

Number of results per page

Default: 30Example: 50
sortstring · enumOptional

Sort field

Default: lastScanAtExample: severityPossible values:
orderstring · enumOptional

Sort direction

Default: DESCExample: DESCPossible values:
searchstring · max: 256Optional

Case-insensitive name substring

Example: nodegoat
typesstring · max: 64Optional

Comma-separated target types. Empty means repository.

Example: repositoryPattern: ^(repository(,(repository))*)?$
sourcestring · max: 1024Optional

Comma-separated sources. Use Unknown for null/empty source.

Example: Github,Gitlab,UnknownPattern: ^([^,]+(,[^,]+)*)?$
scanTypesstring · max: 256Optional

Comma-separated scan types

Example: SAST,SCAPattern: ^([^,]+(,[^,]+)*)?$
scannersstring · max: 512Optional

Comma-separated scanner names

Example: semgrep,checkovPattern: ^([^,]+(,[^,]+)*)?$
severitystringOptional

Comma-separated severities with a non-zero occurrence count

Example: critical,highPattern: ^((critical|high|medium|low|info|unassigned)(,(critical|high|medium|low|info|unassigned))*)?$
Responses
200

OK response.

application/json
get/api/v2/repositories
GET /gateway/sto/api/v2/repositories?accountId=abcdef1234567890ghijkl&orgId=example_org&projectId=example_project HTTP/1.1
Host: app.harness.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "pagination": {
    "link": "",
    "page": 4,
    "pageSize": 20,
    "totalItems": 230,
    "totalPages": 12
  },
  "results": [
    {
      "executionId": "abcdef1234567890ghijkl",
      "executionSource": "harness",
      "executionUrl": "https://jenkins.example.com/job/42",
      "id": "abcdef1234567890ghijkl",
      "isBaseline": true,
      "isCommit": false,
      "issueSeverityCounts": {
        "critical": 3,
        "high": 4,
        "info": 1,
        "low": 2,
        "medium": 5,
        "unassigned": 0
      },
      "lastScanAt": 1751793300000,
      "name": "NodeGoat",
      "occurrenceSeverityCounts": {
        "critical": 3,
        "high": 4,
        "info": 1,
        "low": 2,
        "medium": 5,
        "unassigned": 0
      },
      "pipelineId": "Security_Gate",
      "scanType": {
        "Aut ad maiores.": [
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          }
        ],
        "Nam dolorem nostrum.": [
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          }
        ]
      },
      "source": "Github",
      "targetName": "main",
      "targetVariantId": "abcdef1234567890ghijkl",
      "url": "https://github.com/example/repo"
    },
    {
      "executionId": "abcdef1234567890ghijkl",
      "executionSource": "harness",
      "executionUrl": "https://jenkins.example.com/job/42",
      "id": "abcdef1234567890ghijkl",
      "isBaseline": true,
      "isCommit": false,
      "issueSeverityCounts": {
        "critical": 3,
        "high": 4,
        "info": 1,
        "low": 2,
        "medium": 5,
        "unassigned": 0
      },
      "lastScanAt": 1751793300000,
      "name": "NodeGoat",
      "occurrenceSeverityCounts": {
        "critical": 3,
        "high": 4,
        "info": 1,
        "low": 2,
        "medium": 5,
        "unassigned": 0
      },
      "pipelineId": "Security_Gate",
      "scanType": {
        "Aut ad maiores.": [
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          }
        ],
        "Nam dolorem nostrum.": [
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          }
        ]
      },
      "source": "Github",
      "targetName": "main",
      "targetVariantId": "abcdef1234567890ghijkl",
      "url": "https://github.com/example/repo"
    },
    {
      "executionId": "abcdef1234567890ghijkl",
      "executionSource": "harness",
      "executionUrl": "https://jenkins.example.com/job/42",
      "id": "abcdef1234567890ghijkl",
      "isBaseline": true,
      "isCommit": false,
      "issueSeverityCounts": {
        "critical": 3,
        "high": 4,
        "info": 1,
        "low": 2,
        "medium": 5,
        "unassigned": 0
      },
      "lastScanAt": 1751793300000,
      "name": "NodeGoat",
      "occurrenceSeverityCounts": {
        "critical": 3,
        "high": 4,
        "info": 1,
        "low": 2,
        "medium": 5,
        "unassigned": 0
      },
      "pipelineId": "Security_Gate",
      "scanType": {
        "Aut ad maiores.": [
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          }
        ],
        "Nam dolorem nostrum.": [
          {
            "id": "trivy",
            "prettyName": "Trivy"
          },
          {
            "id": "trivy",
            "prettyName": "Trivy"
          }
        ]
      },
      "source": "Github",
      "targetName": "main",
      "targetVariantId": "abcdef1234567890ghijkl",
      "url": "https://github.com/example/repo"
    }
  ]
}

List a repository's scanned variants

get
/api/v2/repositories/{targetId}/variants

List scanned variants for a repository, newest first. Optional search matches variant name or exact variant id.

Required scopes
This endpoint requires the following scopes:
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Path parameters
targetIdstringRequired

Associated Target ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
searchstring · max: 256Optional

Case-insensitive variant name substring, or exact variant id

Example: mai
pageinteger · int64Optional

Page number to fetch (starting from 0)

Default: 0Example: 4
pageSizeinteger · int64 · min: 1 · max: 100Optional

Results per page

Default: 10Example: 50
Responses
200

OK response.

application/json
get/api/v2/repositories/{targetId}/variants
GET /gateway/sto/api/v2/repositories/{targetId}/variants?accountId=abcdef1234567890ghijkl&orgId=example_org&projectId=example_project HTTP/1.1
Host: app.harness.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "pagination": {
    "link": "",
    "page": 4,
    "pageSize": 20,
    "totalItems": 230,
    "totalPages": 12
  },
  "results": [
    {
      "created": 1651578240,
      "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "parameters": {
        "branch": "main"
      },
      "targetId": "abcdef1234567890ghijkl"
    },
    {
      "created": 1651578240,
      "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "parameters": {
        "branch": "main"
      },
      "targetId": "abcdef1234567890ghijkl"
    },
    {
      "created": 1651578240,
      "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "parameters": {
        "branch": "main"
      },
      "targetId": "abcdef1234567890ghijkl"
    },
    {
      "created": 1651578240,
      "hash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
      "id": "abcdef1234567890ghijkl",
      "lastModified": 1651578240,
      "parameters": {
        "branch": "main"
      },
      "targetId": "abcdef1234567890ghijkl"
    }
  ]
}

Get repositories overview

get
/api/v2/repositories/overview

Aggregate widgets for the Repositories page.

Required scopes
This endpoint requires the following scopes:
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Query parameters
accountIdstringRequired

Harness Account ID

Example: abcdef1234567890ghijklPattern: ^[a-zA-Z0-9_-]{22}$
orgIdstring · max: 128Required

Harness Organization ID

Example: example_orgPattern: ^[A-Za-z_][A-Za-z0-9_]*$
projectIdstring · max: 128Required

Harness Project ID

Example: example_projectPattern: ^[A-Za-z_][A-Za-z0-9_]*$
Responses
200

OK response.

application/json

Aggregate widgets for the Repositories page.

baselineSetinteger · int64Required

Repositories with a baseline set

Example: 90
issueRemediationsinteger · int64Optional

Change in remediated issues since UTC midnight

Example: 40
occurrenceRemediationsinteger · int64Optional

Change in remediated occurrences since UTC midnight

Example: 100
totalRepositoriesinteger · int64Required

Total repositories

Example: 128
get/api/v2/repositories/overview
GET /gateway/sto/api/v2/repositories/overview?accountId=abcdef1234567890ghijkl&orgId=example_org&projectId=example_project HTTP/1.1
Host: app.harness.io
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "baselineSet": 90,
  "issueRemediations": 40,
  "issueSeverityDeltas": {
    "critical": -2,
    "high": 1,
    "info": 0,
    "low": -5,
    "medium": 0,
    "unassigned": 0
  },
  "issueSeverityTotals": {
    "critical": 3,
    "high": 4,
    "info": 1,
    "low": 2,
    "medium": 5,
    "unassigned": 0
  },
  "occurrenceRemediations": 100,
  "occurrenceSeverityDeltas": {
    "critical": -2,
    "high": 1,
    "info": 0,
    "low": -5,
    "medium": 0,
    "unassigned": 0
  },
  "occurrenceSeverityTotals": {
    "critical": 3,
    "high": 4,
    "info": 1,
    "low": 2,
    "medium": 5,
    "unassigned": 0
  },
  "sourceBreakdown": [
    {
      "count": 42,
      "source": "Github"
    },
    {
      "count": 42,
      "source": "Github"
    }
  ],
  "totalRepositories": 128
}

Last updated

Was this helpful?