Skip to main content

repository

Query:repository Fetch the details of one of your repositories.

Arguments

FieldTypeDescription
nameString!The name of the repository to lookup.
loginString!The login or username of the account under which the repository exists.
vcsProviderVCSProvider!VCS Provider of the account.

Sample Request

query {
  repository(
      name:"demo-go",
      login:"cyberdyne",
      vcsProvider:GITHUB
    ) {
    name
    defaultBranch
    dsn
    isPrivate
    analysisRuns {
      edges {
        node {
          runUid
        }
      }
    }
  }
}

Sample Response

{
  "data": {
    "repository": {
      "name": "demo-go",
      "defaultBranch": "master",
      "dsn": "https://[email protected]",
      "isPrivate": true,
      "analysisRuns": {
        "edges": [
          {
            "node": {
              "runUid": "5d821174-04vf-4214-b56d-ced0a7ca209e"
            }
          },
          {
            "node": {
              "runUid": "6ff1cdb8-9abe-4307-a177-4b9f8d3ba639"
            }
          },
        ]
      }
    }
  }
}

SCA Queries

Fetching Repository Targets

Query to list all SCA targets configured for a repository.
query {
  repository(
    name: "my-app",
    login: "myorg",
    vcsProvider: GITHUB
  ) {
    name
    targets {
      edges {
        node {
          id
          ecosystem
          packageManager
          manifestPath
          lockfilePath
          source
          isActivated
        }
      }
    }
  }
}
Sample Response:
{
  "data": {
    "repository": {
      "name": "my-app",
      "targets": {
        "edges": [
          {
            "node": {
              "id": "UmVwb3NpdG9yeVRhcmdldDoxMjM0NQ==",
              "ecosystem": "NPM",
              "packageManager": "NPM",
              "manifestPath": "package.json",
              "lockfilePath": "package-lock.json",
              "source": "AUTO",
              "isActivated": true
            }
          },
          {
            "node": {
              "id": "UmVwb3NpdG9yeVRhcmdldDoxMjM0Ng==",
              "ecosystem": "PYPI",
              "packageManager": "REQUIREMENTS_TXT",
              "manifestPath": "requirements.txt",
              "lockfilePath": "requirements.txt",
              "source": "AUTO",
              "isActivated": true
            }
          }
        ]
      }
    }
  }
}

Fetching Dependency Vulnerabilities

Query to list all dependency vulnerability occurrences in a repository.
query {
  repository(
    name: "my-app",
    login: "myorg",
    vcsProvider: GITHUB
  ) {
    name
    dependencyVulnerabilityOccurrences(first: 10) {
      edges {
        node {
          id
          reachability
          fixability
          vulnerability {
            identifier
            summary
            severity
            cvssV3BaseScore
            cvssV3Severity
            epssScore
            publishedAt
            fixedVersions
            referenceUrls
          }
          package {
            name
            ecosystem
          }
          packageVersion {
            version
          }
        }
      }
      pageInfo {
        hasNextPage
        endCursor
      }
    }
  }
}
Sample Response:
{
  "data": {
    "repository": {
      "name": "my-app",
      "dependencyVulnerabilityOccurrences": {
        "edges": [
          {
            "node": {
              "id": "VnVsbmVyYWJpbGl0eU9jY3VycmVuY2U6MTIzNDU=",
              "reachability": "REACHABLE",
              "fixability": "AUTO_FIXABLE",
              "vulnerability": {
                "identifier": "CVE-2024-12345",
                "summary": "Critical vulnerability in package XYZ",
                "severity": "CRITICAL",
                "cvssV3BaseScore": 9.8,
                "cvssV3Severity": "CRITICAL",
                "epssScore": 0.95,
                "publishedAt": "2024-01-15T10:30:00Z",
                "fixedVersions": ["1.2.5", "2.0.1"],
                "referenceUrls": [
                  "https://nvd.nist.gov/vuln/detail/CVE-2024-12345",
                  "https://github.com/advisories/GHSA-xxxx-yyyy-zzzz"
                ]
              },
              "package": {
                "name": "vulnerable-package",
                "ecosystem": "NPM"
              },
              "packageVersion": {
                "version": "1.2.3"
              }
            }
          }
        ],
        "pageInfo": {
          "hasNextPage": true,
          "endCursor": "YXJyYXljb25uZWN0aW9uOjE="
        }
      }
    }
  }
}

