Overview

Use the DeepSource GraphQL API to retrieve your data programmatically and easily automate your workflows.

Endpoint

For DeepSource Cloud:

https://api.deepsource.com/graphql/

For on-premise deployments:

https://[hostname]/api/graphql/

where hostname refers to the hostname of the DeepSource dashboard.

Authentication

Authenticate via a Personal Access Token (PAT). You need to pass it as a Bearer token in the Authorization header:

curl 'https://api.deepsource.com/graphql/' \
-X POST \
-H 'Authorization: Bearer <PERSONAL_ACCESS_TOKEN>' \
-H 'accept: application/json' \
-H 'content-type: application/json' \
--data '{ "query": "query { viewer { email } }" }'

Because GraphQL depends entirely on multiline JSON, we recommend that you use a GraphQL client like Altair or Insomnia. Note that the client wouldn't be able to perform requests or fetch the schema/documentation (which facilitates auto-complete) unless you add the Authorization header as above.

Playground

DeepSource API Playground is available as a Postman collection which can be accessed using this link.

Rate Limits

Rate limits define the maximum number of requests a single user account can make within a given period of time. If the rate limit is exceeded, the API responds with an HTTP 429 Too Many Requests response code.

Rate limits are applied at the user level and calculated across both read and write operations.

Currently, we enforce a flat rate limit of 5,000 requests per hour.

Node Query

The node query is a standard Relay Global Object Identification pattern that allows you to fetch any object by its unique ID. This is useful when you have an object's ID and want to retrieve its details without knowing which specific query to use.

Arguments

FieldTypeDescription
idID!The ID of the object.

Sample Request

query {
  node(id: "UmVwb3NpdG9yeTp4eXphYmM=") {
    id
    ... on Repository {
      name
      defaultBranch
      isActivated
    }
    ... on AnalysisRun {
      status
      commitOid
    }
  }
}

Sample Response

{
  "data": {
    "node": {
      "id": "UmVwb3NpdG9yeTp4eXphYmM=",
      "name": "my-repo",
      "defaultBranch": "main",
      "isActivated": true
    }
  }
}

Supported Types

The node query can return any of the following types:

Installation

The installation query returns details about the DeepSource installation. This is primarily useful for on-premise deployments.

Sample Request

query {
  installation {
    id
    name
    logo
  }
}

Sample Response

{
  "data": {
    "installation": {
      "id": "SW5zdGFsbGF0aW9uOjE=",
      "name": "DeepSource",
      "logo": "https://example.com/logo.png"
    }
  }
}

Installation Type

FieldTypeDescription
idID!The ID of the object.
nameString!The name of the installation.
logoString!The logo URL of the installation.

On this page