Fetching a Specific Vulnerability Occurrence

Query to fetch details of a specific vulnerability occurrence by ID.
query {
  repository(
    name: "my-app",
    login: "myorg",
    vcsProvider: GITHUB
  ) {
    dependencyVulnerabilityOccurrence(
      id: "VnVsbmVyYWJpbGl0eU9jY3VycmVuY2U6MTIzNDU="
    ) {
      id
      reachability
      fixability
      vulnerability {
        identifier
        aliases
        summary
        details
        severity
        cvssV3Vector
        cvssV3BaseScore
        introducedVersions
        fixedVersions
        publishedAt
        updatedAt
      }
      package {
        name
        ecosystem
        purl
      }
      packageVersion {
        version
        versionType
      }
    }
  }
}
Sample Response:
{
  "data": {
    "repository": {
      "dependencyVulnerabilityOccurrence": {
        "id": "VnVsbmVyYWJpbGl0eU9jY3VycmVuY2U6MTIzNDU=",
        "reachability": "REACHABLE",
        "fixability": "AUTO_FIXABLE",
        "vulnerability": {
          "identifier": "CVE-2024-12345",
          "aliases": ["GHSA-xxxx-yyyy-zzzz"],
          "summary": "Critical vulnerability in package XYZ",
          "details": "Detailed description of the vulnerability...",
          "severity": "CRITICAL",
          "cvssV3Vector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
          "cvssV3BaseScore": 9.8,
          "introducedVersions": ["1.0.0"],
          "fixedVersions": ["1.2.5", "2.0.1"],
          "publishedAt": "2024-01-15T10:30:00Z",
          "updatedAt": "2024-01-20T15:45:00Z"
        },
        "package": {
          "name": "vulnerable-package",
          "ecosystem": "NPM",
          "purl": "pkg:npm/[email protected]"
        },
        "packageVersion": {
          "version": "1.2.3",
          "versionType": "SEMVER"
        }
      }
    }
  }
}

Fetching a Specific Repository Target

Query to fetch details of a specific repository target by ID.
query {
  repository(
    name: "my-app",
    login: "myorg",
    vcsProvider: GITHUB
  ) {
    target(id: "UmVwb3NpdG9yeVRhcmdldDoxMjM0NQ==") {
      id
      ecosystem
      packageManager
      manifestPath
      lockfilePath
      source
      isActivated
    }
  }
}
Sample Response:
{
  "data": {
    "repository": {
      "target": {
        "id": "UmVwb3NpdG9yeVRhcmdldDoxMjM0NQ==",
        "ecosystem": "NPM",
        "packageManager": "NPM",
        "manifestPath": "package.json",
        "lockfilePath": "package-lock.json",
        "source": "AUTO",
        "isActivated": true
      }
    }
  }
}

regenerateRepositoryDSN

Mutation:regenerateRepositoryDSN Regenerate a repository’s DSN.

Arguments

FieldTypeDescription
inputRegenerateRepositoryDSNInput!Input for RegenerateRepositoryDSN mutation.

Sample Request

mutation ($input: RegenerateRepositoryDSNInput!) {
  regenerateRepositoryDSN(input: $input) {
    dsn
  }
}
variables = {
  "input": {
    "repositoryId": "VHJhbnNmb3JtZXI6bGp6a3d6"
  }
}

Sample Response

{
  "regenerateRepositoryDSN": {
    "dsn": "https://[email protected]"
  }
}

updateRepositoryDefaultBranch

Mutation:updateRepositoryDefaultBranch Update a repository’s default branch for baseline. If the repository is activated, this action will trigger a new analysis. Only available to users with WRITE permission on the repository.

Arguments

FieldTypeDescription
inputUpdateRepositoryDefaultBranchInput!Input for UpdateRepositoryDefaultBranch mutation

Sample Request

mutation ($input: UpdateRepositoryDefaultBranchInput!) {
  updateRepositoryDefaultBranch(input: $input) {
    ok
    repository {
      defaultBranchName
    }
  }
}
variables = {
  "input": {
    "id": "VHJhbnNmb3JtZXI6bGp6a3d6",
    "defaultBranchName": "add-awesomeness"
  }
}

Sample Response

{
  "updateRepositoryDefaultBranch": {
    "ok": true,
    "repository": {"defaultBranchName": "add-awesomeness"}
  }
}

updateRepositoryIssueCategorySetting

Mutation:updateRepositoryIssueCategorySetting Update a repository’s issue configuration (also known as quality gates). Only users with WRITE permission on the repository can trigger this mutation.

Arguments

FieldTypeDescription
inputUpdateRepositoryIssueCategorySettingInput!Input for UpdateRepositoryIssueCategorySetting mutation.

Sample Request

mutation ($input: UpdateRepositoryIssueCategorySettingInput!) {
  updateRepositoryIssueCategorySetting(input: $input) {
    ok
  }
}
{
  "input": {
    "repositoryId": "Umwm3NpdG9yeTprZ3dyb222",
		"issueCategory": "ANTI_PATTERN",
    "isReported": true,
    "canFailCheck": false
  }
}

Sample Response

{
  "data": {
    "updateRepositoryIssueCategorySetting": {
      "ok": true
    }
  }
}

updateRepositoryMetricSetting

Mutation:updateRepositoryMetricSetting Update a repository’s metric quality gates configuration. Only users with WRITE permission on the repository can trigger this mutation.

Arguments

FieldTypeDescription
inputUpdateRepositoryMetricSettingInput!Input for updateRepositoryMetricSetting mutation.

Sample Request

mutation UpdateRepositoryMetricSetting($input: UpdateRepositoryMetricSettingInput!) {
  updateRepositoryMetricSetting(input: $input) {
    ok
  }
}
{
  "input": {
    "repositoryId": "Umvwb2NpdG9yeTphanZqcGx=",
    "metricShortcode": "LCV",
    "isReported": true,
    "isThresholdEnforced": true
  }
}

Sample Response

{
  "data": {
  	"updateRepositoryMetricSetting": {
  		"ok": true
  	}
  }
}

activateRepository

Mutation:activateRepositoryActivate analysis on a repository. Only users with WRITE permission on the repository can trigger this mutation.

Arguments

FieldTypeDescription
inputActivateRepositoryInput!Input for activateRepository mutation.

Sample Request

mutation ($input: ActivateRepositoryInput!) {
  activateRepository(input: $input) {
    ok
  }
}
{
  "input": {
    "repositoryId": "Umwm3NpdG9yeTprZ3dyb222"
  }
}

Sample Response

{
  "data": {
    "activateRepository": {
      "ok": true
    }
  }
}

deactivateRepository

Mutation:deactivateRepositoryDeactivate analysis on a repository. Only users with WRITE permission on the repository can trigger this mutation.

Arguments

FieldTypeDescription
inputDeactivateRepositoryInput!Input for deactivateRepository mutation.

Sample Request

mutation ($input: DeactivateRepositoryInput!) {
  deactivateRepository(input: $input) {
    ok
  }
}
{
  "input": {
    "repositoryId": "Umwm3NpdG9yeTprZ3dyb222"
  }
}

Sample Response

{
  "data": {
    "deactivateRepository": {
      "ok": true
    }
  }
}

Objects

Repository

FieldTypeDescription
idID!The ID of the object.
nameString!The name of this repository.
vcsProviderVCSProvider!VCS Provider of the repository.
vcsUrlString!URL of the repository on the VCS.
latestCommitOidStringObject ID of the latest commit on the default branch.
isPrivateBoolean!Repository visibility on the VCS provider.
isActivatedBoolean!Repository activation status.
configJsonJSONThe `.deepsource.toml` config of the repository represented as a JSON object.
defaultBranchStringThe default base branch of the repository on DeepSource.
dsnStringThe DSN value for this repository.
accountAccount!The account under which this repository exists.
analysisRunsAnalysisRunConnectionPast analysis runs for the repository
offsetInt
beforeString
afterString
firstInt
lastInt
enabledAnalyzersAnalyzerConnectionThe analyzers enabled in this repository.
offsetInt
beforeString
afterString
firstInt
lastInt
issuesRepositoryIssueConnectionGet all issues raised in the default branch of this repository. Specifying a path would only return those issues whose occurrences are present in the file at path.
pathStringShow issues for this path only.
offsetInt
beforeString
afterString
firstInt
lastInt
ignoreRulesIgnoreRuleConnectionList of `IgnoreRule`s that exist for the repository.
issueShortcodeStringFilter by an `Issue` shortcode.
filePathStringFilter by a specific file’s path.
offsetInt
beforeString
afterString
firstInt
lastInt
dependencyVulnerabilityOccurrencesVulnerabilityOccurrenceConnectionList of dependency vulnerability occurrences in the default branch.
offsetInt
beforeString
afterString
firstInt
lastInt
dependencyVulnerabilityOccurrenceVulnerabilityOccurrence!Get a dependency vulnerability occurrence by its ID.
idID!The ID of the vulnerability occurrence.
targetRepositoryTarget!Get a specific repository target.
idID!The ID of the repository target.
targetsRepositoryTargetConnection!List of repository targets for this repository.
offsetInt
beforeString
afterString
firstInt
lastInt
reportReport!A report associated with this repository.
keyReportKey!The key of the report to fetch.
metrics[RepositoryMetric!]!List of all DeepSource metrics.
shortcodeIn[MetricShortcode]List of metric shortcodes to filter on.
issueCategorySettings[IssueCategorySetting!]!Issue categories quality gates configuration for the repository.
issuePrioritySettings[IssuePrioritySetting!]!Issue priority quality gates configuration for the repository.
metricSettings[MetricSetting!]!Metric quality gates configuration for the repository.
allowAutofixAiBoolean!Whether the account has allowed Autofix AI to run on private repositories.
useLegacyAutofixBoolean!Whether to use the legacy autofix engine.

RepositoryIssue

FieldTypeDescription
idID!The ID of the object.
issueIssue!Definition of the issue that has been raised.
occurrencesOccurrenceConnectionAll occurrences of this issue in the default branch.
offsetInt
beforeString
afterString
firstInt
lastInt
repositoryRepository!The repository for which this issue has been raised.

RepositoryIssueConnection

FieldTypeDescription
pageInfoPageInfo!Pagination data for this connection.
edgesRepositoryIssueEdge!Contains the nodes in this connection.
totalCountInt

RepositoryIssueEdge

A Relay edge containing a RepositoryIssue and its cursor.
FieldTypeDescription
nodeRepositoryIssueThe item at the end of the edge.
cursorString!A cursor for use in pagination.

RepositoryConnection

FieldTypeDescription
pageInfoPageInfo!Pagination data for this connection.
edges[RepositoryEdge]!Contains the nodes in this connection.
totalCountInt

RepositoryEdge

A Relay edge containing a Repository and its cursor.
FieldTypeDescription
nodeRepositoryThe item at the end of the edge.
cursorString!A cursor for use in pagination.

RegenerateRepositoryDSNInput

Input for the regenerateRepositoryDSN mutation.
FieldTypeDescription
repositoryIdID!GraphQL node ID of the repository.

RegenerateRepositoryDSNPayload

Payload for the regenerateRepositoryDSN mutation.
FieldTypeDescription
dsnString!The new DSN for the repository.

UpdateRepositoryDefaultBranchInput

Input for the updateRepositoryDefaultBranch mutation.
FieldTypeDescription
idID!GraphQL node ID of the repository.
defaultBranchNameString!Default branch for analysis on the repository.

UpdateRepositoryDefaultBranchPayload

Payload for the updateRepositoryDefaultBranch mutation.
FieldTypeDescription
okBoolean!Whether the operation was successful.
repositoryRepository!Repository type.

UpdateRepositoryIssueCategorySettingInput

Input for the updateRepositoryIssueCategorySetting mutation.
FieldTypeDescription
repositoryIdID!The repository’s ID.
issueCategoryIssueCategory!The issue category you want to update.
isReportedBoolean!Whether issues of a given category are enabled for reporting in the repository.
canFailCheckBoolean!Whether to fail checks when occurrence(s) of issues of a given category is found in the repository, an issue category can only be marked to fail a check if it is enabled for reporting.

UpdateRepositoryIssueCategorySettingPayload

Paylod for the updateRepositoryIssueCategorySetting mutation.
FieldTypeDescription
okBoolean!Whether the operation was successful.

UpdateRepositoryMetricSettingInput

Input for the updateRepositoryMetricSetting mutation.
FieldTypeDescription
repositoryIdID!The repository’s ID.
metricShortcodeMetricShortcode!The shortcode of the metric you want to update.
isReportedBoolean!Whether the metric is enabled for reporting in the repository.
isThresholdEnforcedBoolean!Whether to fail checks when the metric does not meet the threshold.

UpdateRepositoryMetricSettingPayload

Payload for the updateRepositoryMetricSetting mutation.
FieldTypeDescription
okBoolean!Whether the operation was successful.

ActivateRepositoryInput

Input for the activateRepository mutation.
FieldTypeDescription
repositoryIdID!GraphQL node ID of the repository.

ActivateRepositoryPayload

Payload for the activateRepository mutation.
FieldTypeDescription
okBoolean!Whether the operation was successful.

DeactivateRepositoryInput

Input for the deactivateRepository mutation.
FieldTypeDescription
repositoryIdID!GraphQL node ID of the repository.

DeactivateRepositoryPayload

Payload for the deactivateRepository mutation.
FieldTypeDescription
okBoolean!Whether the operation was successful.

VulnerabilityOccurrence

Represents an occurrence of a vulnerability in a specific package version within a repository.
FieldTypeDescription
idID!The ID of the object.
reachabilityVulnerabilityOccurrenceReachability!The reachability of the vulnerability occurrence.
fixabilityVulnerabilityOccurrenceFixability!The fixability of the vulnerability occurrence.
vulnerabilityVulnerability!The vulnerability details.
packagePackage!The package associated with the vulnerability occurrence.
packageVersionPackageVersion!The package version associated with the vulnerability occurrence.

VulnerabilityOccurrenceConnection

FieldTypeDescription
pageInfoPageInfo!Pagination data for this connection.
edges[VulnerabilityOccurrenceEdge]!Contains the nodes in this connection.
totalCountInt

VulnerabilityOccurrenceEdge

A Relay edge containing a VulnerabilityOccurrence and its cursor.
FieldTypeDescription
nodeVulnerabilityOccurrenceThe item at the end of the edge.
cursorString!A cursor for use in pagination.

Vulnerability

Details about a security vulnerability.
FieldTypeDescription
idID!The ID of the object.
identifierString!The identifier of the vulnerability (e.g., CVE).
aliases[String!]!The aliases of the vulnerability.
summaryStringThe summary of the vulnerability.
detailsStringThe detailed description of the vulnerability.
severityVulnerabilitySeverityOverall implied severity.
cvssV2VectorStringCVSS v2 vector.
cvssV2BaseScoreFloatCVSS v2 base score.
cvssV2SeverityVulnerabilitySeveritySeverity based on the CVSSv2 base score.
cvssV3VectorStringCVSS v3 vector.
cvssV3BaseScoreFloatCVSS v3 base score.
cvssV3SeverityVulnerabilitySeveritySeverity based on the CVSSv3 base score.
cvssV4VectorStringCVSS v4 vector.
cvssV4BaseScoreFloatCVSS v4 base score.
cvssV4SeverityVulnerabilitySeveritySeverity based on the CVSSv4 base score.
epssScoreFloatThe EPSS score of the vulnerability.
epssPercentileFloatThe EPSS percentile of the vulnerability.
introducedVersions[String]!Versions in which the vulnerability was introduced.
fixedVersions[String]!Versions in which the vulnerability was fixed.
referenceUrls[String]!Reference URLs for the vulnerability.
publishedAtDateTime!The time when the vulnerability was published.
updatedAtDateTime!The time when the vulnerability was updated.
withdrawnAtDateTimeThe time when the vulnerability was withdrawn.

RepositoryTarget

A Software Composition Analysis (SCA) target in a repository. Represents a manifest/lockfile pair for dependency scanning.
FieldTypeDescription
idID!The ID of the object.
ecosystemEcosystem!The ecosystem of the target.
packageManagerPackageManager!The package manager of the target.
manifestPathStringPath to the manifest file.
lockfilePathString!Path to the lockfile.
sourceRepositoryTargetSource!The source of the target.
isActivatedBoolean!Whether the target is activated.

RepositoryTargetConnection

FieldTypeDescription
pageInfoPageInfo!Pagination data for this connection.
edges[RepositoryTargetEdge]!Contains the nodes in this connection.
totalCountInt

RepositoryTargetEdge

A Relay edge containing a RepositoryTarget and its cursor.
FieldTypeDescription
nodeRepositoryTargetThe item at the end of the edge.
cursorString!A cursor for use in pagination.

Package

Represents a software package in a specific ecosystem.
FieldTypeDescription
idID!The ID of the object.
ecosystemEcosystem!The ecosystem of the package.
nameString!Name of the package.
purlStringThe package URL.

PackageVersion

Represents a specific version of a package.
FieldTypeDescription
idID!The ID of the object.
versionString!Version of the package.
versionTypePackageVersionTypeThe type of the package version.