Sourcegraph API

Queries

areExecutorsConfigured

Description

Returns true if executors have been configured on the Sourcegraph instance. This is based on heuristics and doesn't necessarily mean that they would be working.

Response

Returns a Boolean!

Example

Query
query areExecutorsConfigured {
  areExecutorsConfigured
}
Response
{"data": {"areExecutorsConfigured": false}}

autocompleteMembersSearch

Description

Search for users that opt-in to search autocomplete.

Arguments
Name Description
organization - ID! The organization ID
query - String! Return users whose usernames or display names match the query.

Example

Query
query autocompleteMembersSearch(
  $organization: ID!,
  $query: String!
) {
  autocompleteMembersSearch(
    organization: $organization,
    query: $query
  ) {
    id
    username
    displayName
    avatarURL
    inOrg
  }
}
Variables
{"organization": 4, "query": "abc123"}
Response
{
  "data": {
    "autocompleteMembersSearch": [
      {
        "id": "4",
        "username": "abc123",
        "displayName": "xyz789",
        "avatarURL": "xyz789",
        "inOrg": false
      }
    ]
  }
}

backgroundJobs

Description

Get a list of background jobs that are currently known in the system.

Response

Returns a BackgroundJobConnection!

Arguments
Name Description
first - Int Returns the first n jobs. If omitted then it returns all of them.
after - String Opaque pagination cursor.
recentRunCount - Int The maximum number of recent runs to return for each routine.

Example

Query
query backgroundJobs(
  $first: Int,
  $after: String,
  $recentRunCount: Int
) {
  backgroundJobs(
    first: $first,
    after: $after,
    recentRunCount: $recentRunCount
  ) {
    nodes {
      ...BackgroundJobFragment
    }
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "first": 987,
  "after": "abc123",
  "recentRunCount": 123
}
Response
{
  "data": {
    "backgroundJobs": {
      "nodes": [BackgroundJob],
      "totalCount": 123,
      "pageInfo": PageInfo
    }
  }
}

clientConfiguration

Description

The configuration for clients.

Response

Returns a ClientConfigurationDetails!

Example

Query
query clientConfiguration {
  clientConfiguration {
    contentScriptUrls
    parentSourcegraph {
      ...ParentSourcegraphDetailsFragment
    }
  }
}
Response
{
  "data": {
    "clientConfiguration": {
      "contentScriptUrls": ["xyz789"],
      "parentSourcegraph": ParentSourcegraphDetails
    }
  }
}

codeHostSyncDue

Description

Returns true if any of the code hosts supplied are syncing now or within "seconds" from now.

Response

Returns a Boolean!

Arguments
Name Description
ids - [ID!]!
seconds - Int!

Example

Query
query codeHostSyncDue(
  $ids: [ID!]!,
  $seconds: Int!
) {
  codeHostSyncDue(
    ids: $ids,
    seconds: $seconds
  )
}
Variables
{"ids": ["4"], "seconds": 123}
Response
{"data": {"codeHostSyncDue": true}}

currentUser

Description

The current user.

Response

Returns a User

Example

Query
query currentUser {
  currentUser {
    executorSecrets {
      ...ExecutorSecretConnectionFragment
    }
    id
    username
    email
    displayName
    avatarURL
    url
    settingsURL
    createdAt
    updatedAt
    siteAdmin
    builtinAuth
    latestSettings {
      ...SettingsFragment
    }
    settingsCascade {
      ...SettingsCascadeFragment
    }
    configurationCascade {
      ...ConfigurationCascadeFragment
    }
    organizations {
      ...OrgConnectionFragment
    }
    organizationMemberships {
      ...OrganizationMembershipConnectionFragment
    }
    tags
    tosAccepted
    searchable
    usageStatistics {
      ...UserUsageStatisticsFragment
    }
    eventLogs {
      ...EventLogsConnectionFragment
    }
    emails {
      ...UserEmailFragment
    }
    accessTokens {
      ...AccessTokenConnectionFragment
    }
    externalAccounts {
      ...ExternalAccountConnectionFragment
    }
    session {
      ...SessionFragment
    }
    viewerCanAdminister
    viewerCanChangeUsername
    surveyResponses {
      ...SurveyResponseFragment
    }
    databaseID
    namespaceName
    invitableCollaborators {
      ...PersonFragment
    }
    teams {
      ...TeamConnectionFragment
    }
  }
}
Response
{
  "data": {
    "currentUser": {
      "executorSecrets": ExecutorSecretConnection,
      "id": "4",
      "username": "xyz789",
      "email": "xyz789",
      "displayName": "xyz789",
      "avatarURL": "xyz789",
      "url": "xyz789",
      "settingsURL": "xyz789",
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z",
      "siteAdmin": false,
      "builtinAuth": false,
      "latestSettings": Settings,
      "settingsCascade": SettingsCascade,
      "configurationCascade": ConfigurationCascade,
      "organizations": OrgConnection,
      "organizationMemberships": OrganizationMembershipConnection,
      "tags": ["abc123"],
      "tosAccepted": true,
      "searchable": false,
      "usageStatistics": UserUsageStatistics,
      "eventLogs": EventLogsConnection,
      "emails": [UserEmail],
      "accessTokens": AccessTokenConnection,
      "externalAccounts": ExternalAccountConnection,
      "session": Session,
      "viewerCanAdminister": false,
      "viewerCanChangeUsername": true,
      "surveyResponses": [SurveyResponse],
      "databaseID": 987,
      "namespaceName": "abc123",
      "invitableCollaborators": [Person],
      "teams": TeamConnection
    }
  }
}

evaluateFeatureFlag

Description

Evaluates a feature flag for the current user Returns null if feature flag does not exist

Response

Returns a Boolean

Arguments
Name Description
flagName - String!

Example

Query
query evaluateFeatureFlag($flagName: String!) {
  evaluateFeatureFlag(flagName: $flagName)
}
Variables
{"flagName": "abc123"}
Response
{"data": {"evaluateFeatureFlag": true}}

evaluatedFeatureFlags

Description

Retrieve all evaluated feature flags for the current user

Response

Returns [EvaluatedFeatureFlag!]!

Example

Query
query evaluatedFeatureFlags {
  evaluatedFeatureFlags {
    name
    value
  }
}
Response
{
  "data": {
    "evaluatedFeatureFlags": [
      {"name": "xyz789", "value": true}
    ]
  }
}

executorSecrets

Description

The list of all globally available executor secrets.

Response

Returns an ExecutorSecretConnection!

Arguments
Name Description
scope - ExecutorSecretScope! The scope for which secrets shall be returned.
first - Int Only return N records. Default = 50
after - String Opaque cursor for pagination.

Example

Query
query executorSecrets(
  $scope: ExecutorSecretScope!,
  $first: Int,
  $after: String
) {
  executorSecrets(
    scope: $scope,
    first: $first,
    after: $after
  ) {
    nodes {
      ...ExecutorSecretFragment
    }
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "scope": "BATCHES",
  "first": 50,
  "after": "xyz789"
}
Response
{
  "data": {
    "executorSecrets": {
      "nodes": [ExecutorSecret],
      "totalCount": 987,
      "pageInfo": PageInfo
    }
  }
}

executors

Description

Retrieve active executor compute instances.

Response

Returns an ExecutorConnection!

Arguments
Name Description
query - String An (optional) search query that searches over the hostname, queue name, os, architecture, and version properties.
active - Boolean Whether to show only executors that have sent a heartbeat in the last fifteen minutes.
first - Int Returns the first n executors. Default = 50
after - String Opaque pagination cursor.

Example

Query
query executors(
  $query: String,
  $active: Boolean,
  $first: Int,
  $after: String
) {
  executors(
    query: $query,
    active: $active,
    first: $first,
    after: $after
  ) {
    nodes {
      ...ExecutorFragment
    }
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "query": "xyz789",
  "active": false,
  "first": 50,
  "after": "xyz789"
}
Response
{
  "data": {
    "executors": {
      "nodes": [Executor],
      "totalCount": 987,
      "pageInfo": PageInfo
    }
  }
}

extensionRegistry

Description

The extension registry.

Response

Returns an ExtensionRegistry!

Example

Query
query extensionRegistry {
  extensionRegistry {
    extensions {
      ...RegistryExtensionConnectionFragment
    }
  }
}
Response
{
  "data": {
    "extensionRegistry": {
      "extensions": RegistryExtensionConnection
    }
  }
}

externalServiceNamespaces

Description

Lists all namespaces for a given external service connection. A namespace is an entity on the code host that repositories are assignable to.

Arguments
Name Description
kind - ExternalServiceKind! The kind of the external service.
token - String! The secret token value that is used to authenticate.
url - String! The url of the external service.

Example

Query
query externalServiceNamespaces(
  $kind: ExternalServiceKind!,
  $token: String!,
  $url: String!
) {
  externalServiceNamespaces(
    kind: $kind,
    token: $token,
    url: $url
  ) {
    nodes {
      ...ExternalServiceNamespaceFragment
    }
    totalCount
  }
}
Variables
{
  "kind": "AWSCODECOMMIT",
  "token": "abc123",
  "url": "abc123"
}
Response
{
  "data": {
    "externalServiceNamespaces": {
      "nodes": [ExternalServiceNamespace],
      "totalCount": 987
    }
  }
}

externalServices

Description

Lists external services under given namespace. If no namespace is given, it returns all external services.

Response

Returns an ExternalServiceConnection!

Arguments
Name Description
first - Int Returns the first n external services from the list.
after - String Opaque pagination cursor.

Example

Query
query externalServices(
  $first: Int,
  $after: String
) {
  externalServices(
    first: $first,
    after: $after
  ) {
    nodes {
      ...ExternalServiceFragment
    }
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{"first": 123, "after": "abc123"}
Response
{
  "data": {
    "externalServices": {
      "nodes": [ExternalService],
      "totalCount": 123,
      "pageInfo": PageInfo
    }
  }
}

featureFlag

Description

Retrieve a feature flag

Response

Returns a FeatureFlag!

Arguments
Name Description
name - String!

Example

Query
query featureFlag($name: String!) {
  featureFlag(name: $name) {
    ... on FeatureFlagBoolean {
      ...FeatureFlagBooleanFragment
    }
    ... on FeatureFlagRollout {
      ...FeatureFlagRolloutFragment
    }
  }
}
Variables
{"name": "abc123"}
Response
{"data": {"featureFlag": FeatureFlagBoolean}}

featureFlags

Description

Retrieve the list of defined feature flags

Response

Returns [FeatureFlag!]!

Example

Query
query featureFlags {
  featureFlags {
    ... on FeatureFlagBoolean {
      ...FeatureFlagBooleanFragment
    }
    ... on FeatureFlagRollout {
      ...FeatureFlagRolloutFragment
    }
  }
}
Response
{"data": {"featureFlags": [FeatureFlagBoolean]}}

highlightCode

Description

EXPERIMENTAL: Syntax highlights a code string.

Response

Returns a String!

Arguments
Name Description
code - String!
fuzzyLanguage - String!
disableTimeout - Boolean!

Example

Query
query highlightCode(
  $code: String!,
  $fuzzyLanguage: String!,
  $disableTimeout: Boolean!
) {
  highlightCode(
    code: $code,
    fuzzyLanguage: $fuzzyLanguage,
    disableTimeout: $disableTimeout
  )
}
Variables
{
  "code": "xyz789",
  "fuzzyLanguage": "xyz789",
  "disableTimeout": true
}
Response
{"data": {"highlightCode": "xyz789"}}

invitationByToken

Description

(experimental) Get invitation based on the JWT in the invitation URL

Response

Returns an OrganizationInvitation!

Arguments
Name Description
token - String! The token that uniquely identifies the invitation

Example

Query
query invitationByToken($token: String!) {
  invitationByToken(token: $token) {
    id
    organization {
      ...OrgFragment
    }
    sender {
      ...UserFragment
    }
    recipient {
      ...UserFragment
    }
    recipientEmail
    createdAt
    notifiedAt
    respondedAt
    responseType
    respondURL
    revokedAt
    expiresAt
    isVerifiedEmail
  }
}
Variables
{"token": "xyz789"}
Response
{
  "data": {
    "invitationByToken": {
      "id": "4",
      "organization": Org,
      "sender": User,
      "recipient": User,
      "recipientEmail": "xyz789",
      "createdAt": "2007-12-03T10:15:30Z",
      "notifiedAt": "2007-12-03T10:15:30Z",
      "respondedAt": "2007-12-03T10:15:30Z",
      "responseType": "ACCEPT",
      "respondURL": "xyz789",
      "revokedAt": "2007-12-03T10:15:30Z",
      "expiresAt": "2007-12-03T10:15:30Z",
      "isVerifiedEmail": false
    }
  }
}

namespace

Description

Look up a namespace by ID.

Response

Returns a Namespace

Arguments
Name Description
id - ID!

Example

Query
query namespace($id: ID!) {
  namespace(id: $id) {
    id
    namespaceName
    url
  }
}
Variables
{"id": "4"}
Response
{
  "data": {
    "namespace": {
      "id": "4",
      "namespaceName": "abc123",
      "url": "abc123"
    }
  }
}

namespaceByName

Description

Look up a namespace by name, which is a username or organization name.

Response

Returns a Namespace

Arguments
Name Description
name - String! The name of the namespace.

Example

Query
query namespaceByName($name: String!) {
  namespaceByName(name: $name) {
    id
    namespaceName
    url
  }
}
Variables
{"name": "abc123"}
Response
{
  "data": {
    "namespaceByName": {
      "id": 4,
      "namespaceName": "abc123",
      "url": "xyz789"
    }
  }
}

node

Description

Looks up a node by ID.

Response

Returns a Node

Arguments
Name Description
id - ID!

Example

Query
query node($id: ID!) {
  node(id: $id) {
    id
  }
}
Variables
{"id": "4"}
Response
{"data": {"node": {"id": "4"}}}

orgMembersSummary

Description

Get started organization summary

Response

Returns an OrgMembersSummary!

Arguments
Name Description
organization - ID! The organization ID

Example

Query
query orgMembersSummary($organization: ID!) {
  orgMembersSummary(organization: $organization) {
    id
    membersCount
    invitesCount
  }
}
Variables
{"organization": "4"}
Response
{
  "data": {
    "orgMembersSummary": {
      "id": "4",
      "membersCount": 123,
      "invitesCount": 987
    }
  }
}

organization

Description

Looks up an organization by name.

Response

Returns an Org

Arguments
Name Description
name - String!

Example

Query
query organization($name: String!) {
  organization(name: $name) {
    executorSecrets {
      ...ExecutorSecretConnectionFragment
    }
    id
    name
    displayName
    createdAt
    members {
      ...NewUsersConnectionFragment
    }
    latestSettings {
      ...SettingsFragment
    }
    settingsCascade {
      ...SettingsCascadeFragment
    }
    configurationCascade {
      ...ConfigurationCascadeFragment
    }
    viewerPendingInvitation {
      ...OrganizationInvitationFragment
    }
    viewerCanAdminister
    viewerIsMember
    url
    settingsURL
    namespaceName
  }
}
Variables
{"name": "abc123"}
Response
{
  "data": {
    "organization": {
      "executorSecrets": ExecutorSecretConnection,
      "id": 4,
      "name": "xyz789",
      "displayName": "abc123",
      "createdAt": "2007-12-03T10:15:30Z",
      "members": NewUsersConnection,
      "latestSettings": Settings,
      "settingsCascade": SettingsCascade,
      "configurationCascade": ConfigurationCascade,
      "viewerPendingInvitation": OrganizationInvitation,
      "viewerCanAdminister": false,
      "viewerIsMember": true,
      "url": "abc123",
      "settingsURL": "xyz789",
      "namespaceName": "xyz789"
    }
  }
}

organizationFeatureFlagOverrides

Description

Retrieve all organization feature flag overrides for the current user

Response

Returns [FeatureFlagOverride!]!

Example

Query
query organizationFeatureFlagOverrides {
  organizationFeatureFlagOverrides {
    id
    namespace {
      ...NamespaceFragment
    }
    targetFlag {
      ... on FeatureFlagBoolean {
        ...FeatureFlagBooleanFragment
      }
      ... on FeatureFlagRollout {
        ...FeatureFlagRolloutFragment
      }
    }
    value
  }
}
Response
{
  "data": {
    "organizationFeatureFlagOverrides": [
      {
        "id": "4",
        "namespace": Namespace,
        "targetFlag": FeatureFlagBoolean,
        "value": true
      }
    ]
  }
}

organizationFeatureFlagValue

Description

Retrieve the value of a feature flag for the organization

Response

Returns a Boolean!

Arguments
Name Description
orgID - ID!
flagName - String!

Example

Query
query organizationFeatureFlagValue(
  $orgID: ID!,
  $flagName: String!
) {
  organizationFeatureFlagValue(
    orgID: $orgID,
    flagName: $flagName
  )
}
Variables
{
  "orgID": "4",
  "flagName": "xyz789"
}
Response
{"data": {"organizationFeatureFlagValue": true}}

organizations

Description

List all organizations.

Response

Returns an OrgConnection!

Arguments
Name Description
first - Int Returns the first n organizations from the list.
query - String Return organizations whose names or display names match the query.

Example

Query
query organizations(
  $first: Int,
  $query: String
) {
  organizations(
    first: $first,
    query: $query
  ) {
    nodes {
      ...OrgFragment
    }
    totalCount
  }
}
Variables
{"first": 123, "query": "xyz789"}
Response
{
  "data": {
    "organizations": {"nodes": [Org], "totalCount": 123}
  }
}

outOfBandMigrations

Description

Retrieve all registered out-of-band migrations.

Response

Returns [OutOfBandMigration!]!

Example

Query
query outOfBandMigrations {
  outOfBandMigrations {
    id
    team
    component
    description
    introduced
    deprecated
    progress
    created
    lastUpdated
    nonDestructive
    applyReverse
    errors {
      ...OutOfBandMigrationErrorFragment
    }
  }
}
Response
{
  "data": {
    "outOfBandMigrations": [
      {
        "id": 4,
        "team": "xyz789",
        "component": "abc123",
        "description": "xyz789",
        "introduced": "abc123",
        "deprecated": "abc123",
        "progress": 123.45,
        "created": "2007-12-03T10:15:30Z",
        "lastUpdated": "2007-12-03T10:15:30Z",
        "nonDestructive": false,
        "applyReverse": true,
        "errors": [OutOfBandMigrationError]
      }
    ]
  }
}

outboundRequests

Description

Get a log of the latest outbound external requests. Only available to site admins.

Response

Returns an OutboundRequestConnection!

Arguments
Name Description
first - Int Returns the first n log items. If omitted then it returns all of them.
after - String Opaque pagination cursor.

Example

Query
query outboundRequests(
  $first: Int,
  $after: String
) {
  outboundRequests(
    first: $first,
    after: $after
  ) {
    nodes {
      ...OutboundRequestFragment
    }
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{"first": 123, "after": "abc123"}
Response
{
  "data": {
    "outboundRequests": {
      "nodes": [OutboundRequest],
      "totalCount": 987,
      "pageInfo": PageInfo
    }
  }
}

packageRepoReferences

Description

Query package repo references.

Response

Returns a PackageRepoReferenceConnection!

Arguments
Name Description
scheme - PackageRepoReferenceKind The exact scheme value to filter by.
name - String If supplied, only package repo references that match the given terms by their name will be returned. TODO: fuzzy vs exact?
first - Int Returns the first n external services from the list.
after - String Opaque pagination cursor.

Example

Query
query packageRepoReferences(
  $scheme: PackageRepoReferenceKind,
  $name: String,
  $first: Int,
  $after: String
) {
  packageRepoReferences(
    scheme: $scheme,
    name: $name,
    first: $first,
    after: $after
  ) {
    nodes {
      ...PackageRepoReferenceFragment
    }
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "scheme": "GOMODULES",
  "name": "abc123",
  "first": 123,
  "after": "abc123"
}
Response
{
  "data": {
    "packageRepoReferences": {
      "nodes": [PackageRepoReference],
      "totalCount": 123,
      "pageInfo": PageInfo
    }
  }
}

parseSearchQuery

Description

(experimental) Return the parse tree of a search query.

Response

Returns a String!

Arguments
Name Description
query - String The search query (such as "repo:myrepo foo"). Default = ""
patternType - SearchPatternType The parser to use for this query. Default = standard
outputPhase - SearchQueryOutputPhase The output corresponding to a phase in the parser pipeline. Default = PARSE_TREE
outputFormat - SearchQueryOutputFormat The parser output format. Default = JSON
outputVerbosity - SearchQueryOutputVerbosity The level of output format verbosity. Default = BASIC

Example

Query
query parseSearchQuery(
  $query: String,
  $patternType: SearchPatternType,
  $outputPhase: SearchQueryOutputPhase,
  $outputFormat: SearchQueryOutputFormat,
  $outputVerbosity: SearchQueryOutputVerbosity
) {
  parseSearchQuery(
    query: $query,
    patternType: $patternType,
    outputPhase: $outputPhase,
    outputFormat: $outputFormat,
    outputVerbosity: $outputVerbosity
  )
}
Variables
{
  "query": "",
  "patternType": "standard",
  "outputPhase": "PARSE_TREE",
  "outputFormat": "JSON",
  "outputVerbosity": "BASIC"
}
Response
{"data": {"parseSearchQuery": "abc123"}}

pendingInvitations

Description

Get pending invitations for the specific organization

Response

Returns [OrganizationInvitation!]!

Arguments
Name Description
organization - ID! The organization ID

Example

Query
query pendingInvitations($organization: ID!) {
  pendingInvitations(organization: $organization) {
    id
    organization {
      ...OrgFragment
    }
    sender {
      ...UserFragment
    }
    recipient {
      ...UserFragment
    }
    recipientEmail
    createdAt
    notifiedAt
    respondedAt
    responseType
    respondURL
    revokedAt
    expiresAt
    isVerifiedEmail
  }
}
Variables
{"organization": "4"}
Response
{
  "data": {
    "pendingInvitations": [
      {
        "id": "4",
        "organization": Org,
        "sender": User,
        "recipient": User,
        "recipientEmail": "xyz789",
        "createdAt": "2007-12-03T10:15:30Z",
        "notifiedAt": "2007-12-03T10:15:30Z",
        "respondedAt": "2007-12-03T10:15:30Z",
        "responseType": "ACCEPT",
        "respondURL": "abc123",
        "revokedAt": "2007-12-03T10:15:30Z",
        "expiresAt": "2007-12-03T10:15:30Z",
        "isVerifiedEmail": false
      }
    ]
  }
}

phabricatorRepo

Description

Looks up a Phabricator repository by name.

Response

Returns a PhabricatorRepo

Arguments
Name Description
name - String The name, for example "github.com/gorilla/mux".
uri - String An alias for name. DEPRECATED: use name instead.

Example

Query
query phabricatorRepo(
  $name: String,
  $uri: String
) {
  phabricatorRepo(
    name: $name,
    uri: $uri
  ) {
    name
    uri
    callsign
    url
  }
}
Variables
{
  "name": "abc123",
  "uri": "abc123"
}
Response
{
  "data": {
    "phabricatorRepo": {
      "name": "xyz789",
      "uri": "abc123",
      "callsign": "abc123",
      "url": "xyz789"
    }
  }
}

renderMarkdown

Description

Renders Markdown to HTML. The returned HTML is already sanitized and escaped and thus is always safe to render.

Response

Returns a String!

Arguments
Name Description
markdown - String!
options - MarkdownOptions

Example

Query
query renderMarkdown(
  $markdown: String!,
  $options: MarkdownOptions
) {
  renderMarkdown(
    markdown: $markdown,
    options: $options
  )
}
Variables
{
  "markdown": "xyz789",
  "options": MarkdownOptions
}
Response
{"data": {"renderMarkdown": "abc123"}}

repositories

Description

List all repositories.

Response

Returns a NewRepositoryConnection!

Arguments
Name Description
first - Int Returns the first n repositories from the list.
last - Int Returns the last n repositories from the list.
query - String Return repositories whose names match the query.
after - String An opaque cursor that is used for pagination.
before - String An opaque cursor that is used for pagination.
names - [String!] Return repositories whose names are in the list.
cloned - Boolean Include cloned repositories. Default = true
cloneStatus - CloneStatus Include only repositories of the given clone status.
notCloned - Boolean Include repositories that are not yet cloned and for which cloning is not in progress. Default = true
indexed - Boolean Include repositories that have a text search index. Default = true
notIndexed - Boolean Include repositories that do not have a text search index. Default = true
failedFetch - Boolean Include only repositories that have encountered errors when cloning or fetching. Default = false
corrupted - Boolean Include repositories that are corrupt. Default = false
externalService - ID Return repositories that are associated with the given external service.
orderBy - RepositoryOrderBy Sort field. Default = REPOSITORY_NAME
descending - Boolean Sort direction. Default = false

Example

Query
query repositories(
  $first: Int,
  $last: Int,
  $query: String,
  $after: String,
  $before: String,
  $names: [String!],
  $cloned: Boolean,
  $cloneStatus: CloneStatus,
  $notCloned: Boolean,
  $indexed: Boolean,
  $notIndexed: Boolean,
  $failedFetch: Boolean,
  $corrupted: Boolean,
  $externalService: ID,
  $orderBy: RepositoryOrderBy,
  $descending: Boolean
) {
  repositories(
    first: $first,
    last: $last,
    query: $query,
    after: $after,
    before: $before,
    names: $names,
    cloned: $cloned,
    cloneStatus: $cloneStatus,
    notCloned: $notCloned,
    indexed: $indexed,
    notIndexed: $notIndexed,
    failedFetch: $failedFetch,
    corrupted: $corrupted,
    externalService: $externalService,
    orderBy: $orderBy,
    descending: $descending
  ) {
    nodes {
      ...RepositoryFragment
    }
    totalCount
    pageInfo {
      ...ConnectionPageInfoFragment
    }
  }
}
Variables
{
  "first": 987,
  "last": 987,
  "query": "xyz789",
  "after": "xyz789",
  "before": "xyz789",
  "names": ["abc123"],
  "cloned": true,
  "cloneStatus": "NOT_CLONED",
  "notCloned": true,
  "indexed": true,
  "notIndexed": true,
  "failedFetch": false,
  "corrupted": false,
  "externalService": 4,
  "orderBy": "REPOSITORY_NAME",
  "descending": false
}
Response
{
  "data": {
    "repositories": {
      "nodes": [Repository],
      "totalCount": 123,
      "pageInfo": ConnectionPageInfo
    }
  }
}

repository

Description

Looks up a repository by either name or cloneURL.

Response

Returns a Repository

Arguments
Name Description
name - String Query the repository by name, for example "github.com/gorilla/mux".
cloneURL - String Query the repository by a Git clone URL (format documented here: https://git-scm.com/docs/git-clone_git_urls_a_id_urls_a) by checking for a code host configuration that matches the clone URL. Will not actually check the code host to see if the repository actually exists.
uri - String An alias for name. DEPRECATED: use name instead.

Example

Query
query repository(
  $name: String,
  $cloneURL: String,
  $uri: String
) {
  repository(
    name: $name,
    cloneURL: $cloneURL,
    uri: $uri
  ) {
    id
    name
    uri
    description
    language
    createdAt
    updatedAt
    commit {
      ...GitCommitFragment
    }
    firstEverCommit {
      ...GitCommitFragment
    }
    mirrorInfo {
      ...MirrorRepositoryInfoFragment
    }
    externalRepository {
      ...ExternalRepositoryFragment
    }
    isFork
    isArchived
    isPrivate
    externalServices {
      ...ExternalServiceConnectionFragment
    }
    cloneInProgress
    textSearchIndex {
      ...RepositoryTextSearchIndexFragment
    }
    url
    externalURLs {
      ...ExternalLinkFragment
    }
    defaultBranch {
      ...GitRefFragment
    }
    gitRefs {
      ...GitRefConnectionFragment
    }
    branches {
      ...GitRefConnectionFragment
    }
    tags {
      ...GitRefConnectionFragment
    }
    comparison {
      ...RepositoryComparisonFragment
    }
    contributors {
      ...RepositoryContributorConnectionFragment
    }
    viewerCanAdminister
    label {
      ...MarkdownFragment
    }
    detail {
      ...MarkdownFragment
    }
    matches {
      ...SearchResultMatchFragment
    }
    codeIntelligenceCommitGraph {
      ...CodeIntelligenceCommitGraphFragment
    }
    stars
    keyValuePairs {
      ...KeyValuePairFragment
    }
    diskSizeBytes
  }
}
Variables
{
  "name": "abc123",
  "cloneURL": "abc123",
  "uri": "abc123"
}
Response
{
  "data": {
    "repository": {
      "id": "4",
      "name": "xyz789",
      "uri": "abc123",
      "description": "abc123",
      "language": "abc123",
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z",
      "commit": GitCommit,
      "firstEverCommit": GitCommit,
      "mirrorInfo": MirrorRepositoryInfo,
      "externalRepository": ExternalRepository,
      "isFork": true,
      "isArchived": true,
      "isPrivate": true,
      "externalServices": ExternalServiceConnection,
      "cloneInProgress": true,
      "textSearchIndex": RepositoryTextSearchIndex,
      "url": "abc123",
      "externalURLs": [ExternalLink],
      "defaultBranch": GitRef,
      "gitRefs": GitRefConnection,
      "branches": GitRefConnection,
      "tags": GitRefConnection,
      "comparison": RepositoryComparison,
      "contributors": RepositoryContributorConnection,
      "viewerCanAdminister": true,
      "label": Markdown,
      "detail": Markdown,
      "matches": [SearchResultMatch],
      "codeIntelligenceCommitGraph": CodeIntelligenceCommitGraph,
      "stars": 987,
      "keyValuePairs": [KeyValuePair],
      "diskSizeBytes": {}
    }
  }
}

repositoryRedirect

Description

Looks up a repository by either name or cloneURL or hashedName. When the repository does not exist on the server and "disablePublicRepoRedirects" is "false" in the site configuration, it returns a Redirect to an external Sourcegraph URL that may have this repository instead. Otherwise, this query returns null.

Response

Returns a RepositoryRedirect

Arguments
Name Description
name - String Query the repository by name, for example "github.com/gorilla/mux".
cloneURL - String Query the repository by a Git clone URL (format documented here: https://git-scm.com/docs/git-clone_git_urls_a_id_urls_a) by checking for a code host configuration that matches the clone URL. Will not actually check the code host to see if the repository actually exists.
hashedName - String Query the repository by hashed name. Hashed name is a SHA256 checksum of the absolute repo name in lower case, for example "github.com/sourcegraph/sourcegraph" -> "a6c905ceb7dec9a565945ceded8c7fa4154250df8b928fb40673b535d9a24c2f"

Example

Query
query repositoryRedirect(
  $name: String,
  $cloneURL: String,
  $hashedName: String
) {
  repositoryRedirect(
    name: $name,
    cloneURL: $cloneURL,
    hashedName: $hashedName
  ) {
    ... on Repository {
      ...RepositoryFragment
    }
    ... on Redirect {
      ...RedirectFragment
    }
  }
}
Variables
{
  "name": "abc123",
  "cloneURL": "abc123",
  "hashedName": "abc123"
}
Response
{"data": {"repositoryRedirect": Repository}}

repositoryStats

Description

FOR INTERNAL USE ONLY: Query repository statistics for the site.

Response

Returns a RepositoryStats!

Example

Query
query repositoryStats {
  repositoryStats {
    gitDirBytes
    indexedLinesCount
    total
    cloned
    cloning
    notCloned
    failedFetch
    indexed
    corrupted
  }
}
Response
{
  "data": {
    "repositoryStats": {
      "gitDirBytes": {},
      "indexedLinesCount": {},
      "total": 987,
      "cloned": 987,
      "cloning": 987,
      "notCloned": 987,
      "failedFetch": 123,
      "indexed": 987,
      "corrupted": 123
    }
  }
}

root

this will be removed.
Description

The root of the query.

Response

Returns a Query!

Example

Query
query root {
  root {
    root {
      ...QueryFragment
    }
    node {
      ...NodeFragment
    }
    repository {
      ...RepositoryFragment
    }
    repositoryRedirect {
      ... on Repository {
        ...RepositoryFragment
      }
      ... on Redirect {
        ...RedirectFragment
      }
    }
    externalServices {
      ...ExternalServiceConnectionFragment
    }
    externalServiceNamespaces {
      ...ExternalServiceNamespaceConnectionFragment
    }
    repositories {
      ...NewRepositoryConnectionFragment
    }
    packageRepoReferences {
      ...PackageRepoReferenceConnectionFragment
    }
    phabricatorRepo {
      ...PhabricatorRepoFragment
    }
    currentUser {
      ...UserFragment
    }
    user {
      ...UserFragment
    }
    users {
      ...UserConnectionFragment
    }
    organization {
      ...OrgFragment
    }
    organizations {
      ...OrgConnectionFragment
    }
    renderMarkdown
    highlightCode
    settingsSubject {
      ...SettingsSubjectFragment
    }
    viewerSettings {
      ...SettingsCascadeFragment
    }
    viewerConfiguration {
      ...ConfigurationCascadeFragment
    }
    clientConfiguration {
      ...ClientConfigurationDetailsFragment
    }
    search {
      ...SearchFragment
    }
    savedSearches {
      ...SavedSearchesConnectionFragment
    }
    parseSearchQuery
    site {
      ...SiteFragment
    }
    surveyResponses {
      ...SurveyResponseConnectionFragment
    }
    extensionRegistry {
      ...ExtensionRegistryFragment
    }
    statusMessages {
      ... on GitUpdatesDisabled {
        ...GitUpdatesDisabledFragment
      }
      ... on CloningProgress {
        ...CloningProgressFragment
      }
      ... on ExternalServiceSyncError {
        ...ExternalServiceSyncErrorFragment
      }
      ... on SyncError {
        ...SyncErrorFragment
      }
      ... on IndexingProgress {
        ...IndexingProgressFragment
      }
    }
    repositoryStats {
      ...RepositoryStatsFragment
    }
    namespace {
      ...NamespaceFragment
    }
    namespaceByName {
      ...NamespaceFragment
    }
    codeHostSyncDue
    outOfBandMigrations {
      ...OutOfBandMigrationFragment
    }
    featureFlags {
      ... on FeatureFlagBoolean {
        ...FeatureFlagBooleanFragment
      }
      ... on FeatureFlagRollout {
        ...FeatureFlagRolloutFragment
      }
    }
    featureFlag {
      ... on FeatureFlagBoolean {
        ...FeatureFlagBooleanFragment
      }
      ... on FeatureFlagRollout {
        ...FeatureFlagRolloutFragment
      }
    }
    evaluateFeatureFlag
    evaluatedFeatureFlags {
      ...EvaluatedFeatureFlagFragment
    }
    organizationFeatureFlagValue
    organizationFeatureFlagOverrides {
      ...FeatureFlagOverrideFragment
    }
    temporarySettings {
      ...TemporarySettingsFragment
    }
    webhookLogs {
      ...WebhookLogConnectionFragment
    }
    outboundRequests {
      ...OutboundRequestConnectionFragment
    }
    backgroundJobs {
      ...BackgroundJobConnectionFragment
    }
    invitationByToken {
      ...OrganizationInvitationFragment
    }
    pendingInvitations {
      ...OrganizationInvitationFragment
    }
    autocompleteMembersSearch {
      ...AutocompleteMemberSearchItemFragment
    }
    orgMembersSummary {
      ...OrgMembersSummaryFragment
    }
    webhooks {
      ...WebhookConnectionFragment
    }
    slowRequests {
      ...SlowRequestConnectionFragment
    }
    executorSecrets {
      ...ExecutorSecretConnectionFragment
    }
    executors {
      ...ExecutorConnectionFragment
    }
    areExecutorsConfigured
    team {
      ...TeamFragment
    }
    teams {
      ...TeamConnectionFragment
    }
  }
}
Response
{
  "data": {
    "root": {
      "root": Query,
      "node": Node,
      "repository": Repository,
      "repositoryRedirect": Repository,
      "externalServices": ExternalServiceConnection,
      "externalServiceNamespaces": ExternalServiceNamespaceConnection,
      "repositories": NewRepositoryConnection,
      "packageRepoReferences": PackageRepoReferenceConnection,
      "phabricatorRepo": PhabricatorRepo,
      "currentUser": User,
      "user": User,
      "users": UserConnection,
      "organization": Org,
      "organizations": OrgConnection,
      "renderMarkdown": "xyz789",
      "highlightCode": "xyz789",
      "settingsSubject": SettingsSubject,
      "viewerSettings": SettingsCascade,
      "viewerConfiguration": ConfigurationCascade,
      "clientConfiguration": ClientConfigurationDetails,
      "search": Search,
      "savedSearches": SavedSearchesConnection,
      "parseSearchQuery": "xyz789",
      "site": Site,
      "surveyResponses": SurveyResponseConnection,
      "extensionRegistry": ExtensionRegistry,
      "statusMessages": [GitUpdatesDisabled],
      "repositoryStats": RepositoryStats,
      "namespace": Namespace,
      "namespaceByName": Namespace,
      "codeHostSyncDue": true,
      "outOfBandMigrations": [OutOfBandMigration],
      "featureFlags": [FeatureFlagBoolean],
      "featureFlag": FeatureFlagBoolean,
      "evaluateFeatureFlag": true,
      "evaluatedFeatureFlags": [EvaluatedFeatureFlag],
      "organizationFeatureFlagValue": true,
      "organizationFeatureFlagOverrides": [
        FeatureFlagOverride
      ],
      "temporarySettings": TemporarySettings,
      "webhookLogs": WebhookLogConnection,
      "outboundRequests": OutboundRequestConnection,
      "backgroundJobs": BackgroundJobConnection,
      "invitationByToken": OrganizationInvitation,
      "pendingInvitations": [OrganizationInvitation],
      "autocompleteMembersSearch": [
        AutocompleteMemberSearchItem
      ],
      "orgMembersSummary": OrgMembersSummary,
      "webhooks": WebhookConnection,
      "slowRequests": SlowRequestConnection,
      "executorSecrets": ExecutorSecretConnection,
      "executors": ExecutorConnection,
      "areExecutorsConfigured": false,
      "team": Team,
      "teams": TeamConnection
    }
  }
}

savedSearches

Description

List of saved searches based on namespace

Response

Returns a SavedSearchesConnection!

Arguments
Name Description
namespace - ID! The namespace to list the saved searches for.
first - Int The limit argument for forward pagination.
last - Int The limit argument for backward pagination.
after - String The cursor argument for forward pagination.
before - String The cursor argument for backward pagination.

Example

Query
query savedSearches(
  $namespace: ID!,
  $first: Int,
  $last: Int,
  $after: String,
  $before: String
) {
  savedSearches(
    namespace: $namespace,
    first: $first,
    last: $last,
    after: $after,
    before: $before
  ) {
    nodes {
      ...SavedSearchFragment
    }
    totalCount
    pageInfo {
      ...ConnectionPageInfoFragment
    }
  }
}
Variables
{
  "namespace": 4,
  "first": 123,
  "last": 123,
  "after": "abc123",
  "before": "xyz789"
}
Response
{
  "data": {
    "savedSearches": {
      "nodes": [SavedSearch],
      "totalCount": 987,
      "pageInfo": ConnectionPageInfo
    }
  }
}

settingsSubject

Description

Looks up an instance of a type that implements SettingsSubject (i.e., something that has settings). This can be a site (which has global settings), an organization, or a user.

Response

Returns a SettingsSubject

Arguments
Name Description
id - ID!

Example

Query
query settingsSubject($id: ID!) {
  settingsSubject(id: $id) {
    id
    latestSettings {
      ...SettingsFragment
    }
    settingsURL
    viewerCanAdminister
    settingsCascade {
      ...SettingsCascadeFragment
    }
    configurationCascade {
      ...ConfigurationCascadeFragment
    }
  }
}
Variables
{"id": "4"}
Response
{
  "data": {
    "settingsSubject": {
      "id": 4,
      "latestSettings": Settings,
      "settingsURL": "abc123",
      "viewerCanAdminister": false,
      "settingsCascade": SettingsCascade,
      "configurationCascade": ConfigurationCascade
    }
  }
}

site

Description

The current site.

Response

Returns a Site!

Example

Query
query site {
  site {
    id
    siteID
    configuration {
      ...SiteConfigurationFragment
    }
    latestSettings {
      ...SettingsFragment
    }
    settingsCascade {
      ...SettingsCascadeFragment
    }
    configurationCascade {
      ...ConfigurationCascadeFragment
    }
    settingsURL
    canReloadSite
    viewerCanAdminister
    accessTokens {
      ...AccessTokenConnectionFragment
    }
    authProviders {
      ...AuthProviderConnectionFragment
    }
    externalAccounts {
      ...ExternalAccountConnectionFragment
    }
    buildVersion
    productVersion
    updateCheck {
      ...UpdateCheckFragment
    }
    needsRepositoryConfiguration
    externalServicesFromFile
    allowEditExternalServicesWithFile
    freeUsersExceeded
    alerts {
      ...AlertFragment
    }
    hasCodeIntelligence
    sendsEmailVerificationEmails
    productSubscription {
      ...ProductSubscriptionStatusFragment
    }
    usageStatistics {
      ...SiteUsageStatisticsFragment
    }
    analytics {
      ...AnalyticsFragment
    }
    users {
      ...SiteUsersFragment
    }
    monitoringStatistics {
      ...MonitoringStatisticsFragment
    }
    allowSiteSettingsEdits
    enableLegacyExtensions
    upgradeReadiness {
      ...UpgradeReadinessFragment
    }
  }
}
Response
{
  "data": {
    "site": {
      "id": 4,
      "siteID": "abc123",
      "configuration": SiteConfiguration,
      "latestSettings": Settings,
      "settingsCascade": SettingsCascade,
      "configurationCascade": ConfigurationCascade,
      "settingsURL": "abc123",
      "canReloadSite": true,
      "viewerCanAdminister": false,
      "accessTokens": AccessTokenConnection,
      "authProviders": AuthProviderConnection,
      "externalAccounts": ExternalAccountConnection,
      "buildVersion": "xyz789",
      "productVersion": "abc123",
      "updateCheck": UpdateCheck,
      "needsRepositoryConfiguration": true,
      "externalServicesFromFile": false,
      "allowEditExternalServicesWithFile": true,
      "freeUsersExceeded": true,
      "alerts": [Alert],
      "hasCodeIntelligence": false,
      "sendsEmailVerificationEmails": true,
      "productSubscription": ProductSubscriptionStatus,
      "usageStatistics": SiteUsageStatistics,
      "analytics": Analytics,
      "users": SiteUsers,
      "monitoringStatistics": MonitoringStatistics,
      "allowSiteSettingsEdits": true,
      "enableLegacyExtensions": false,
      "upgradeReadiness": UpgradeReadiness
    }
  }
}

slowRequests

Description

List slow GraphQL requests that were recently captured (requires site-admin permissions).

Response

Returns a SlowRequestConnection!

Arguments
Name Description
after - String Opaque pagnination cursor.

Example

Query
query slowRequests($after: String) {
  slowRequests(after: $after) {
    nodes {
      ...SlowRequestFragment
    }
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{"after": "abc123"}
Response
{
  "data": {
    "slowRequests": {
      "nodes": [SlowRequest],
      "totalCount": 123,
      "pageInfo": PageInfo
    }
  }
}

statusMessages

Description

FOR INTERNAL USE ONLY: Lists all status messages

Response

Returns [StatusMessage!]!

Example

Query
query statusMessages {
  statusMessages {
    ... on GitUpdatesDisabled {
      ...GitUpdatesDisabledFragment
    }
    ... on CloningProgress {
      ...CloningProgressFragment
    }
    ... on ExternalServiceSyncError {
      ...ExternalServiceSyncErrorFragment
    }
    ... on SyncError {
      ...SyncErrorFragment
    }
    ... on IndexingProgress {
      ...IndexingProgressFragment
    }
  }
}
Response
{"data": {"statusMessages": [GitUpdatesDisabled]}}

surveyResponses

Description

Retrieve responses to surveys.

Response

Returns a SurveyResponseConnection!

Arguments
Name Description
first - Int Returns the first n survey responses from the list.

Example

Query
query surveyResponses($first: Int) {
  surveyResponses(first: $first) {
    nodes {
      ...SurveyResponseFragment
    }
    totalCount
    last30DaysCount
    averageScore
    netPromoterScore
  }
}
Variables
{"first": 123}
Response
{
  "data": {
    "surveyResponses": {
      "nodes": [SurveyResponse],
      "totalCount": 123,
      "last30DaysCount": 987,
      "averageScore": 987.65,
      "netPromoterScore": 123
    }
  }
}

team

Description

Get a single team by name. Returns null if not found.

Response

Returns a Team

Arguments
Name Description
name - String!

Example

Query
query team($name: String!) {
  team(name: $name) {
    id
    name
    url
    displayName
    readonly
    members {
      ...TeamMemberConnectionFragment
    }
    parentTeam {
      ...TeamFragment
    }
    childTeams {
      ...TeamConnectionFragment
    }
    viewerCanAdminister
  }
}
Variables
{"name": "xyz789"}
Response
{
  "data": {
    "team": {
      "id": "4",
      "name": "abc123",
      "url": "xyz789",
      "displayName": "abc123",
      "readonly": false,
      "members": TeamMemberConnection,
      "parentTeam": Team,
      "childTeams": TeamConnection,
      "viewerCanAdminister": false
    }
  }
}

teams

Description

Get the global list of all root teams. (Those without a parent team).

Response

Returns a TeamConnection!

Arguments
Name Description
first - Int Returns the first n teams from the list.
after - String Opaque pagination cursor.
search - String Search can be used to do a text-search over the team names.

Example

Query
query teams(
  $first: Int,
  $after: String,
  $search: String
) {
  teams(
    first: $first,
    after: $after,
    search: $search
  ) {
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
    nodes {
      ...TeamFragment
    }
  }
}
Variables
{
  "first": 123,
  "after": "abc123",
  "search": "abc123"
}
Response
{
  "data": {
    "teams": {
      "totalCount": 123,
      "pageInfo": PageInfo,
      "nodes": [Team]
    }
  }
}

temporarySettings

Description

Retrieves the temporary settings for the current user.

Response

Returns a TemporarySettings!

Example

Query
query temporarySettings {
  temporarySettings {
    contents
  }
}
Response
{
  "data": {
    "temporarySettings": {
      "contents": "xyz789"
    }
  }
}

user

Description

Looks up a user by username or email address.

Response

Returns a User

Arguments
Name Description
username - String Query the user by username.
email - String Query the user by verified email address.

Example

Query
query user(
  $username: String,
  $email: String
) {
  user(
    username: $username,
    email: $email
  ) {
    executorSecrets {
      ...ExecutorSecretConnectionFragment
    }
    id
    username
    email
    displayName
    avatarURL
    url
    settingsURL
    createdAt
    updatedAt
    siteAdmin
    builtinAuth
    latestSettings {
      ...SettingsFragment
    }
    settingsCascade {
      ...SettingsCascadeFragment
    }
    configurationCascade {
      ...ConfigurationCascadeFragment
    }
    organizations {
      ...OrgConnectionFragment
    }
    organizationMemberships {
      ...OrganizationMembershipConnectionFragment
    }
    tags
    tosAccepted
    searchable
    usageStatistics {
      ...UserUsageStatisticsFragment
    }
    eventLogs {
      ...EventLogsConnectionFragment
    }
    emails {
      ...UserEmailFragment
    }
    accessTokens {
      ...AccessTokenConnectionFragment
    }
    externalAccounts {
      ...ExternalAccountConnectionFragment
    }
    session {
      ...SessionFragment
    }
    viewerCanAdminister
    viewerCanChangeUsername
    surveyResponses {
      ...SurveyResponseFragment
    }
    databaseID
    namespaceName
    invitableCollaborators {
      ...PersonFragment
    }
    teams {
      ...TeamConnectionFragment
    }
  }
}
Variables
{
  "username": "xyz789",
  "email": "xyz789"
}
Response
{
  "data": {
    "user": {
      "executorSecrets": ExecutorSecretConnection,
      "id": 4,
      "username": "abc123",
      "email": "xyz789",
      "displayName": "abc123",
      "avatarURL": "abc123",
      "url": "abc123",
      "settingsURL": "xyz789",
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z",
      "siteAdmin": false,
      "builtinAuth": false,
      "latestSettings": Settings,
      "settingsCascade": SettingsCascade,
      "configurationCascade": ConfigurationCascade,
      "organizations": OrgConnection,
      "organizationMemberships": OrganizationMembershipConnection,
      "tags": ["xyz789"],
      "tosAccepted": true,
      "searchable": false,
      "usageStatistics": UserUsageStatistics,
      "eventLogs": EventLogsConnection,
      "emails": [UserEmail],
      "accessTokens": AccessTokenConnection,
      "externalAccounts": ExternalAccountConnection,
      "session": Session,
      "viewerCanAdminister": true,
      "viewerCanChangeUsername": true,
      "surveyResponses": [SurveyResponse],
      "databaseID": 987,
      "namespaceName": "abc123",
      "invitableCollaborators": [Person],
      "teams": TeamConnection
    }
  }
}

users

Description

List all users.

Response

Returns a UserConnection!

Arguments
Name Description
first - Int Returns the first n users from the list.
after - String Opaque pagination cursor.
query - String Return users whose usernames or display names match the query.
tag - String Return only users with the given tag.
activePeriod - UserActivePeriod Returns users who have been active in a given period of time.
inactiveSince - DateTime Returns users who have NOT been active since a given point in time.

Example

Query
query users(
  $first: Int,
  $after: String,
  $query: String,
  $tag: String,
  $activePeriod: UserActivePeriod,
  $inactiveSince: DateTime
) {
  users(
    first: $first,
    after: $after,
    query: $query,
    tag: $tag,
    activePeriod: $activePeriod,
    inactiveSince: $inactiveSince
  ) {
    nodes {
      ...UserFragment
    }
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "first": 987,
  "after": "abc123",
  "query": "xyz789",
  "tag": "xyz789",
  "activePeriod": "TODAY",
  "inactiveSince": "2007-12-03T10:15:30Z"
}
Response
{
  "data": {
    "users": {
      "nodes": [User],
      "totalCount": 987,
      "pageInfo": PageInfo
    }
  }
}

viewerConfiguration

use viewerSettings instead
Description

DEPRECATED

Response

Returns a ConfigurationCascade!

Example

Query
query viewerConfiguration {
  viewerConfiguration {
    subjects {
      ...SettingsSubjectFragment
    }
    merged {
      ...ConfigurationFragment
    }
  }
}
Response
{
  "data": {
    "viewerConfiguration": {
      "subjects": [SettingsSubject],
      "merged": Configuration
    }
  }
}

viewerSettings

Description

The settings for the viewer. The viewer is either an anonymous visitor (in which case viewer settings is global settings) or an authenticated user (in which case viewer settings are the user's settings).

Response

Returns a SettingsCascade!

Example

Query
query viewerSettings {
  viewerSettings {
    subjects {
      ...SettingsSubjectFragment
    }
    final
    merged {
      ...ConfigurationFragment
    }
  }
}
Response
{
  "data": {
    "viewerSettings": {
      "subjects": [SettingsSubject],
      "final": "xyz789",
      "merged": Configuration
    }
  }
}

webhookLogs

Description

Returns recently received webhooks across all external services, optionally limiting the returned values to only those that didn't match any external service.

Only site admins can access this field.

Response

Returns a WebhookLogConnection!

Arguments
Name Description
first - Int Returns the first n webhook logs.
after - String Opaque pagination cursor.
onlyErrors - Boolean Only include webhook logs that resulted in errors.
onlyUnmatched - Boolean Only include webhook logs that were not matched to an external service.
since - DateTime Only include webhook logs on or after this time.
until - DateTime Only include webhook logs on or before this time.
webhookID - ID Only include webhook logs of given webhook ID.
legacyOnly - Boolean Only include webhook logs that have no webhook ID set.

Example

Query
query webhookLogs(
  $first: Int,
  $after: String,
  $onlyErrors: Boolean,
  $onlyUnmatched: Boolean,
  $since: DateTime,
  $until: DateTime,
  $webhookID: ID,
  $legacyOnly: Boolean
) {
  webhookLogs(
    first: $first,
    after: $after,
    onlyErrors: $onlyErrors,
    onlyUnmatched: $onlyUnmatched,
    since: $since,
    until: $until,
    webhookID: $webhookID,
    legacyOnly: $legacyOnly
  ) {
    nodes {
      ...WebhookLogFragment
    }
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "first": 123,
  "after": "abc123",
  "onlyErrors": false,
  "onlyUnmatched": false,
  "since": "2007-12-03T10:15:30Z",
  "until": "2007-12-03T10:15:30Z",
  "webhookID": "4",
  "legacyOnly": true
}
Response
{
  "data": {
    "webhookLogs": {
      "nodes": [WebhookLog],
      "totalCount": 123,
      "pageInfo": PageInfo
    }
  }
}

webhooks

Description

Lists webhooks. Only available to site admins. If no kind is given, it returns all webhooks. If first is omitted, 20 items are returned

Response

Returns a WebhookConnection!

Arguments
Name Description
first - Int Returns the first n webhooks from the list.
after - String Opaque pagination cursor.
kind - ExternalServiceKind Optionally filter by kind.

Example

Query
query webhooks(
  $first: Int,
  $after: String,
  $kind: ExternalServiceKind
) {
  webhooks(
    first: $first,
    after: $after,
    kind: $kind
  ) {
    nodes {
      ...WebhookFragment
    }
    totalCount
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "first": 123,
  "after": "abc123",
  "kind": "AWSCODECOMMIT"
}
Response
{
  "data": {
    "webhooks": {
      "nodes": [Webhook],
      "totalCount": 987,
      "pageInfo": PageInfo
    }
  }
}

Mutations

addExternalAccount

Description

Adds an external account to the authenticated user's account. The service type and service ID must correspond to a valid auth provider on the site. The account details must be a stringified JSON object that contains valid credentials for the provided service type.

Response

Returns an EmptyResponse!

Arguments
Name Description
serviceType - String!
serviceID - String!
accountDetails - String!

Example

Query
mutation addExternalAccount(
  $serviceType: String!,
  $serviceID: String!,
  $accountDetails: String!
) {
  addExternalAccount(
    serviceType: $serviceType,
    serviceID: $serviceID,
    accountDetails: $accountDetails
  ) {
    alwaysNil
  }
}
Variables
{
  "serviceType": "abc123",
  "serviceID": "abc123",
  "accountDetails": "xyz789"
}
Response
{
  "data": {
    "addExternalAccount": {
      "alwaysNil": "abc123"
    }
  }
}

addExternalService

Description

Adds a external service. Only site admins may perform this mutation.

Response

Returns an ExternalService!

Arguments
Name Description
input - AddExternalServiceInput!

Example

Query
mutation addExternalService($input: AddExternalServiceInput!) {
  addExternalService(input: $input) {
    id
    kind
    displayName
    config
    createdAt
    updatedAt
    repoCount
    webhookURL
    warning
    lastSyncError
    lastSyncAt
    nextSyncAt
    webhookLogs {
      ...WebhookLogConnectionFragment
    }
    syncJobs {
      ...ExternalServiceSyncJobConnectionFragment
    }
    checkConnection {
      ... on ExternalServiceAvailable {
        ...ExternalServiceAvailableFragment
      }
      ... on ExternalServiceUnavailable {
        ...ExternalServiceUnavailableFragment
      }
      ... on ExternalServiceAvailabilityUnknown {
        ...ExternalServiceAvailabilityUnknownFragment
      }
    }
    hasConnectionCheck
    supportsRepoExclusion
  }
}
Variables
{"input": AddExternalServiceInput}
Response
{
  "data": {
    "addExternalService": {
      "id": "4",
      "kind": "AWSCODECOMMIT",
      "displayName": "abc123",
      "config": JSONCString,
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z",
      "repoCount": 987,
      "webhookURL": "abc123",
      "warning": "xyz789",
      "lastSyncError": "abc123",
      "lastSyncAt": "2007-12-03T10:15:30Z",
      "nextSyncAt": "2007-12-03T10:15:30Z",
      "webhookLogs": WebhookLogConnection,
      "syncJobs": ExternalServiceSyncJobConnection,
      "checkConnection": ExternalServiceAvailable,
      "hasConnectionCheck": false,
      "supportsRepoExclusion": false
    }
  }
}

addPhabricatorRepo

Description

Adds a Phabricator repository to Sourcegraph.

Response

Returns an EmptyResponse

Arguments
Name Description
callsign - String! The callsign, for example "MUX".
name - String The name, for example "github.com/gorilla/mux".
uri - String An alias for name. DEPRECATED: use name instead.
url - String! The URL to the phabricator instance (e.g. http://phabricator.sgdev.org).

Example

Query
mutation addPhabricatorRepo(
  $callsign: String!,
  $name: String,
  $uri: String,
  $url: String!
) {
  addPhabricatorRepo(
    callsign: $callsign,
    name: $name,
    uri: $uri,
    url: $url
  ) {
    alwaysNil
  }
}
Variables
{
  "callsign": "xyz789",
  "name": "xyz789",
  "uri": "abc123",
  "url": "abc123"
}
Response
{
  "data": {
    "addPhabricatorRepo": {
      "alwaysNil": "xyz789"
    }
  }
}

addRepoKeyValuePair

Description

Associate a new key-value pair with a repo.

Response

Returns an EmptyResponse!

Arguments
Name Description
repo - ID!
key - String!
value - String

Example

Query
mutation addRepoKeyValuePair(
  $repo: ID!,
  $key: String!,
  $value: String
) {
  addRepoKeyValuePair(
    repo: $repo,
    key: $key,
    value: $value
  ) {
    alwaysNil
  }
}
Variables
{
  "repo": "4",
  "key": "abc123",
  "value": "abc123"
}
Response
{
  "data": {
    "addRepoKeyValuePair": {
      "alwaysNil": "abc123"
    }
  }
}

addTeamMembers

Description

Add a list of team members to an existing team. People that already are part of the team are ignored.

Either team XOR teamName can be specified to specify the team. Must be team member to add new team members, or site-admin.

For now, members can only be the IDs of User entities in Sourcegraph. Later, we will expand this to allow Persons as well.

Response

Returns a Team!

Arguments
Name Description
team - ID
teamName - String
members - [ID!]!

Example

Query
mutation addTeamMembers(
  $team: ID,
  $teamName: String,
  $members: [ID!]!
) {
  addTeamMembers(
    team: $team,
    teamName: $teamName,
    members: $members
  ) {
    id
    name
    url
    displayName
    readonly
    members {
      ...TeamMemberConnectionFragment
    }
    parentTeam {
      ...TeamFragment
    }
    childTeams {
      ...TeamConnectionFragment
    }
    viewerCanAdminister
  }
}
Variables
{
  "team": "4",
  "teamName": "abc123",
  "members": ["4"]
}
Response
{
  "data": {
    "addTeamMembers": {
      "id": "4",
      "name": "xyz789",
      "url": "abc123",
      "displayName": "abc123",
      "readonly": false,
      "members": TeamMemberConnection,
      "parentTeam": Team,
      "childTeams": TeamConnection,
      "viewerCanAdminister": false
    }
  }
}

addUserEmail

Description

Adds an email address to the user's account. The email address will be marked as unverified until the user has followed the email verification process.

Only the user and site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
user - ID!
email - String!

Example

Query
mutation addUserEmail(
  $user: ID!,
  $email: String!
) {
  addUserEmail(
    user: $user,
    email: $email
  ) {
    alwaysNil
  }
}
Variables
{
  "user": "4",
  "email": "abc123"
}
Response
{
  "data": {
    "addUserEmail": {"alwaysNil": "abc123"}
  }
}

addUserToOrganization

Description

Immediately add a user as a member to the organization, without sending an invitation email.

Only site admins may perform this mutation. Organization members may use the inviteUserToOrganization mutation to invite users.

Response

Returns an EmptyResponse!

Arguments
Name Description
organization - ID!
username - String!

Example

Query
mutation addUserToOrganization(
  $organization: ID!,
  $username: String!
) {
  addUserToOrganization(
    organization: $organization,
    username: $username
  ) {
    alwaysNil
  }
}
Variables
{
  "organization": "4",
  "username": "xyz789"
}
Response
{
  "data": {
    "addUserToOrganization": {
      "alwaysNil": "abc123"
    }
  }
}

cancelExternalServiceSync

Description

Cancels an external service sync job. Must be in queued or processing state.

Site-admin or owner of the external service only.

Response

Returns an EmptyResponse!

Arguments
Name Description
id - ID!

Example

Query
mutation cancelExternalServiceSync($id: ID!) {
  cancelExternalServiceSync(id: $id) {
    alwaysNil
  }
}
Variables
{"id": "4"}
Response
{
  "data": {
    "cancelExternalServiceSync": {
      "alwaysNil": "abc123"
    }
  }
}

checkMirrorRepositoryConnection

Description

Tests the connection to a mirror repository's original source repository. This is an expensive and slow operation, so it should only be used for interactive diagnostics.

Only site admins may perform this mutation.

Arguments
Name Description
repository - ID The ID of the existing repository whose mirror to check.
name - String The name of a repository whose mirror to check. If the name is provided, the repository need not be added to the site (but the site configuration must define a code host that knows how to handle the name).

Example

Query
mutation checkMirrorRepositoryConnection(
  $repository: ID,
  $name: String
) {
  checkMirrorRepositoryConnection(
    repository: $repository,
    name: $name
  ) {
    error
  }
}
Variables
{"repository": 4, "name": "abc123"}
Response
{
  "data": {
    "checkMirrorRepositoryConnection": {
      "error": "abc123"
    }
  }
}

configurationMutation

use settingsMutation instead
Description

DEPRECATED: Use settingsMutation instead. This field is a deprecated alias for settingsMutation and will be removed in a future release.

Response

Returns a SettingsMutation

Arguments
Name Description
input - SettingsMutationGroupInput!

Example

Query
mutation configurationMutation($input: SettingsMutationGroupInput!) {
  configurationMutation(input: $input) {
    editSettings {
      ...UpdateSettingsPayloadFragment
    }
    editConfiguration {
      ...UpdateSettingsPayloadFragment
    }
    overwriteSettings {
      ...UpdateSettingsPayloadFragment
    }
  }
}
Variables
{"input": SettingsMutationGroupInput}
Response
{
  "data": {
    "configurationMutation": {
      "editSettings": UpdateSettingsPayload,
      "editConfiguration": UpdateSettingsPayload,
      "overwriteSettings": UpdateSettingsPayload
    }
  }
}

createAccessToken

Description

Creates an access token that grants the privileges of the specified user (referred to as the access token's "subject" user after token creation). The result is the access token value, which the caller is responsible for storing (it is not accessible by Sourcegraph after creation).

The supported scopes are:

  • "user:all": Full control of all resources accessible to the user account.
  • "site-admin:sudo": Ability to perform any action as any other user. (Only site admins may create tokens with this scope.)

Only the user or site admins may perform this mutation.

Response

Returns a CreateAccessTokenResult!

Arguments
Name Description
user - ID!
scopes - [String!]!
note - String!

Example

Query
mutation createAccessToken(
  $user: ID!,
  $scopes: [String!]!,
  $note: String!
) {
  createAccessToken(
    user: $user,
    scopes: $scopes,
    note: $note
  ) {
    id
    token
  }
}
Variables
{
  "user": 4,
  "scopes": ["xyz789"],
  "note": "xyz789"
}
Response
{
  "data": {
    "createAccessToken": {
      "id": 4,
      "token": "xyz789"
    }
  }
}

createExecutorSecret

Description

Create a new executor secret. See argument descriptions for more details.

Response

Returns an ExecutorSecret!

Arguments
Name Description
scope - ExecutorSecretScope! The scope for which the secret is usable.
key - String! The key under which the secret is known. For executions, this is the name of the environment variable this secret will be accessible under. It is therefore advised that key only contains uppercase letters, numbers and underscores.
value - String! The secret value.
namespace - ID The namespace this secret is for. If not set, a global secret is created that is accessible by all users. Creating a global secret requires site-admin permissions. Creating a namespaced secret requires write-access to the namespace.

Example

Query
mutation createExecutorSecret(
  $scope: ExecutorSecretScope!,
  $key: String!,
  $value: String!,
  $namespace: ID
) {
  createExecutorSecret(
    scope: $scope,
    key: $key,
    value: $value,
    namespace: $namespace
  ) {
    id
    key
    scope
    overwritesGlobalSecret
    namespace {
      ...NamespaceFragment
    }
    creator {
      ...UserFragment
    }
    createdAt
    updatedAt
    accessLogs {
      ...ExecutorSecretAccessLogConnectionFragment
    }
  }
}
Variables
{
  "scope": "BATCHES",
  "key": "abc123",
  "value": "abc123",
  "namespace": "4"
}
Response
{
  "data": {
    "createExecutorSecret": {
      "id": "4",
      "key": "abc123",
      "scope": "BATCHES",
      "overwritesGlobalSecret": true,
      "namespace": Namespace,
      "creator": User,
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z",
      "accessLogs": ExecutorSecretAccessLogConnection
    }
  }
}

createFeatureFlag

Description

(experimental) Create a new feature flag

Response

Returns a FeatureFlag!

Arguments
Name Description
name - String! The name of the feature flag
value - Boolean The value of the feature flag. Only set if the new feature flag will be a concrete boolean flag. Mutually exclusive with rolloutBasisPoints.
rolloutBasisPoints - Int The ratio of users the feature flag will apply to, expressed in basis points (0.01%). Only set if the new feature flag will be a rollout flag. Mutually exclusive with value.

Example

Query
mutation createFeatureFlag(
  $name: String!,
  $value: Boolean,
  $rolloutBasisPoints: Int
) {
  createFeatureFlag(
    name: $name,
    value: $value,
    rolloutBasisPoints: $rolloutBasisPoints
  ) {
    ... on FeatureFlagBoolean {
      ...FeatureFlagBooleanFragment
    }
    ... on FeatureFlagRollout {
      ...FeatureFlagRolloutFragment
    }
  }
}
Variables
{
  "name": "xyz789",
  "value": true,
  "rolloutBasisPoints": 987
}
Response
{"data": {"createFeatureFlag": FeatureFlagBoolean}}

createFeatureFlagOverride

Description

(experimental) Create a new feature flag override for the given org or user

Response

Returns a FeatureFlagOverride!

Arguments
Name Description
namespace - ID! The namespace for this feature flag. Must be either a user ID or an org ID.
flagName - String! The name of the feature flag this override applies to
value - Boolean! The overridden value

Example

Query
mutation createFeatureFlagOverride(
  $namespace: ID!,
  $flagName: String!,
  $value: Boolean!
) {
  createFeatureFlagOverride(
    namespace: $namespace,
    flagName: $flagName,
    value: $value
  ) {
    id
    namespace {
      ...NamespaceFragment
    }
    targetFlag {
      ... on FeatureFlagBoolean {
        ...FeatureFlagBooleanFragment
      }
      ... on FeatureFlagRollout {
        ...FeatureFlagRolloutFragment
      }
    }
    value
  }
}
Variables
{
  "namespace": 4,
  "flagName": "abc123",
  "value": false
}
Response
{
  "data": {
    "createFeatureFlagOverride": {
      "id": "4",
      "namespace": Namespace,
      "targetFlag": FeatureFlagBoolean,
      "value": true
    }
  }
}

createOrganization

Description

Creates an organization. The caller is added as a member of the newly created organization.

Only authenticated users may perform this mutation.

Response

Returns an Org!

Arguments
Name Description
name - String!
displayName - String
statsID - ID

Example

Query
mutation createOrganization(
  $name: String!,
  $displayName: String,
  $statsID: ID
) {
  createOrganization(
    name: $name,
    displayName: $displayName,
    statsID: $statsID
  ) {
    executorSecrets {
      ...ExecutorSecretConnectionFragment
    }
    id
    name
    displayName
    createdAt
    members {
      ...NewUsersConnectionFragment
    }
    latestSettings {
      ...SettingsFragment
    }
    settingsCascade {
      ...SettingsCascadeFragment
    }
    configurationCascade {
      ...ConfigurationCascadeFragment
    }
    viewerPendingInvitation {
      ...OrganizationInvitationFragment
    }
    viewerCanAdminister
    viewerIsMember
    url
    settingsURL
    namespaceName
  }
}
Variables
{
  "name": "abc123",
  "displayName": "xyz789",
  "statsID": "4"
}
Response
{
  "data": {
    "createOrganization": {
      "executorSecrets": ExecutorSecretConnection,
      "id": 4,
      "name": "xyz789",
      "displayName": "xyz789",
      "createdAt": "2007-12-03T10:15:30Z",
      "members": NewUsersConnection,
      "latestSettings": Settings,
      "settingsCascade": SettingsCascade,
      "configurationCascade": ConfigurationCascade,
      "viewerPendingInvitation": OrganizationInvitation,
      "viewerCanAdminister": false,
      "viewerIsMember": false,
      "url": "xyz789",
      "settingsURL": "abc123",
      "namespaceName": "abc123"
    }
  }
}

createPassword

Description

Creates a password for the current user. It is only permitted if the user does not have a password.

Response

Returns an EmptyResponse

Arguments
Name Description
newPassword - String!

Example

Query
mutation createPassword($newPassword: String!) {
  createPassword(newPassword: $newPassword) {
    alwaysNil
  }
}
Variables
{"newPassword": "xyz789"}
Response
{
  "data": {
    "createPassword": {
      "alwaysNil": "abc123"
    }
  }
}

createSavedSearch

Description

Creates a saved search.

Response

Returns a SavedSearch!

Arguments
Name Description
description - String!
query - String!
notifyOwner - Boolean!
notifySlack - Boolean!
orgID - ID
userID - ID

Example

Query
mutation createSavedSearch(
  $description: String!,
  $query: String!,
  $notifyOwner: Boolean!,
  $notifySlack: Boolean!,
  $orgID: ID,
  $userID: ID
) {
  createSavedSearch(
    description: $description,
    query: $query,
    notifyOwner: $notifyOwner,
    notifySlack: $notifySlack,
    orgID: $orgID,
    userID: $userID
  ) {
    id
    description
    query
    notify
    notifySlack
    namespace {
      ...NamespaceFragment
    }
    slackWebhookURL
  }
}
Variables
{
  "description": "abc123",
  "query": "abc123",
  "notifyOwner": false,
  "notifySlack": false,
  "orgID": "4",
  "userID": 4
}
Response
{
  "data": {
    "createSavedSearch": {
      "id": "4",
      "description": "xyz789",
      "query": "abc123",
      "notify": true,
      "notifySlack": true,
      "namespace": Namespace,
      "slackWebhookURL": "abc123"
    }
  }
}

createTeam

Description

Creates a team. The name must be unique, display name can be used to set a custom display value for the team inside Sourcegraph.

If readonly is true, the Sourcegraph UI will show a warning banner that this team is managed externally, and it can only be modified by site-admins. This is to prevent state drift from external systems that ingest team information into Sourcegraph. Readonly can only be set by site-admins.

Either parentTeam XOR parentTeamName can be specified to make the team a child team of the given parent. Only members of the parent team or site-admis can create a child team.

Response

Returns a Team!

Arguments
Name Description
name - String!
displayName - String
readonly - Boolean Default = false
parentTeam - ID
parentTeamName - String

Example

Query
mutation createTeam(
  $name: String!,
  $displayName: String,
  $readonly: Boolean,
  $parentTeam: ID,
  $parentTeamName: String
) {
  createTeam(
    name: $name,
    displayName: $displayName,
    readonly: $readonly,
    parentTeam: $parentTeam,
    parentTeamName: $parentTeamName
  ) {
    id
    name
    url
    displayName
    readonly
    members {
      ...TeamMemberConnectionFragment
    }
    parentTeam {
      ...TeamFragment
    }
    childTeams {
      ...TeamConnectionFragment
    }
    viewerCanAdminister
  }
}
Variables
{
  "name": "abc123",
  "displayName": "xyz789",
  "readonly": false,
  "parentTeam": "4",
  "parentTeamName": "abc123"
}
Response
{
  "data": {
    "createTeam": {
      "id": 4,
      "name": "abc123",
      "url": "abc123",
      "displayName": "xyz789",
      "readonly": true,
      "members": TeamMemberConnection,
      "parentTeam": Team,
      "childTeams": TeamConnection,
      "viewerCanAdminister": true
    }
  }
}

createUser

Description

Creates a new user account.

Only site admins may perform this mutation.

Response

Returns a CreateUserResult!

Arguments
Name Description
username - String! The new user's username.
email - String The new user's optional email address. If given, it must be verified by the user.
verifiedEmail - Boolean Whether or not to mark the provided email address as verified. If unset or set to true, then the email address is immediately marked as verified - otherwise, the email may be marked as unverified if SMTP and password resets are enabled.

Example

Query
mutation createUser(
  $username: String!,
  $email: String,
  $verifiedEmail: Boolean
) {
  createUser(
    username: $username,
    email: $email,
    verifiedEmail: $verifiedEmail
  ) {
    user {
      ...UserFragment
    }
    resetPasswordURL
  }
}
Variables
{
  "username": "abc123",
  "email": "abc123",
  "verifiedEmail": false
}
Response
{
  "data": {
    "createUser": {
      "user": User,
      "resetPasswordURL": "xyz789"
    }
  }
}

createWebhook

Description

Creates a webhook for the specified code host. Only site admins may perform this mutation.

Response

Returns a Webhook!

Arguments
Name Description
name - String!
codeHostKind - String!
codeHostURN - String!
secret - String

Example

Query
mutation createWebhook(
  $name: String!,
  $codeHostKind: String!,
  $codeHostURN: String!,
  $secret: String
) {
  createWebhook(
    name: $name,
    codeHostKind: $codeHostKind,
    codeHostURN: $codeHostURN,
    secret: $secret
  ) {
    id
    uuid
    url
    name
    codeHostKind
    codeHostURN
    secret
    updatedAt
    updatedBy {
      ...UserFragment
    }
    createdAt
    createdBy {
      ...UserFragment
    }
    webhookLogs {
      ...WebhookLogConnectionFragment
    }
  }
}
Variables
{
  "name": "abc123",
  "codeHostKind": "abc123",
  "codeHostURN": "xyz789",
  "secret": "xyz789"
}
Response
{
  "data": {
    "createWebhook": {
      "id": "4",
      "uuid": "abc123",
      "url": "xyz789",
      "name": "xyz789",
      "codeHostKind": "AWSCODECOMMIT",
      "codeHostURN": "abc123",
      "secret": "abc123",
      "updatedAt": "2007-12-03T10:15:30Z",
      "updatedBy": User,
      "createdAt": "2007-12-03T10:15:30Z",
      "createdBy": User,
      "webhookLogs": WebhookLogConnection
    }
  }
}

deleteAccessToken

Description

Deletes and immediately revokes the specified access token, specified by either its ID or by the token itself.

Only site admins or the user who owns the token may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
byID - ID
byToken - String

Example

Query
mutation deleteAccessToken(
  $byID: ID,
  $byToken: String
) {
  deleteAccessToken(
    byID: $byID,
    byToken: $byToken
  ) {
    alwaysNil
  }
}
Variables
{"byID": 4, "byToken": "xyz789"}
Response
{
  "data": {
    "deleteAccessToken": {
      "alwaysNil": "xyz789"
    }
  }
}

deleteExecutorSecret

Description

Deletes the given executor secret.

Response

Returns an EmptyResponse

Arguments
Name Description
scope - ExecutorSecretScope! The scope of the secret.
id - ID! The identifier of the secret that shall be deleted.

Example

Query
mutation deleteExecutorSecret(
  $scope: ExecutorSecretScope!,
  $id: ID!
) {
  deleteExecutorSecret(
    scope: $scope,
    id: $id
  ) {
    alwaysNil
  }
}
Variables
{"scope": "BATCHES", "id": "4"}
Response
{
  "data": {
    "deleteExecutorSecret": {
      "alwaysNil": "xyz789"
    }
  }
}

deleteExternalAccount

Description

Deletes the association between an external account and its Sourcegraph user. It does NOT delete the external account on the external service where it resides.

Only site admins or the user who is associated with the external account may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
externalAccount - ID!

Example

Query
mutation deleteExternalAccount($externalAccount: ID!) {
  deleteExternalAccount(externalAccount: $externalAccount) {
    alwaysNil
  }
}
Variables
{"externalAccount": 4}
Response
{
  "data": {
    "deleteExternalAccount": {
      "alwaysNil": "abc123"
    }
  }
}

deleteExternalService

Description

Delete an external service. Only site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
externalService - ID!
async - Boolean Default = false

Example

Query
mutation deleteExternalService(
  $externalService: ID!,
  $async: Boolean
) {
  deleteExternalService(
    externalService: $externalService,
    async: $async
  ) {
    alwaysNil
  }
}
Variables
{"externalService": 4, "async": false}
Response
{
  "data": {
    "deleteExternalService": {
      "alwaysNil": "abc123"
    }
  }
}

deleteFeatureFlag

Description

(experimental) Delete a feature flag

Response

Returns an EmptyResponse!

Arguments
Name Description
name - String! The name of the feature flag

Example

Query
mutation deleteFeatureFlag($name: String!) {
  deleteFeatureFlag(name: $name) {
    alwaysNil
  }
}
Variables
{"name": "xyz789"}
Response
{
  "data": {
    "deleteFeatureFlag": {
      "alwaysNil": "xyz789"
    }
  }
}

deleteFeatureFlagOverride

Description

Delete a feature flag override

Response

Returns an EmptyResponse!

Arguments
Name Description
id - ID! The ID of the feature flag override to delete

Example

Query
mutation deleteFeatureFlagOverride($id: ID!) {
  deleteFeatureFlagOverride(id: $id) {
    alwaysNil
  }
}
Variables
{"id": 4}
Response
{
  "data": {
    "deleteFeatureFlagOverride": {
      "alwaysNil": "xyz789"
    }
  }
}

deleteOrganization

Description

Soft or hard deletes an organization.

  • When the second argument is not provided, it soft deletes an organization, marking it as deleted. Only site admins may perform this mutation.
  • When the second argument is true, it hard deletes an organization and its associated resources. Hard deletion is currently only supported on cloud. Only org members may perform this mutation
Response

Returns an EmptyResponse

Arguments
Name Description
organization - ID!
hard - Boolean

Example

Query
mutation deleteOrganization(
  $organization: ID!,
  $hard: Boolean
) {
  deleteOrganization(
    organization: $organization,
    hard: $hard
  ) {
    alwaysNil
  }
}
Variables
{"organization": "4", "hard": false}
Response
{
  "data": {
    "deleteOrganization": {
      "alwaysNil": "xyz789"
    }
  }
}

deleteRepoKeyValuePair

Description

Delete a key-value pair associated with a repo.

Response

Returns an EmptyResponse!

Arguments
Name Description
repo - ID!
key - String!

Example

Query
mutation deleteRepoKeyValuePair(
  $repo: ID!,
  $key: String!
) {
  deleteRepoKeyValuePair(
    repo: $repo,
    key: $key
  ) {
    alwaysNil
  }
}
Variables
{
  "repo": "4",
  "key": "xyz789"
}
Response
{
  "data": {
    "deleteRepoKeyValuePair": {
      "alwaysNil": "abc123"
    }
  }
}

deleteRepositoryFromDisk

Description

INTERNAL ONLY: Delete a repository from the gitserver. This involves deleting the file on disk, and marking it as not-cloned in the database.

Response

Returns an EmptyResponse!

Arguments
Name Description
repo - ID!

Example

Query
mutation deleteRepositoryFromDisk($repo: ID!) {
  deleteRepositoryFromDisk(repo: $repo) {
    alwaysNil
  }
}
Variables
{"repo": "4"}
Response
{
  "data": {
    "deleteRepositoryFromDisk": {
      "alwaysNil": "xyz789"
    }
  }
}

deleteSavedSearch

Description

Deletes a saved search

Response

Returns an EmptyResponse

Arguments
Name Description
id - ID!

Example

Query
mutation deleteSavedSearch($id: ID!) {
  deleteSavedSearch(id: $id) {
    alwaysNil
  }
}
Variables
{"id": "4"}
Response
{
  "data": {
    "deleteSavedSearch": {
      "alwaysNil": "xyz789"
    }
  }
}

deleteTeam

Description

Delete team deletes a team. ID or Name must be specified, but not both. Must be team-member to delete. If the team is marked as read-only, must be site-admin.

Response

Returns an EmptyResponse

Arguments
Name Description
id - ID
name - String

Example

Query
mutation deleteTeam(
  $id: ID,
  $name: String
) {
  deleteTeam(
    id: $id,
    name: $name
  ) {
    alwaysNil
  }
}
Variables
{
  "id": "4",
  "name": "abc123"
}
Response
{
  "data": {
    "deleteTeam": {"alwaysNil": "abc123"}
  }
}

deleteUser

Description

Deletes a user account. Only site admins may perform this mutation.

If hard == true, a hard delete is performed. By default, deletes are 'soft deletes' and could theoretically be undone with manual DB commands. If a hard delete is performed, the data is truly removed from the database and deletion can NEVER be undone.

Data that is deleted as part of this operation:

  • All user data (access tokens, email addresses, external account info, survey responses, etc)
  • Organization membership information (which organizations the user is a part of, any invitations created by or targeting the user).
  • Sourcegraph extensions published by the user.
  • User, Organization, or Global settings authored by the user.
Response

Returns an EmptyResponse

Arguments
Name Description
user - ID!
hard - Boolean

Example

Query
mutation deleteUser(
  $user: ID!,
  $hard: Boolean
) {
  deleteUser(
    user: $user,
    hard: $hard
  ) {
    alwaysNil
  }
}
Variables
{"user": 4, "hard": false}
Response
{
  "data": {
    "deleteUser": {"alwaysNil": "abc123"}
  }
}

deleteUsers

Description

Bulk "deleteUser" action.

Response

Returns an EmptyResponse

Arguments
Name Description
users - [ID!]!
hard - Boolean

Example

Query
mutation deleteUsers(
  $users: [ID!]!,
  $hard: Boolean
) {
  deleteUsers(
    users: $users,
    hard: $hard
  ) {
    alwaysNil
  }
}
Variables
{"users": [4], "hard": false}
Response
{
  "data": {
    "deleteUsers": {"alwaysNil": "xyz789"}
  }
}

deleteWebhook

Description

Deletes a webhook by given ID. Only site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
id - ID!

Example

Query
mutation deleteWebhook($id: ID!) {
  deleteWebhook(id: $id) {
    alwaysNil
  }
}
Variables
{"id": 4}
Response
{
  "data": {
    "deleteWebhook": {"alwaysNil": "abc123"}
  }
}

editTemporarySettings

Description

Merges the given settings edit with the current temporary settings for the current user. Keys in the given edit take priority over key in the temporary settings. The merge is not recursive. If temporary settings for the user do not exist, they are created.

Response

Returns an EmptyResponse!

Arguments
Name Description
settingsToEdit - String! The settings to merge with the current temporary settings for the current user, as a JSON string.

Example

Query
mutation editTemporarySettings($settingsToEdit: String!) {
  editTemporarySettings(settingsToEdit: $settingsToEdit) {
    alwaysNil
  }
}
Variables
{"settingsToEdit": "abc123"}
Response
{
  "data": {
    "editTemporarySettings": {
      "alwaysNil": "abc123"
    }
  }
}

excludeRepoFromExternalServices

Description

Excludes a repo from external services configs. Only site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
externalServices - [ID!]!
repo - ID!

Example

Query
mutation excludeRepoFromExternalServices(
  $externalServices: [ID!]!,
  $repo: ID!
) {
  excludeRepoFromExternalServices(
    externalServices: $externalServices,
    repo: $repo
  ) {
    alwaysNil
  }
}
Variables
{"externalServices": ["4"], "repo": 4}
Response
{
  "data": {
    "excludeRepoFromExternalServices": {
      "alwaysNil": "xyz789"
    }
  }
}

invalidateSessionsByID

Description

Invalidates all sessions belonging to a user.

Only site admins may perform this mutation.

Response

Returns an EmptyResponse

Arguments
Name Description
userID - ID!

Example

Query
mutation invalidateSessionsByID($userID: ID!) {
  invalidateSessionsByID(userID: $userID) {
    alwaysNil
  }
}
Variables
{"userID": "4"}
Response
{
  "data": {
    "invalidateSessionsByID": {
      "alwaysNil": "abc123"
    }
  }
}

invalidateSessionsByIDs

Description

Bulk "invalidateSessionsByID" action.

Response

Returns an EmptyResponse

Arguments
Name Description
userIDs - [ID!]!

Example

Query
mutation invalidateSessionsByIDs($userIDs: [ID!]!) {
  invalidateSessionsByIDs(userIDs: $userIDs) {
    alwaysNil
  }
}
Variables
{"userIDs": ["4"]}
Response
{
  "data": {
    "invalidateSessionsByIDs": {
      "alwaysNil": "xyz789"
    }
  }
}

inviteEmailToSourcegraph

Description

Sends an invitation to join Sourcegraph to the given email address.

Returns instantly regardless of whether or not an invitation email was actually sent. For example, the email may fail to send if there is a typo or it is invalid, or Sourcegraph may refuse to send it due to spam concerns or if the user has been invited too recently.

Response

Returns an EmptyResponse!

Arguments
Name Description
email - String!

Example

Query
mutation inviteEmailToSourcegraph($email: String!) {
  inviteEmailToSourcegraph(email: $email) {
    alwaysNil
  }
}
Variables
{"email": "xyz789"}
Response
{
  "data": {
    "inviteEmailToSourcegraph": {
      "alwaysNil": "abc123"
    }
  }
}

inviteUserToOrganization

Description

Invite the user with the given username to join the organization. The invited user account must already exist.

Only site admins and any organization member may perform this mutation.

Response

Returns an InviteUserToOrganizationResult!

Arguments
Name Description
organization - ID!
username - String
email - String

Example

Query
mutation inviteUserToOrganization(
  $organization: ID!,
  $username: String,
  $email: String
) {
  inviteUserToOrganization(
    organization: $organization,
    username: $username,
    email: $email
  ) {
    sentInvitationEmail
    invitationURL
  }
}
Variables
{
  "organization": "4",
  "username": "abc123",
  "email": "abc123"
}
Response
{
  "data": {
    "inviteUserToOrganization": {
      "sentInvitationEmail": true,
      "invitationURL": "abc123"
    }
  }
}

logEvent

Description

Logs an event.

Response

Returns an EmptyResponse

Arguments
Name Description
event - String! The name of the event.
userCookieID - String! The randomly generated unique user ID stored in a browser cookie.
firstSourceURL - String The first sourcegraph URL visited by the user, stored in a browser cookie.
lastSourceURL - String The last sourcegraph URL visited by the user, stored in a browser cookie.
url - String! The URL when the event was logged.
source - EventSource! The source of the event.
cohortID - String An optional cohort ID to identify the user as part of a specific A/B test. The cohort ID is expected to be a date in the form YYYY-MM-DD
referrer - String An optional referrer parameter for the user's current session. Only captured and stored on Sourcegraph Cloud.
originalReferrer - String The original referrer for a user
sessionReferrer - String The session referrer for a user
sessionFirstURL - String The sessions first url for a user
deviceSessionID - String Device session ID to identify the user's session for analytics.
argument - String The additional argument information.
publicArgument - String Public argument information. PRIVACY: Do NOT include any potentially private information in this field. These properties get sent to our analytics tools for Cloud, so must not include private information, such as search queries or repository names.
deviceID - String Device ID used for Amplitude analytics. Used on Sourcegraph Cloud only.
eventID - Int Event ID used to deduplicate events that occur simultaneously in Amplitude analytics. See https://developers.amplitude.com/docs/http-api-v2#optional-keys. Used on Sourcegraph Cloud only.
insertID - String Insert ID used to deduplicate events that re-occur in the event of retries or backfills in Amplitude analytics. See https://developers.amplitude.com/docs/http-api-v2#optional-keys. Used on Sourcegraph Cloud only.

Example

Query
mutation logEvent(
  $event: String!,
  $userCookieID: String!,
  $firstSourceURL: String,
  $lastSourceURL: String,
  $url: String!,
  $source: EventSource!,
  $cohortID: String,
  $referrer: String,
  $originalReferrer: String,
  $sessionReferrer: String,
  $sessionFirstURL: String,
  $deviceSessionID: String,
  $argument: String,
  $publicArgument: String,
  $deviceID: String,
  $eventID: Int,
  $insertID: String
) {
  logEvent(
    event: $event,
    userCookieID: $userCookieID,
    firstSourceURL: $firstSourceURL,
    lastSourceURL: $lastSourceURL,
    url: $url,
    source: $source,
    cohortID: $cohortID,
    referrer: $referrer,
    originalReferrer: $originalReferrer,
    sessionReferrer: $sessionReferrer,
    sessionFirstURL: $sessionFirstURL,
    deviceSessionID: $deviceSessionID,
    argument: $argument,
    publicArgument: $publicArgument,
    deviceID: $deviceID,
    eventID: $eventID,
    insertID: $insertID
  ) {
    alwaysNil
  }
}
Variables
{
  "event": "xyz789",
  "userCookieID": "abc123",
  "firstSourceURL": "xyz789",
  "lastSourceURL": "abc123",
  "url": "xyz789",
  "source": "WEB",
  "cohortID": "xyz789",
  "referrer": "xyz789",
  "originalReferrer": "abc123",
  "sessionReferrer": "xyz789",
  "sessionFirstURL": "abc123",
  "deviceSessionID": "abc123",
  "argument": "abc123",
  "publicArgument": "xyz789",
  "deviceID": "xyz789",
  "eventID": 123,
  "insertID": "xyz789"
}
Response
{
  "data": {
    "logEvent": {"alwaysNil": "abc123"}
  }
}

logEvents

Description

Logs a batch of events.

Response

Returns an EmptyResponse

Arguments
Name Description
events - [Event!]

Example

Query
mutation logEvents($events: [Event!]) {
  logEvents(events: $events) {
    alwaysNil
  }
}
Variables
{"events": [Event]}
Response
{
  "data": {
    "logEvents": {"alwaysNil": "abc123"}
  }
}

logUserEvent

use logEvent instead
Description

Logs a user event. No longer used, only here for backwards compatibility with IDE and browser extensions.

Response

Returns an EmptyResponse

Arguments
Name Description
event - UserEvent!
userCookieID - String!

Example

Query
mutation logUserEvent(
  $event: UserEvent!,
  $userCookieID: String!
) {
  logUserEvent(
    event: $event,
    userCookieID: $userCookieID
  ) {
    alwaysNil
  }
}
Variables
{
  "event": "PAGEVIEW",
  "userCookieID": "abc123"
}
Response
{
  "data": {
    "logUserEvent": {"alwaysNil": "xyz789"}
  }
}

overwriteTemporarySettings

Description

Overwrites and saves the temporary settings for the current user. If temporary settings for the user do not exist, they are created.

Response

Returns an EmptyResponse!

Arguments
Name Description
contents - String! The new temporary settings for the current user, as a JSON string.

Example

Query
mutation overwriteTemporarySettings($contents: String!) {
  overwriteTemporarySettings(contents: $contents) {
    alwaysNil
  }
}
Variables
{"contents": "abc123"}
Response
{
  "data": {
    "overwriteTemporarySettings": {
      "alwaysNil": "abc123"
    }
  }
}

randomizeUserPassword

Description

Randomize a user's password so that they need to reset it before they can sign in again.

Only site admins may perform this mutation.

Response

Returns a RandomizeUserPasswordResult!

Arguments
Name Description
user - ID!

Example

Query
mutation randomizeUserPassword($user: ID!) {
  randomizeUserPassword(user: $user) {
    resetPasswordURL
    emailSent
  }
}
Variables
{"user": 4}
Response
{
  "data": {
    "randomizeUserPassword": {
      "resetPasswordURL": "abc123",
      "emailSent": true
    }
  }
}

recloneRepository

Description

INTERNAL ONLY: Reclone a repository from the gitserver. This involves deleting the file on disk, marking it as not-cloned in the database, and then initiating a repo clone.

Response

Returns an EmptyResponse!

Arguments
Name Description
repo - ID!

Example

Query
mutation recloneRepository($repo: ID!) {
  recloneRepository(repo: $repo) {
    alwaysNil
  }
}
Variables
{"repo": "4"}
Response
{
  "data": {
    "recloneRepository": {
      "alwaysNil": "xyz789"
    }
  }
}

recoverUsers

Description

Bulk "recoverUser" action.

Response

Returns an EmptyResponse

Arguments
Name Description
userIDs - [ID!]!

Example

Query
mutation recoverUsers($userIDs: [ID!]!) {
  recoverUsers(userIDs: $userIDs) {
    alwaysNil
  }
}
Variables
{"userIDs": ["4"]}
Response
{
  "data": {
    "recoverUsers": {"alwaysNil": "xyz789"}
  }
}

reindexRepository

Description

Force Zoekt to reindex the repository right now. Reindexing occurs automatically, so this should not normally be needed.

Response

Returns an EmptyResponse!

Arguments
Name Description
repository - ID! The repository to index

Example

Query
mutation reindexRepository($repository: ID!) {
  reindexRepository(repository: $repository) {
    alwaysNil
  }
}
Variables
{"repository": "4"}
Response
{
  "data": {
    "reindexRepository": {
      "alwaysNil": "abc123"
    }
  }
}

reloadSite

Description

Reloads the site by restarting the server. This is not supported for all deployment types. This may cause downtime.

Only site admins may perform this mutation.

Response

Returns an EmptyResponse

Example

Query
mutation reloadSite {
  reloadSite {
    alwaysNil
  }
}
Response
{
  "data": {
    "reloadSite": {"alwaysNil": "abc123"}
  }
}

removeTeamMembers

Description

This mutation removes team membership for the given team and set of members. Members that weren't part of the team are ignored.

Either team XOR teamName can be specified to specify the team. Must be team member to remove team members, or site-admin.

For now, members can only be the IDs of User entities in Sourcegraph. Later, we will expand this to allow Persons as well.

Response

Returns a Team!

Arguments
Name Description
team - ID
teamName - String
members - [ID!]!

Example

Query
mutation removeTeamMembers(
  $team: ID,
  $teamName: String,
  $members: [ID!]!
) {
  removeTeamMembers(
    team: $team,
    teamName: $teamName,
    members: $members
  ) {
    id
    name
    url
    displayName
    readonly
    members {
      ...TeamMemberConnectionFragment
    }
    parentTeam {
      ...TeamFragment
    }
    childTeams {
      ...TeamConnectionFragment
    }
    viewerCanAdminister
  }
}
Variables
{
  "team": 4,
  "teamName": "abc123",
  "members": [4]
}
Response
{
  "data": {
    "removeTeamMembers": {
      "id": 4,
      "name": "abc123",
      "url": "abc123",
      "displayName": "xyz789",
      "readonly": false,
      "members": TeamMemberConnection,
      "parentTeam": Team,
      "childTeams": TeamConnection,
      "viewerCanAdminister": false
    }
  }
}

removeUserEmail

Description

Removes an email address from the user's account.

Only the user and site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
user - ID!
email - String!

Example

Query
mutation removeUserEmail(
  $user: ID!,
  $email: String!
) {
  removeUserEmail(
    user: $user,
    email: $email
  ) {
    alwaysNil
  }
}
Variables
{
  "user": "4",
  "email": "abc123"
}
Response
{
  "data": {
    "removeUserEmail": {
      "alwaysNil": "abc123"
    }
  }
}

removeUserFromOrganization

Description

Removes a user as a member from an organization.

Only site admins and any member of the organization may perform this mutation.

Response

Returns an EmptyResponse

Arguments
Name Description
user - ID!
organization - ID!

Example

Query
mutation removeUserFromOrganization(
  $user: ID!,
  $organization: ID!
) {
  removeUserFromOrganization(
    user: $user,
    organization: $organization
  ) {
    alwaysNil
  }
}
Variables
{"user": 4, "organization": "4"}
Response
{
  "data": {
    "removeUserFromOrganization": {
      "alwaysNil": "xyz789"
    }
  }
}

resendOrganizationInvitationNotification

Description

Resend the notification about an organization invitation to the recipient.

Only site admins and any member of the organization may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
organizationInvitation - ID! The organization invitation.

Example

Query
mutation resendOrganizationInvitationNotification($organizationInvitation: ID!) {
  resendOrganizationInvitationNotification(organizationInvitation: $organizationInvitation) {
    alwaysNil
  }
}
Variables
{"organizationInvitation": "4"}
Response
{
  "data": {
    "resendOrganizationInvitationNotification": {
      "alwaysNil": "abc123"
    }
  }
}

resendVerificationEmail

Description

Resend a verification email, no op if the email is already verified.

Only the user and site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
user - ID!
email - String!

Example

Query
mutation resendVerificationEmail(
  $user: ID!,
  $email: String!
) {
  resendVerificationEmail(
    user: $user,
    email: $email
  ) {
    alwaysNil
  }
}
Variables
{"user": 4, "email": "xyz789"}
Response
{
  "data": {
    "resendVerificationEmail": {
      "alwaysNil": "xyz789"
    }
  }
}

resolvePhabricatorDiff

Description

Resolves a revision for a given diff from Phabricator.

Response

Returns a GitCommit

Arguments
Name Description
repoName - String! The name of the repository that the diff is based on.
diffID - ID! The ID of the diff on Phabricator.
baseRev - String! The base revision this diff is based on.
patch - String The raw contents of the diff from Phabricator. Required if Sourcegraph doesn't have a Conduit API token.
description - String The description of the diff. This will be used as the commit message.
authorName - String The name of author of the diff.
authorEmail - String The author's email.
date - String When the diff was created.

Example

Query
mutation resolvePhabricatorDiff(
  $repoName: String!,
  $diffID: ID!,
  $baseRev: String!,
  $patch: String,
  $description: String,
  $authorName: String,
  $authorEmail: String,
  $date: String
) {
  resolvePhabricatorDiff(
    repoName: $repoName,
    diffID: $diffID,
    baseRev: $baseRev,
    patch: $patch,
    description: $description,
    authorName: $authorName,
    authorEmail: $authorEmail,
    date: $date
  ) {
    id
    repository {
      ...RepositoryFragment
    }
    oid
    abbreviatedOID
    author {
      ...SignatureFragment
    }
    committer {
      ...SignatureFragment
    }
    message
    subject
    body
    parents {
      ...GitCommitFragment
    }
    url
    canonicalURL
    externalURLs {
      ...ExternalLinkFragment
    }
    path {
      ... on GitTree {
        ...GitTreeFragment
      }
      ... on GitBlob {
        ...GitBlobFragment
      }
    }
    tree {
      ...GitTreeFragment
    }
    fileNames
    blob {
      ...GitBlobFragment
    }
    file {
      ...File2Fragment
    }
    languages
    languageStatistics {
      ...LanguageStatisticsFragment
    }
    ancestors {
      ...GitCommitConnectionFragment
    }
    behindAhead {
      ...BehindAheadCountsFragment
    }
    symbols {
      ...SymbolConnectionFragment
    }
    diff {
      ...RepositoryComparisonFragment
    }
  }
}
Variables
{
  "repoName": "xyz789",
  "diffID": "4",
  "baseRev": "xyz789",
  "patch": "abc123",
  "description": "xyz789",
  "authorName": "xyz789",
  "authorEmail": "abc123",
  "date": "abc123"
}
Response
{
  "data": {
    "resolvePhabricatorDiff": {
      "id": "4",
      "repository": Repository,
      "oid": GitObjectID,
      "abbreviatedOID": "xyz789",
      "author": Signature,
      "committer": Signature,
      "message": "xyz789",
      "subject": "abc123",
      "body": "abc123",
      "parents": [GitCommit],
      "url": "abc123",
      "canonicalURL": "xyz789",
      "externalURLs": [ExternalLink],
      "path": GitTree,
      "tree": GitTree,
      "fileNames": ["abc123"],
      "blob": GitBlob,
      "file": File2,
      "languages": ["abc123"],
      "languageStatistics": [LanguageStatistics],
      "ancestors": GitCommitConnection,
      "behindAhead": BehindAheadCounts,
      "symbols": SymbolConnection,
      "diff": RepositoryComparison
    }
  }
}

respondToOrganizationInvitation

Description

Accept or reject an existing organization invitation.

Only the recipient of the invitation may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
organizationInvitation - ID! The organization invitation.
responseType - OrganizationInvitationResponseType! The response to the invitation.

Example

Query
mutation respondToOrganizationInvitation(
  $organizationInvitation: ID!,
  $responseType: OrganizationInvitationResponseType!
) {
  respondToOrganizationInvitation(
    organizationInvitation: $organizationInvitation,
    responseType: $responseType
  ) {
    alwaysNil
  }
}
Variables
{
  "organizationInvitation": "4",
  "responseType": "ACCEPT"
}
Response
{
  "data": {
    "respondToOrganizationInvitation": {
      "alwaysNil": "xyz789"
    }
  }
}

revokeOrganizationInvitation

Description

Revoke an existing organization invitation.

If the invitation has been accepted or rejected, it may no longer be revoked. After an invitation is revoked, the recipient may not accept or reject it. Both cases yield an error.

Only site admins and any member of the organization may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
organizationInvitation - ID! The organization invitation.

Example

Query
mutation revokeOrganizationInvitation($organizationInvitation: ID!) {
  revokeOrganizationInvitation(organizationInvitation: $organizationInvitation) {
    alwaysNil
  }
}
Variables
{"organizationInvitation": 4}
Response
{
  "data": {
    "revokeOrganizationInvitation": {
      "alwaysNil": "xyz789"
    }
  }
}

sendTestEmail

Description

Sends an email for testing Sourcegraph's email configuration.

Only administrators can use this API.

Response

Returns a String!

Arguments
Name Description
to - String!

Example

Query
mutation sendTestEmail($to: String!) {
  sendTestEmail(to: $to)
}
Variables
{"to": "abc123"}
Response
{"data": {"sendTestEmail": "xyz789"}}

setMigrationDirection

Description

Updates an out-of-band migration to run in a particular direction.

Applied in the forward direction, an out-of-band migration migrates data into a format that is readable by newer Sourcegraph instances. This may be destructive or non-destructive process, depending on the nature and implementation of the migration.

Applied in the reverse direction, an out-of-band migration ensures that data is moved back into a format that is readable by the previous Sourcegraph instance. Recently introduced migrations should be applied in reverse prior to downgrading the instance.

Response

Returns an EmptyResponse!

Arguments
Name Description
id - ID!
applyReverse - Boolean!

Example

Query
mutation setMigrationDirection(
  $id: ID!,
  $applyReverse: Boolean!
) {
  setMigrationDirection(
    id: $id,
    applyReverse: $applyReverse
  ) {
    alwaysNil
  }
}
Variables
{"id": "4", "applyReverse": false}
Response
{
  "data": {
    "setMigrationDirection": {
      "alwaysNil": "xyz789"
    }
  }
}

setSearchable

Description

Current user opt in/out from being searchable in the users picker.

Response

Returns an EmptyResponse!

Arguments
Name Description
searchable - Boolean!

Example

Query
mutation setSearchable($searchable: Boolean!) {
  setSearchable(searchable: $searchable) {
    alwaysNil
  }
}
Variables
{"searchable": true}
Response
{
  "data": {
    "setSearchable": {"alwaysNil": "xyz789"}
  }
}

setTag

Description

Adds or removes a tag on a user.

Tags are used internally by Sourcegraph as feature flags for experimental features.

Only site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
node - ID!

The ID of the user whose tags to set.

(This parameter is named "node" to make it easy to support tagging other types of nodes other than users in the future.)

tag - String! The tag to set.
present - Boolean! The desired state of the tag on the user (whether to add or remove): true to add, false to remove.

Example

Query
mutation setTag(
  $node: ID!,
  $tag: String!,
  $present: Boolean!
) {
  setTag(
    node: $node,
    tag: $tag,
    present: $present
  ) {
    alwaysNil
  }
}
Variables
{
  "node": 4,
  "tag": "abc123",
  "present": false
}
Response
{
  "data": {
    "setTag": {"alwaysNil": "xyz789"}
  }
}

setTeamMembers

Description

This is a convenience method to forcefully overwrite the full set of members of a team. This is handy to sync external state without diffing the current members vs the desired set of members.

Either team XOR teamName can be specified to specify the team. Must be team member to modify team members, or site-admin.

For now, members can only be the IDs of User entities in Sourcegraph. Later, we will expand this to allow Persons as well.

Response

Returns a Team!

Arguments
Name Description
team - ID
teamName - String
members - [ID!]!

Example

Query
mutation setTeamMembers(
  $team: ID,
  $teamName: String,
  $members: [ID!]!
) {
  setTeamMembers(
    team: $team,
    teamName: $teamName,
    members: $members
  ) {
    id
    name
    url
    displayName
    readonly
    members {
      ...TeamMemberConnectionFragment
    }
    parentTeam {
      ...TeamFragment
    }
    childTeams {
      ...TeamConnectionFragment
    }
    viewerCanAdminister
  }
}
Variables
{
  "team": 4,
  "teamName": "abc123",
  "members": [4]
}
Response
{
  "data": {
    "setTeamMembers": {
      "id": 4,
      "name": "abc123",
      "url": "xyz789",
      "displayName": "abc123",
      "readonly": true,
      "members": TeamMemberConnection,
      "parentTeam": Team,
      "childTeams": TeamConnection,
      "viewerCanAdminister": true
    }
  }
}

setTosAccepted

Description

Sets the user to accept the site's Terms of Service and Privacy Policy. If the ID is omitted, the current user is assumed.

Only the user or site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
userID - ID

Example

Query
mutation setTosAccepted($userID: ID) {
  setTosAccepted(userID: $userID) {
    alwaysNil
  }
}
Variables
{"userID": 4}
Response
{
  "data": {
    "setTosAccepted": {
      "alwaysNil": "abc123"
    }
  }
}

setUserEmailPrimary

Description

Set an email address as the user's primary.

Only the user and site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
user - ID!
email - String!

Example

Query
mutation setUserEmailPrimary(
  $user: ID!,
  $email: String!
) {
  setUserEmailPrimary(
    user: $user,
    email: $email
  ) {
    alwaysNil
  }
}
Variables
{"user": 4, "email": "abc123"}
Response
{
  "data": {
    "setUserEmailPrimary": {
      "alwaysNil": "abc123"
    }
  }
}

setUserEmailVerified

Description

Manually set the verification status of a user's email, without going through the normal verification process (of clicking on a link in the email with a verification code).

Only site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
user - ID!
email - String!
verified - Boolean!

Example

Query
mutation setUserEmailVerified(
  $user: ID!,
  $email: String!,
  $verified: Boolean!
) {
  setUserEmailVerified(
    user: $user,
    email: $email,
    verified: $verified
  ) {
    alwaysNil
  }
}
Variables
{
  "user": 4,
  "email": "xyz789",
  "verified": false
}
Response
{
  "data": {
    "setUserEmailVerified": {
      "alwaysNil": "xyz789"
    }
  }
}

setUserIsSiteAdmin

Description

Sets whether the user with the specified user ID is a site admin.

Only site admins may perform this mutation.

Response

Returns an EmptyResponse

Arguments
Name Description
userID - ID!
siteAdmin - Boolean!

Example

Query
mutation setUserIsSiteAdmin(
  $userID: ID!,
  $siteAdmin: Boolean!
) {
  setUserIsSiteAdmin(
    userID: $userID,
    siteAdmin: $siteAdmin
  ) {
    alwaysNil
  }
}
Variables
{"userID": "4", "siteAdmin": true}
Response
{
  "data": {
    "setUserIsSiteAdmin": {
      "alwaysNil": "xyz789"
    }
  }
}

settingsMutation

Description

All mutations that update settings (global, organization, and user settings) are under this field.

Only the settings subject whose settings are being mutated (and site admins) may perform this mutation.

This mutation only affects global, organization, and user settings, not site configuration. For site configuration (which is a separate set of configuration properties from global/organization/user settings), use updateSiteConfiguration.

Response

Returns a SettingsMutation

Arguments
Name Description
input - SettingsMutationGroupInput!

Example

Query
mutation settingsMutation($input: SettingsMutationGroupInput!) {
  settingsMutation(input: $input) {
    editSettings {
      ...UpdateSettingsPayloadFragment
    }
    editConfiguration {
      ...UpdateSettingsPayloadFragment
    }
    overwriteSettings {
      ...UpdateSettingsPayloadFragment
    }
  }
}
Variables
{"input": SettingsMutationGroupInput}
Response
{
  "data": {
    "settingsMutation": {
      "editSettings": UpdateSettingsPayload,
      "editConfiguration": UpdateSettingsPayload,
      "overwriteSettings": UpdateSettingsPayload
    }
  }
}

submitHappinessFeedback

Description

Submits happiness feedback.

Response

Returns an EmptyResponse

Arguments
Name Description
input - HappinessFeedbackSubmissionInput!

Example

Query
mutation submitHappinessFeedback($input: HappinessFeedbackSubmissionInput!) {
  submitHappinessFeedback(input: $input) {
    alwaysNil
  }
}
Variables
{"input": HappinessFeedbackSubmissionInput}
Response
{
  "data": {
    "submitHappinessFeedback": {
      "alwaysNil": "xyz789"
    }
  }
}

submitSurvey

Description

Submits a user satisfaction (NPS) survey.

Response

Returns an EmptyResponse

Arguments
Name Description
input - SurveySubmissionInput!

Example

Query
mutation submitSurvey($input: SurveySubmissionInput!) {
  submitSurvey(input: $input) {
    alwaysNil
  }
}
Variables
{"input": SurveySubmissionInput}
Response
{
  "data": {
    "submitSurvey": {"alwaysNil": "abc123"}
  }
}

syncExternalService

Description

Enqueues a sync for the external service. It will be picked up in the background.

Site-admin or owner of the external service only.

Response

Returns an EmptyResponse!

Arguments
Name Description
id - ID!

Example

Query
mutation syncExternalService($id: ID!) {
  syncExternalService(id: $id) {
    alwaysNil
  }
}
Variables
{"id": "4"}
Response
{
  "data": {
    "syncExternalService": {
      "alwaysNil": "xyz789"
    }
  }
}

triggerObservabilityTestAlert

Description

OBSERVABILITY

Set the status of a test alert of the specified parameters - useful for validating 'observability.alerts' configuration. Alerts may take up to a minute to fire.

Response

Returns an EmptyResponse!

Arguments
Name Description
level - String! Level of alert to test - either warning or critical.

Example

Query
mutation triggerObservabilityTestAlert($level: String!) {
  triggerObservabilityTestAlert(level: $level) {
    alwaysNil
  }
}
Variables
{"level": "abc123"}
Response
{
  "data": {
    "triggerObservabilityTestAlert": {
      "alwaysNil": "xyz789"
    }
  }
}

updateExecutorSecret

Description

Update the value of an existing executor secret.

Response

Returns an ExecutorSecret!

Arguments
Name Description
scope - ExecutorSecretScope! The scope of the secret.
id - ID! The identifier of the secret that shall be updated.
value - String! The new secret value.

Example

Query
mutation updateExecutorSecret(
  $scope: ExecutorSecretScope!,
  $id: ID!,
  $value: String!
) {
  updateExecutorSecret(
    scope: $scope,
    id: $id,
    value: $value
  ) {
    id
    key
    scope
    overwritesGlobalSecret
    namespace {
      ...NamespaceFragment
    }
    creator {
      ...UserFragment
    }
    createdAt
    updatedAt
    accessLogs {
      ...ExecutorSecretAccessLogConnectionFragment
    }
  }
}
Variables
{
  "scope": "BATCHES",
  "id": 4,
  "value": "abc123"
}
Response
{
  "data": {
    "updateExecutorSecret": {
      "id": 4,
      "key": "xyz789",
      "scope": "BATCHES",
      "overwritesGlobalSecret": true,
      "namespace": Namespace,
      "creator": User,
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z",
      "accessLogs": ExecutorSecretAccessLogConnection
    }
  }
}

updateExternalService

Description

Updates a external service. Only site admins may perform this mutation.

Response

Returns an ExternalService!

Arguments
Name Description
input - UpdateExternalServiceInput!

Example

Query
mutation updateExternalService($input: UpdateExternalServiceInput!) {
  updateExternalService(input: $input) {
    id
    kind
    displayName
    config
    createdAt
    updatedAt
    repoCount
    webhookURL
    warning
    lastSyncError
    lastSyncAt
    nextSyncAt
    webhookLogs {
      ...WebhookLogConnectionFragment
    }
    syncJobs {
      ...ExternalServiceSyncJobConnectionFragment
    }
    checkConnection {
      ... on ExternalServiceAvailable {
        ...ExternalServiceAvailableFragment
      }
      ... on ExternalServiceUnavailable {
        ...ExternalServiceUnavailableFragment
      }
      ... on ExternalServiceAvailabilityUnknown {
        ...ExternalServiceAvailabilityUnknownFragment
      }
    }
    hasConnectionCheck
    supportsRepoExclusion
  }
}
Variables
{"input": UpdateExternalServiceInput}
Response
{
  "data": {
    "updateExternalService": {
      "id": 4,
      "kind": "AWSCODECOMMIT",
      "displayName": "abc123",
      "config": JSONCString,
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z",
      "repoCount": 987,
      "webhookURL": "abc123",
      "warning": "abc123",
      "lastSyncError": "abc123",
      "lastSyncAt": "2007-12-03T10:15:30Z",
      "nextSyncAt": "2007-12-03T10:15:30Z",
      "webhookLogs": WebhookLogConnection,
      "syncJobs": ExternalServiceSyncJobConnection,
      "checkConnection": ExternalServiceAvailable,
      "hasConnectionCheck": false,
      "supportsRepoExclusion": true
    }
  }
}

updateFeatureFlag

Description

(experimental) Update a feature flag

Response

Returns a FeatureFlag!

Arguments
Name Description
name - String! The name of the feature flag
value - Boolean The value of the feature flag. Only set if the new feature flag will be a concrete boolean flag. Mutually exclusive with rollout.
rolloutBasisPoints - Int The ratio of users the feature flag will apply to, expressed in basis points (0.01%). Mutually exclusive with value.

Example

Query
mutation updateFeatureFlag(
  $name: String!,
  $value: Boolean,
  $rolloutBasisPoints: Int
) {
  updateFeatureFlag(
    name: $name,
    value: $value,
    rolloutBasisPoints: $rolloutBasisPoints
  ) {
    ... on FeatureFlagBoolean {
      ...FeatureFlagBooleanFragment
    }
    ... on FeatureFlagRollout {
      ...FeatureFlagRolloutFragment
    }
  }
}
Variables
{
  "name": "xyz789",
  "value": false,
  "rolloutBasisPoints": 123
}
Response
{"data": {"updateFeatureFlag": FeatureFlagBoolean}}

updateFeatureFlagOverride

Description

Update a feature flag override

Response

Returns a FeatureFlagOverride!

Arguments
Name Description
id - ID! The ID of the feature flag override to update
value - Boolean! The updated value of the feature flag override

Example

Query
mutation updateFeatureFlagOverride(
  $id: ID!,
  $value: Boolean!
) {
  updateFeatureFlagOverride(
    id: $id,
    value: $value
  ) {
    id
    namespace {
      ...NamespaceFragment
    }
    targetFlag {
      ... on FeatureFlagBoolean {
        ...FeatureFlagBooleanFragment
      }
      ... on FeatureFlagRollout {
        ...FeatureFlagRolloutFragment
      }
    }
    value
  }
}
Variables
{"id": "4", "value": false}
Response
{
  "data": {
    "updateFeatureFlagOverride": {
      "id": "4",
      "namespace": Namespace,
      "targetFlag": FeatureFlagBoolean,
      "value": false
    }
  }
}

updateMirrorRepository

Description

Schedule the mirror repository to be updated from its original source repository. Updating occurs automatically, so this should not normally be needed.

Only site admins may perform this mutation.

Response

Returns an EmptyResponse!

Arguments
Name Description
repository - ID! The mirror repository to update.

Example

Query
mutation updateMirrorRepository($repository: ID!) {
  updateMirrorRepository(repository: $repository) {
    alwaysNil
  }
}
Variables
{"repository": 4}
Response
{
  "data": {
    "updateMirrorRepository": {
      "alwaysNil": "xyz789"
    }
  }
}

updateOrganization

Description

Updates an organization.

Only site admins and any member of the organization may perform this mutation.

Response

Returns an Org!

Arguments
Name Description
id - ID!
displayName - String

Example

Query
mutation updateOrganization(
  $id: ID!,
  $displayName: String
) {
  updateOrganization(
    id: $id,
    displayName: $displayName
  ) {
    executorSecrets {
      ...ExecutorSecretConnectionFragment
    }
    id
    name
    displayName
    createdAt
    members {
      ...NewUsersConnectionFragment
    }
    latestSettings {
      ...SettingsFragment
    }
    settingsCascade {
      ...SettingsCascadeFragment
    }
    configurationCascade {
      ...ConfigurationCascadeFragment
    }
    viewerPendingInvitation {
      ...OrganizationInvitationFragment
    }
    viewerCanAdminister
    viewerIsMember
    url
    settingsURL
    namespaceName
  }
}
Variables
{"id": 4, "displayName": "abc123"}
Response
{
  "data": {
    "updateOrganization": {
      "executorSecrets": ExecutorSecretConnection,
      "id": 4,
      "name": "abc123",
      "displayName": "abc123",
      "createdAt": "2007-12-03T10:15:30Z",
      "members": NewUsersConnection,
      "latestSettings": Settings,
      "settingsCascade": SettingsCascade,
      "configurationCascade": ConfigurationCascade,
      "viewerPendingInvitation": OrganizationInvitation,
      "viewerCanAdminister": true,
      "viewerIsMember": false,
      "url": "xyz789",
      "settingsURL": "abc123",
      "namespaceName": "abc123"
    }
  }
}

updatePassword

Description

Updates the current user's password. The oldPassword arg must match the user's current password.

Response

Returns an EmptyResponse

Arguments
Name Description
oldPassword - String!
newPassword - String!

Example

Query
mutation updatePassword(
  $oldPassword: String!,
  $newPassword: String!
) {
  updatePassword(
    oldPassword: $oldPassword,
    newPassword: $newPassword
  ) {
    alwaysNil
  }
}
Variables
{
  "oldPassword": "xyz789",
  "newPassword": "xyz789"
}
Response
{
  "data": {
    "updatePassword": {
      "alwaysNil": "abc123"
    }
  }
}

updateRepoKeyValuePair

Description

Update a key-value pair associated with a repo.

Response

Returns an EmptyResponse!

Arguments
Name Description
repo - ID!
key - String!
value - String

Example

Query
mutation updateRepoKeyValuePair(
  $repo: ID!,
  $key: String!,
  $value: String
) {
  updateRepoKeyValuePair(
    repo: $repo,
    key: $key,
    value: $value
  ) {
    alwaysNil
  }
}
Variables
{
  "repo": "4",
  "key": "xyz789",
  "value": "abc123"
}
Response
{
  "data": {
    "updateRepoKeyValuePair": {
      "alwaysNil": "abc123"
    }
  }
}

updateSavedSearch

Description

Updates a saved search

Response

Returns a SavedSearch!

Arguments
Name Description
id - ID!
description - String!
query - String!
notifyOwner - Boolean!
notifySlack - Boolean!
orgID - ID
userID - ID

Example

Query
mutation updateSavedSearch(
  $id: ID!,
  $description: String!,
  $query: String!,
  $notifyOwner: Boolean!,
  $notifySlack: Boolean!,
  $orgID: ID,
  $userID: ID
) {
  updateSavedSearch(
    id: $id,
    description: $description,
    query: $query,
    notifyOwner: $notifyOwner,
    notifySlack: $notifySlack,
    orgID: $orgID,
    userID: $userID
  ) {
    id
    description
    query
    notify
    notifySlack
    namespace {
      ...NamespaceFragment
    }
    slackWebhookURL
  }
}
Variables
{
  "id": "4",
  "description": "abc123",
  "query": "abc123",
  "notifyOwner": true,
  "notifySlack": false,
  "orgID": "4",
  "userID": "4"
}
Response
{
  "data": {
    "updateSavedSearch": {
      "id": "4",
      "description": "xyz789",
      "query": "abc123",
      "notify": false,
      "notifySlack": true,
      "namespace": Namespace,
      "slackWebhookURL": "xyz789"
    }
  }
}

updateSiteConfiguration

Description

Updates the site configuration. Returns whether or not a restart is required for the update to be applied.

Only site admins may perform this mutation.

Response

Returns a Boolean!

Arguments
Name Description
lastID - Int! The last ID of the site configuration that is known by the client, to prevent race conditions. An error will be returned if someone else has already written a new update.
input - String! A JSON object containing the entire site configuration. The previous site configuration will be replaced with this new value.

Example

Query
mutation updateSiteConfiguration(
  $lastID: Int!,
  $input: String!
) {
  updateSiteConfiguration(
    lastID: $lastID,
    input: $input
  )
}
Variables
{"lastID": 123, "input": "abc123"}
Response
{"data": {"updateSiteConfiguration": false}}

updateTeam

Description

Update an existing team. ID or Name must be specified, but not both.

To unset the display name, pass an empty string. Null will make it ignore updates.

Either parentTeam XOR parentTeamName can be specified to make the team a child team of the given parent. The user has to be a team-member of both the child and parent team for that, and neither can be read-only. Site-admin can modify all teams without constraints.

Response

Returns a Team!

Arguments
Name Description
id - ID
name - String
displayName - String
parentTeam - ID
parentTeamName - String

Example

Query
mutation updateTeam(
  $id: ID,
  $name: String,
  $displayName: String,
  $parentTeam: ID,
  $parentTeamName: String
) {
  updateTeam(
    id: $id,
    name: $name,
    displayName: $displayName,
    parentTeam: $parentTeam,
    parentTeamName: $parentTeamName
  ) {
    id
    name
    url
    displayName
    readonly
    members {
      ...TeamMemberConnectionFragment
    }
    parentTeam {
      ...TeamFragment
    }
    childTeams {
      ...TeamConnectionFragment
    }
    viewerCanAdminister
  }
}
Variables
{
  "id": 4,
  "name": "abc123",
  "displayName": "xyz789",
  "parentTeam": 4,
  "parentTeamName": "xyz789"
}
Response
{
  "data": {
    "updateTeam": {
      "id": 4,
      "name": "abc123",
      "url": "abc123",
      "displayName": "abc123",
      "readonly": false,
      "members": TeamMemberConnection,
      "parentTeam": Team,
      "childTeams": TeamConnection,
      "viewerCanAdminister": true
    }
  }
}

updateUser

Description

Updates the user profile information for the user with the given ID.

Only the user and site admins may perform this mutation.

Response

Returns a User!

Arguments
Name Description
user - ID!
username - String
displayName - String
avatarURL - String

Example

Query
mutation updateUser(
  $user: ID!,
  $username: String,
  $displayName: String,
  $avatarURL: String
) {
  updateUser(
    user: $user,
    username: $username,
    displayName: $displayName,
    avatarURL: $avatarURL
  ) {
    executorSecrets {
      ...ExecutorSecretConnectionFragment
    }
    id
    username
    email
    displayName
    avatarURL
    url
    settingsURL
    createdAt
    updatedAt
    siteAdmin
    builtinAuth
    latestSettings {
      ...SettingsFragment
    }
    settingsCascade {
      ...SettingsCascadeFragment
    }
    configurationCascade {
      ...ConfigurationCascadeFragment
    }
    organizations {
      ...OrgConnectionFragment
    }
    organizationMemberships {
      ...OrganizationMembershipConnectionFragment
    }
    tags
    tosAccepted
    searchable
    usageStatistics {
      ...UserUsageStatisticsFragment
    }
    eventLogs {
      ...EventLogsConnectionFragment
    }
    emails {
      ...UserEmailFragment
    }
    accessTokens {
      ...AccessTokenConnectionFragment
    }
    externalAccounts {
      ...ExternalAccountConnectionFragment
    }
    session {
      ...SessionFragment
    }
    viewerCanAdminister
    viewerCanChangeUsername
    surveyResponses {
      ...SurveyResponseFragment
    }
    databaseID
    namespaceName
    invitableCollaborators {
      ...PersonFragment
    }
    teams {
      ...TeamConnectionFragment
    }
  }
}
Variables
{
  "user": 4,
  "username": "xyz789",
  "displayName": "abc123",
  "avatarURL": "abc123"
}
Response
{
  "data": {
    "updateUser": {
      "executorSecrets": ExecutorSecretConnection,
      "id": 4,
      "username": "xyz789",
      "email": "xyz789",
      "displayName": "abc123",
      "avatarURL": "abc123",
      "url": "abc123",
      "settingsURL": "abc123",
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z",
      "siteAdmin": true,
      "builtinAuth": true,
      "latestSettings": Settings,
      "settingsCascade": SettingsCascade,
      "configurationCascade": ConfigurationCascade,
      "organizations": OrgConnection,
      "organizationMemberships": OrganizationMembershipConnection,
      "tags": ["xyz789"],
      "tosAccepted": false,
      "searchable": true,
      "usageStatistics": UserUsageStatistics,
      "eventLogs": EventLogsConnection,
      "emails": [UserEmail],
      "accessTokens": AccessTokenConnection,
      "externalAccounts": ExternalAccountConnection,
      "session": Session,
      "viewerCanAdminister": false,
      "viewerCanChangeUsername": false,
      "surveyResponses": [SurveyResponse],
      "databaseID": 123,
      "namespaceName": "abc123",
      "invitableCollaborators": [Person],
      "teams": TeamConnection
    }
  }
}

updateWebhook

Description

Updates a webhook with given ID. Null values aren't updated.

Response

Returns a Webhook!

Arguments
Name Description
id - ID!
name - String
codeHostKind - String
codeHostURN - String
secret - String

Example

Query
mutation updateWebhook(
  $id: ID!,
  $name: String,
  $codeHostKind: String,
  $codeHostURN: String,
  $secret: String
) {
  updateWebhook(
    id: $id,
    name: $name,
    codeHostKind: $codeHostKind,
    codeHostURN: $codeHostURN,
    secret: $secret
  ) {
    id
    uuid
    url
    name
    codeHostKind
    codeHostURN
    secret
    updatedAt
    updatedBy {
      ...UserFragment
    }
    createdAt
    createdBy {
      ...UserFragment
    }
    webhookLogs {
      ...WebhookLogConnectionFragment
    }
  }
}
Variables
{
  "id": 4,
  "name": "xyz789",
  "codeHostKind": "xyz789",
  "codeHostURN": "xyz789",
  "secret": "xyz789"
}
Response
{
  "data": {
    "updateWebhook": {
      "id": "4",
      "uuid": "xyz789",
      "url": "abc123",
      "name": "xyz789",
      "codeHostKind": "AWSCODECOMMIT",
      "codeHostURN": "abc123",
      "secret": "xyz789",
      "updatedAt": "2007-12-03T10:15:30Z",
      "updatedBy": User,
      "createdAt": "2007-12-03T10:15:30Z",
      "createdBy": User,
      "webhookLogs": WebhookLogConnection
    }
  }
}

Types

AccessToken

Description

An access token that grants to the holder the privileges of the user who created it.

Fields
Field Name Description
id - ID! The unique ID for the access token.
subject - User! The user whose privileges the access token grants.
scopes - [String!]! The scopes that define the allowed set of operations that can be performed using this access token.
note - String! A user-supplied descriptive note for the access token.
creator - User! The user who created the access token. This is either the subject user (if the access token was created by the same user) or a site admin (who can create access tokens for any user).
createdAt - DateTime! The date when the access token was created.
lastUsedAt - DateTime The date when the access token was last used to authenticate a request.
Example
{
  "id": 4,
  "subject": User,
  "scopes": ["abc123"],
  "note": "xyz789",
  "creator": User,
  "createdAt": "2007-12-03T10:15:30Z",
  "lastUsedAt": "2007-12-03T10:15:30Z"
}

AccessTokenConnection

Description

A list of access tokens.

Fields
Field Name Description
nodes - [AccessToken!]! A list of access tokens.
totalCount - Int! The total count of access tokens in the connection. This total count may be larger than the number of nodes in this object when the result is paginated.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [AccessToken],
  "totalCount": 987,
  "pageInfo": PageInfo
}

AddExternalServiceInput

Description

A new external service.

Fields
Input Field Description
kind - ExternalServiceKind! The kind of the external service.
displayName - String! The display name of the external service.
config - String! The JSON configuration of the external service.
namespace - ID The namespace this external service belongs to. This can be used both for a user and an organization.
Example
{
  "kind": "AWSCODECOMMIT",
  "displayName": "abc123",
  "config": "abc123",
  "namespace": 4
}

Alert

Description

An alert message shown to the viewer.

Fields
Field Name Description
type - AlertType! The type of this alert.
message - String! The message body of this alert. Markdown is supported.
isDismissibleWithKey - String If set, this alert is dismissible. After being dismissed, no other alerts with the same isDismissibleWithKey value will be shown. If null, this alert is not dismissible.
Example
{
  "type": "INFO",
  "message": "abc123",
  "isDismissibleWithKey": "abc123"
}

AlertType

Description

The possible types of alerts (Alert.type values).

Values
Enum Value Description

INFO

WARNING

ERROR

Example
"INFO"

Analytics

Description

Analytics describes a new site statistics.

Fields
Field Name Description
search - AnalyticsSearchResult! Search statistics.
Arguments
dateRange - AnalyticsDateRange
grouping - AnalyticsGrouping
notebooks - AnalyticsNotebooksResults! Notebooks statistics.
Arguments
dateRange - AnalyticsDateRange
grouping - AnalyticsGrouping
users - AnalyticsUsersResult! Users statistics.
Arguments
dateRange - AnalyticsDateRange
grouping - AnalyticsGrouping
codeIntel - AnalyticsCodeIntelResult! Code-intelligence statistics.
Arguments
dateRange - AnalyticsDateRange
grouping - AnalyticsGrouping
codeIntelByLanguage - [AnalyticsCodeIntelByLanguageResult!]! Code-intelligence statistics grouped by language and precision.
Arguments
dateRange - AnalyticsDateRange
codeIntelTopRepositories - [AnalyticsCodeIntelRepositoryResult!]! Top repositories by code-intelligence events.
Arguments
dateRange - AnalyticsDateRange
repos - AnalyticsReposSummartResult! Repositories summary statistics.
batchChanges - AnalyticsBatchChangesResult! Batch changes statistics
Arguments
dateRange - AnalyticsDateRange
grouping - AnalyticsGrouping
extensions - AnalyticsExtensionsResult! Extensions statistics
Arguments
dateRange - AnalyticsDateRange
grouping - AnalyticsGrouping
codeInsights - AnalyticsCodesInsightsResult! Code insights statistics
Arguments
dateRange - AnalyticsDateRange
grouping - AnalyticsGrouping
Example
{
  "search": AnalyticsSearchResult,
  "notebooks": AnalyticsNotebooksResults,
  "users": AnalyticsUsersResult,
  "codeIntel": AnalyticsCodeIntelResult,
  "codeIntelByLanguage": [
    AnalyticsCodeIntelByLanguageResult
  ],
  "codeIntelTopRepositories": [
    AnalyticsCodeIntelRepositoryResult
  ],
  "repos": AnalyticsReposSummartResult,
  "batchChanges": AnalyticsBatchChangesResult,
  "extensions": AnalyticsExtensionsResult,
  "codeInsights": AnalyticsCodesInsightsResult
}

AnalyticsBatchChangesResult

Description

Batch changes analytics.

Fields
Field Name Description
changesetsCreated - AnalyticsStatItem! Changesets created
changesetsMerged - AnalyticsStatItem! Changesets merged
Example
{
  "changesetsCreated": AnalyticsStatItem,
  "changesetsMerged": AnalyticsStatItem
}

AnalyticsCodeIntelByLanguageResult

Description

CodeIntelByLanguage analytics.

Fields
Field Name Description
language - String! Language
precision - String! Precision
count - Float! Count
Example
{
  "language": "abc123",
  "precision": "xyz789",
  "count": 123.45
}

AnalyticsCodeIntelRepositoryResult

Description

CodeIntelTopRepositories analytics.

Fields
Field Name Description
name - String! Repository name
language - String! Language
kind - String! Event kind
precision - String! Event precision (either "search-based" or "precise")
events - Float! Event count
hasPrecise - Boolean! Has precise
Example
{
  "name": "abc123",
  "language": "xyz789",
  "kind": "abc123",
  "precision": "xyz789",
  "events": 987.65,
  "hasPrecise": false
}

AnalyticsCodeIntelResult

Description

CodeIntel' analytics.

Fields
Field Name Description
referenceClicks - AnalyticsStatItem! "GoToRef" click
definitionClicks - AnalyticsStatItem! "GoToDef" click
inAppEvents - AnalyticsStatItem! Code Intel events made from web
codeHostEvents - AnalyticsStatItem! Code Intel events made from code host
searchBasedEvents - AnalyticsStatItem! Search based events
preciseEvents - AnalyticsStatItem! Precise events
crossRepoEvents - AnalyticsStatItem! Cross-repo events
Example
{
  "referenceClicks": AnalyticsStatItem,
  "definitionClicks": AnalyticsStatItem,
  "inAppEvents": AnalyticsStatItem,
  "codeHostEvents": AnalyticsStatItem,
  "searchBasedEvents": AnalyticsStatItem,
  "preciseEvents": AnalyticsStatItem,
  "crossRepoEvents": AnalyticsStatItem
}

AnalyticsCodesInsightsResult

Description

Code insights analytics.

Fields
Field Name Description
insightHovers - AnalyticsStatItem! Insights hovers statistics.
insightDataPointClicks - AnalyticsStatItem! Insights data point clicks statistics.
Example
{
  "insightHovers": AnalyticsStatItem,
  "insightDataPointClicks": AnalyticsStatItem
}

AnalyticsDateRange

Description

A pre-defined periods to get site analytics.

Values
Enum Value Description

LAST_THREE_MONTHS

Last 3 months date range.

LAST_MONTH

Last month date range.

LAST_WEEK

Last week date range.

CUSTOM

Custom date range.
Example
"LAST_THREE_MONTHS"

AnalyticsExtensionsResult

Description

Extentions analytics.

Fields
Field Name Description
jetbrains - AnalyticsStatItem! JetBrains IDE plugin search events.
vscode - AnalyticsStatItem! VSCode IDE extension search events.
browser - AnalyticsStatItem! Browser (chrome, firefox, safari) extensions code navigation events. This includes events like "Go to Def", "Find ref" and "Find implementation"
Example
{
  "jetbrains": AnalyticsStatItem,
  "vscode": AnalyticsStatItem,
  "browser": AnalyticsStatItem
}

AnalyticsGrouping

Description

Group site analytics by period.

Values
Enum Value Description

DAILY

Group data by day.

WEEKLY

Group data by week.
Example
"DAILY"

AnalyticsMonthlyActiveUsers

Description

Monthly active users

Fields
Field Name Description
date - String! year-month for which the total active users are calculated
count - Float! total count of active users
Example
{"date": "xyz789", "count": 123.45}

AnalyticsNotebooksResults

Description

Notebook analytics.

Fields
Field Name Description
creations - AnalyticsStatItem! Notebooks creation analytics.
views - AnalyticsStatItem! Notebooks views analytics.
blockRuns - AnalyticsStatItem! Notebooks block run analytics.
Example
{
  "creations": AnalyticsStatItem,
  "views": AnalyticsStatItem,
  "blockRuns": AnalyticsStatItem
}

AnalyticsReposSummartResult

Description

Repositories summary.

Fields
Field Name Description
count - Float! Total number of repositories.
preciseCodeIntelCount - Float! Total number of repositories with precise code-intel.
Example
{"count": 123.45, "preciseCodeIntelCount": 987.65}

AnalyticsSearchResult

Description

Search analytics.

Fields
Field Name Description
searches - AnalyticsStatItem! Searches analytics
resultClicks - AnalyticsStatItem! Search result click analytics
fileViews - AnalyticsStatItem! File view analytics
fileOpens - AnalyticsStatItem! File open analytics
codeCopied - AnalyticsStatItem! Code copied from search results analytics
Example
{
  "searches": AnalyticsStatItem,
  "resultClicks": AnalyticsStatItem,
  "fileViews": AnalyticsStatItem,
  "fileOpens": AnalyticsStatItem,
  "codeCopied": AnalyticsStatItem
}

AnalyticsStatItem

Description

Analytics result item.

Fields
Field Name Description
summary - AnalyticsStatItemSummary! Analytics summary.
nodes - [AnalyticsStatItemNode!]! Array of analytics by period.
Example
{
  "summary": AnalyticsStatItemSummary,
  "nodes": [AnalyticsStatItemNode]
}

AnalyticsStatItemNode

Description

Analytics for certain date.

Fields
Field Name Description
date - String! A date in ISO format
count - Float! Total number of events.
uniqueUsers - Float! Unique number of users who triggered event. This counts deleted users as well as anonymous users.
registeredUsers - Float! Unique number of currently registered users who triggered event.
Example
{
  "date": "xyz789",
  "count": 987.65,
  "uniqueUsers": 123.45,
  "registeredUsers": 987.65
}

AnalyticsStatItemSummary

Description

Analytics summary.

Fields
Field Name Description
totalCount - Float! Total number of events.
totalUniqueUsers - Float! Total unique number of users who triggered event. This counts deleted users as well as anonymous users.
totalRegisteredUsers - Float! Total unique number of currently registered users who triggered event.
Example
{
  "totalCount": 123.45,
  "totalUniqueUsers": 123.45,
  "totalRegisteredUsers": 123.45
}

AnalyticsUsersFrequencyItem

Description

Users frequency by days used.

Fields
Field Name Description
daysUsed - Float! Number of days used
frequency - Float! Number of users.
percentage - Float! Percentage of users from total frequencies.
Example
{"daysUsed": 123.45, "frequency": 987.65, "percentage": 987.65}

AnalyticsUsersResult

Description

Users' analytics.

Fields
Field Name Description
activity - AnalyticsStatItem! Users' activity analytics.
frequencies - [AnalyticsUsersFrequencyItem!]! Frequency of usage by day.
monthlyActiveUsers - [AnalyticsMonthlyActiveUsers!]! Monthly active users for last 3 months.
Example
{
  "activity": AnalyticsStatItem,
  "frequencies": [AnalyticsUsersFrequencyItem],
  "monthlyActiveUsers": [AnalyticsMonthlyActiveUsers]
}

AuthProvider

Description

A provider of user authentication, such as an external single-sign-on service (e.g., using OpenID Connect or SAML). The provider information in this type is visible to all viewers and does not contain any secret values.

Fields
Field Name Description
serviceType - String! The type of the auth provider.
serviceID - String! An identifier for the service that the auth provider represents.
clientID - String! An identifier for the client of the service that the auth provider represents.
displayName - String! The human-readable name of the provider.
isBuiltin - Boolean! Whether this auth provider is the builtin username-password auth provider.
authenticationURL - String A URL that, when visited, initiates the authentication process for this auth provider.
Example
{
  "serviceType": "xyz789",
  "serviceID": "xyz789",
  "clientID": "xyz789",
  "displayName": "xyz789",
  "isBuiltin": false,
  "authenticationURL": "abc123"
}

AuthProviderConnection

Description

A list of authentication providers.

Fields
Field Name Description
nodes - [AuthProvider!]! A list of authentication providers.
totalCount - Int! The total count of authentication providers in the connection. This total count may be larger than the number of nodes in this object when the result is paginated.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [AuthProvider],
  "totalCount": 123,
  "pageInfo": PageInfo
}

AutocompleteMemberSearchItem

Description

Result user returned by invite members autocomplete search.

Fields
Field Name Description
id - ID! The unique ID for the user.
username - String! The user's username.
displayName - String The display name chosen by the user.
avatarURL - String The URL of the user's avatar image.
inOrg - Boolean If the user belongs to current Organization.
Example
{
  "id": 4,
  "username": "xyz789",
  "displayName": "abc123",
  "avatarURL": "xyz789",
  "inOrg": true
}

BackgroundJob

Description

A single background job.

Fields
Field Name Description
id - ID! The background job ID.
name - String! The name of the job.
routines - [BackgroundRoutine!]! The routines that run inside this job.
Example
{
  "id": "4",
  "name": "xyz789",
  "routines": [BackgroundRoutine]
}

BackgroundJobConnection

Description

A list of background jobs that are currently known in the system

Fields
Field Name Description
nodes - [BackgroundJob!]! A list of outbound requests.
totalCount - Int! The total number of outbound request log items in the connection.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [BackgroundJob],
  "totalCount": 123,
  "pageInfo": PageInfo
}

BackgroundRoutine

Description

A routine that runs inside a background job.

Fields
Field Name Description
name - String! The name of the routine.
type - BackgroundRoutineType! Tells whether this is a periodic goroutine, a DB worker, or something else
description - String! Explains what the routine does.
intervalMs - Int The interval at which the routine runs, if it's periodic.
instances - [BackgroundRoutineInstance!]! The instances of this routine that are running or ran recently. An instance means one routine on one host.
recentRuns - [BackgroundRoutineRecentRun!]! The recent runs of this routine.
stats - BackgroundRoutineStats! Some stats of the runs of this routine in the past few days.
Example
{
  "name": "abc123",
  "type": "PERIODIC",
  "description": "abc123",
  "intervalMs": 987,
  "instances": [BackgroundRoutineInstance],
  "recentRuns": [BackgroundRoutineRecentRun],
  "stats": BackgroundRoutineStats
}

BackgroundRoutineInstance

Description

One instance of the background routine, running on a host.

Fields
Field Name Description
hostName - String! The ID of the instance.
lastStartedAt - DateTime The time the instance was last started. (If it's unknown, this will be null.)
lastStoppedAt - DateTime The time the instance was last stopped. (If it's unknown, this will be null.)
Example
{
  "hostName": "abc123",
  "lastStartedAt": "2007-12-03T10:15:30Z",
  "lastStoppedAt": "2007-12-03T10:15:30Z"
}

BackgroundRoutineRecentRun

Description

A single run of the routine. A run is not the start/stop event but the actual execution of the routine handler.

Fields
Field Name Description
at - DateTime! The time the run started.
hostName - String! The name of the host that ran the routine.
durationMs - Int! The duration of the run.
errorMessage - String The error message, if any.
Example
{
  "at": "2007-12-03T10:15:30Z",
  "hostName": "xyz789",
  "durationMs": 123,
  "errorMessage": "xyz789"
}

BackgroundRoutineStats

Description

Holds statistics about a background routine.

Fields
Field Name Description
since - DateTime The start of the earliest day for which we have any runs registered.
runCount - Int! The number of times the routine ran in the period.
errorCount - Int! The number of times the routine run ended with an error.
minDurationMs - Int! The minimum duration of a run, in milliseconds.
avgDurationMs - Int! The average duration of a run, in milliseconds.
maxDurationMs - Int! The maximum duration of a run, in milliseconds.
Example
{
  "since": "2007-12-03T10:15:30Z",
  "runCount": 123,
  "errorCount": 123,
  "minDurationMs": 123,
  "avgDurationMs": 123,
  "maxDurationMs": 123
}

BackgroundRoutineType

Description

Enum of the possible background routine types

Values
Enum Value Description

PERIODIC

Periodic routine

PERIODIC_WITH_METRICS

Periodic routine with metrics set up

DB_BACKED

DB-backed worker

CUSTOM

Custom routine
Example
"PERIODIC"

BehindAheadCounts

Description

A set of Git behind/ahead counts for one commit relative to another.

Fields
Field Name Description
behind - Int! The number of commits behind the other commit.
ahead - Int! The number of commits ahead of the other commit.
Example
{"behind": 987, "ahead": 123}

BidirectionalPageInfo

Description

Pagination information for bi-directional pagination. See https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo.

Fields
Field Name Description
startCursor - String When paginating backwards, the cursor to continue.
endCursor - String When paginating forwards, the cursor to continue.
hasPreviousPage - Boolean! When paginating backwards, are there more items?
hasNextPage - Boolean! When paginating forwards, are there more items?
Example
{
  "startCursor": "xyz789",
  "endCursor": "abc123",
  "hasPreviousPage": true,
  "hasNextPage": false
}

BigInt

Description

An arbitrarily large integer encoded as a decimal string.

Example
{}

Boolean

Description

The Boolean scalar type represents true or false.

CheckMirrorRepositoryConnectionResult

Description

The result for Mutation.checkMirrorRepositoryConnection.

Fields
Field Name Description
error - String The error message encountered during the update operation, if any. If null, then the connection check succeeded.
Example
{"error": "abc123"}

ChunkMatch

Description

A set of matched ranges contained in a chunk of contiguous lines.

Fields
Field Name Description
content - String! The contiguous set of full lines which contain the matches in ranges.
contentStart - Position! The location of the beginning of content.
ranges - [Range!]! The set of ranges within the content that matched the search query.
Example
{
  "content": "xyz789",
  "contentStart": Position,
  "ranges": [Range]
}

ClientConfigurationDetails

Description

Configuration details for the browser extension, editor extensions, etc.

Fields
Field Name Description
contentScriptUrls - [String!]! The list of phabricator/gitlab/bitbucket/etc instance URLs that specifies which pages the content script will be injected into.
parentSourcegraph - ParentSourcegraphDetails! Returns details about the parent Sourcegraph instance.
Example
{
  "contentScriptUrls": ["xyz789"],
  "parentSourcegraph": ParentSourcegraphDetails
}

CloneStatus

Description

The clone status of a repository.

Values
Enum Value Description

NOT_CLONED

CLONING

CLONED

Example
"NOT_CLONED"

CloningProgress

Description

FOR INTERNAL USE ONLY: A status message produced when repositories are being cloned

Fields
Field Name Description
message - String! The message of this status message
Example
{"message": "abc123"}

CodeIntelCommit

Description

A Code Intel Commit.

Fields
Field Name Description
id - ID! The globally addressable ID for this commit.
oid - GitObjectID! This commit's Git object ID (OID), a 40-character SHA-1 hash.
abbreviatedOID - String! The abbreviated form of this commit's OID.
url - String! The URL to this commit (using the input revision specifier, which may not be immutable).
repository - CodeIntelRepository! The repository that contains this commit.
Example
{
  "id": "4",
  "oid": GitObjectID,
  "abbreviatedOID": "xyz789",
  "url": "xyz789",
  "repository": CodeIntelRepository
}

CodeIntelExternalRepository

Description

A repository on an external service (such as GitHub, GitLab, Phabricator, etc.).

Fields
Field Name Description
serviceType - String! The type of external service where this repository resides. Example: "github", "gitlab", etc.
serviceID - String! The particular instance of the external service where this repository resides. Its value is opaque but typically consists of the canonical base URL to the service. Example: For GitHub.com, this is "https://github.com/".
Example
{
  "serviceType": "xyz789",
  "serviceID": "xyz789"
}

CodeIntelGitBlob

Description

A gitblob resolver specific to code intel.

Fields
Field Name Description
path - String! The full path (relative to the root) of this tree.
name - String! The base name (i.e., last path component only) of this tree.
commit - CodeIntelCommit! The Git commit containing this tree.
url - String! The URL to this tree (using the input revision specifier, which may not be immutable).
repository - CodeIntelRepository! The repository containing this tree.
content - String! The content of this blob.
Arguments
startLine - Int

Return file content starting at line "startLine". A value <= 0 will be the start of the file.

endLine - Int

Return file content ending at line "endLine". A value < 0 or > totalLines will set endLine to the end of the file.

Example
{
  "path": "xyz789",
  "name": "abc123",
  "commit": CodeIntelCommit,
  "url": "abc123",
  "repository": CodeIntelRepository,
  "content": "abc123"
}

CodeIntelRepository

Description

A codeintel repository is a Git source control repository that is mirrored from some origin code host and it is specific to code intel.

Fields
Field Name Description
id - ID! The globally addressable ID for this commit.
name - String!

The repository's name, as a path with one or more components. It conventionally consists of the repository's hostname and path (joined by "/"), minus any suffixes (such as ".git"). Examples:

  • github.com/foo/bar
  • my-code-host.example.com/myrepo
  • myrepo
url - String! The URL to this repository.
externalRepository - CodeIntelExternalRepository Information about this repository from the external service that it originates from (such as GitHub, GitLab, Phabricator, etc.). Only populated when used as part of repository list previews for configuration policies.
Example
{
  "id": 4,
  "name": "xyz789",
  "url": "xyz789",
  "externalRepository": CodeIntelExternalRepository
}

CodeIntelligenceCommitGraph

Description

Information and status related to the commit graph of this repository calculated for use by code intelligence features.

Fields
Field Name Description
stale - Boolean! Whether or not the commit graph needs to be updated.
updatedAt - DateTime When, if ever, the commit graph was last refreshed.
Example
{
  "stale": true,
  "updatedAt": "2007-12-03T10:15:30Z"
}

CommitSearchResult

Description

A search result that is a Git commit.

Fields
Field Name Description
label - Markdown! A markdown string that is rendered prominently.
url - String! The URL of the result.
detail - Markdown! A markdown string of that is rendered less prominently.
matches - [SearchResultMatch!]! The result previews of the result.
commit - GitCommit! The commit that matched the search query.
refs - [GitRef!]! The ref names of the commit.
sourceRefs - [GitRef!]! The refs by which this commit was reached.
messagePreview - HighlightedString The matching portion of the commit message, if any.
diffPreview - HighlightedString The matching portion of the diff, if any.
Example
{
  "label": Markdown,
  "url": "abc123",
  "detail": Markdown,
  "matches": [SearchResultMatch],
  "commit": GitCommit,
  "refs": [GitRef],
  "sourceRefs": [GitRef],
  "messagePreview": HighlightedString,
  "diffPreview": HighlightedString
}

Configuration

Description

DEPRECATED: Use the contents field on the parent type instead. This type will be removed in a future release.

Fields
Field Name Description
contents - JSONCString! DEPRECATED: This field will be removed in a future release. The raw JSON contents, encoded as a string. use the contents field on the parent type instead
messages - [String!]! DEPRECATED: This field is always empty. It will be removed in a future release. use client-side JSON Schema validation instead
Example
{
  "contents": JSONCString,
  "messages": ["xyz789"]
}

ConfigurationCascade

Description

DEPRECATED: Renamed to SettingsCascade.

Fields
Field Name Description
subjects - [SettingsSubject!]! DEPRECATED use SettingsCascade.subjects instead
merged - Configuration! DEPRECATED use SettingsCascade.final instead
Example
{
  "subjects": [SettingsSubject],
  "merged": Configuration
}

ConfigurationEdit

Description

DEPRECATED: This type was renamed to SettingsEdit. NOTE: GraphQL does not support @deprecated directives on INPUT_FIELD_DEFINITION (input fields).

Fields
Input Field Description
keyPath - [KeyPathSegment!]! DEPRECATED
value - JSONValue DEPRECATED
valueIsJSONCEncodedString - Boolean DEPRECATED. Default = false
Example
{
  "keyPath": [KeyPathSegment],
  "value": JSONValue,
  "valueIsJSONCEncodedString": true
}

Connection

Description

An object with totalCount and PageInfo.

Fields
Field Name Description
totalCount - Int! The total count of items in the connection.
pageInfo - ConnectionPageInfo! The pagination info for the connection.
Example
{"totalCount": 987, "pageInfo": ConnectionPageInfo}

ConnectionPageInfo

Description

Pagination information.

Fields
Field Name Description
endCursor - String When paginating forwards, the cursor to continue.
hasNextPage - Boolean! When paginating forwards, are there more items?
startCursor - String When paginating backward, the cursor to continue.
hasPreviousPage - Boolean! When paginating backward, are there more items?
Example
{
  "endCursor": "abc123",
  "hasNextPage": true,
  "startCursor": "abc123",
  "hasPreviousPage": true
}

CreateAccessTokenResult

Description

The result for Mutation.createAccessToken.

Fields
Field Name Description
id - ID! The ID of the newly created access token.
token - String! The secret token value that is used to authenticate API clients. The caller is responsible for storing this value.
Example
{
  "id": "4",
  "token": "xyz789"
}

CreateUserResult

Description

The result for Mutation.createUser.

Fields
Field Name Description
user - User! The new user.
resetPasswordURL - String

The reset password URL that the new user must visit to sign into their account. If the builtin username-password authentication provider is not enabled, this field's value is null.

If email sending (SMTP) is configured on this instance and an email was provided, an email containing this URL will also be sent to the primary email address associated with the user.

Example
{
  "user": User,
  "resetPasswordURL": "abc123"
}

DateTime

Description

An RFC 3339-encoded UTC date string, such as 1973-11-29T21:33:09Z. This value can be parsed into a JavaScript Date using Date.parse. To produce this value from a JavaScript Date instance, use Date#toISOString.

Example
"2007-12-03T10:15:30Z"

DefaultSettings

Description

The default settings for the Sourcegraph instance. This is hardcoded in Sourcegraph, but may change from release to release.

Fields
Field Name Description
id - ID! The opaque GraphQL ID.
latestSettings - Settings The latest default settings (this never changes).
settingsURL - String The URL to the default settings. This URL does not exist because you cannot edit or directly view default settings.
viewerCanAdminister - Boolean! Whether the viewer can modify the subject's settings. Always false for default settings.
settingsCascade - SettingsCascade! The default settings, and the final merged settings. All viewers can access this field.
configurationCascade - ConfigurationCascade! DEPRECATED Use settingsCascade instead. This field is a deprecated alias for it and will be removed in a future release.
Example
{
  "id": 4,
  "latestSettings": Settings,
  "settingsURL": "xyz789",
  "viewerCanAdminister": true,
  "settingsCascade": SettingsCascade,
  "configurationCascade": ConfigurationCascade
}

DiffHunkLineType

Description

The type of content in a hunk line.

Values
Enum Value Description

ADDED

Added line.

UNCHANGED

Unchanged line.

DELETED

Deleted line.
Example
"ADDED"

DiffStat

Description

Statistics about a diff.

Fields
Field Name Description
added - Int! Number of lines added.
deleted - Int! Number of lines deleted.
Example
{"added": 987, "deleted": 987}

EmptyResponse

Description

Represents a null return value.

Fields
Field Name Description
alwaysNil - String A dummy null value.
Example
{"alwaysNil": "abc123"}

EvaluatedFeatureFlag

Description

An evaluated feature flag is any feature flag (static or random) that has been evaluated to a concrete value for a given viewer.

Fields
Field Name Description
name - String! The name of the feature flag
value - Boolean! The concrete evaluated value of the feature flag
Example
{"name": "xyz789", "value": false}

Event

Description

A description of a user event.

Fields
Input Field Description
event - String! The name of the event.
userCookieID - String! The randomly generated unique user ID stored in a browser cookie.
firstSourceURL - String The first sourcegraph URL visited by the user, stored in a browser cookie.
lastSourceURL - String The last sourcegraph URL visited by the user, stored in a browser cookie.
url - String! The URL when the event was logged.
source - EventSource! The source of the event.
cohortID - String An optional cohort ID to identify the user as part of a specific A/B test. The cohort ID is expected to be a date in the form YYYY-MM-DD
referrer - String An optional referrer parameter for the user's current session. Only captured and stored on Sourcegraph Cloud.
originalReferrer - String The original referrer for a user
sessionReferrer - String The session referrer for a user
sessionFirstURL - String The sessions first url for a user
deviceSessionID - String Device session ID to identify the user's session for analytics.
argument - String The additional argument information.
publicArgument - String Public argument information. PRIVACY: Do NOT include any potentially private information in this field. These properties get sent to our analytics tools for Cloud, so must not include private information, such as search queries or repository names.
deviceID - String Device ID used for Amplitude analytics. Used on Sourcegraph Cloud only.
eventID - Int Event ID used to deduplicate events that occur simultaneously in Amplitude analytics. See https://developers.amplitude.com/docs/http-api-v2#optional-keys. Used on Sourcegraph Cloud only.
insertID - String Insert ID used to deduplicate events that re-occur in the event of retries or backfills in Amplitude analytics. See https://developers.amplitude.com/docs/http-api-v2#optional-keys. Used on Sourcegraph Cloud only.
Example
{
  "event": "xyz789",
  "userCookieID": "xyz789",
  "firstSourceURL": "abc123",
  "lastSourceURL": "xyz789",
  "url": "abc123",
  "source": "WEB",
  "cohortID": "xyz789",
  "referrer": "xyz789",
  "originalReferrer": "xyz789",
  "sessionReferrer": "abc123",
  "sessionFirstURL": "xyz789",
  "deviceSessionID": "xyz789",
  "argument": "abc123",
  "publicArgument": "abc123",
  "deviceID": "xyz789",
  "eventID": 987,
  "insertID": "abc123"
}

EventLog

Description

A single user event that has been logged.

Fields
Field Name Description
name - String! The name of the event.
user - User The user who executed the event, if one exists.
anonymousUserID - String! The randomly generated unique user ID stored in a browser cookie.
url - String! The URL when the event was logged.
source - EventSource! The source of the event.
argument - String The additional argument information.
version - String! The Sourcegraph version when the event was logged.
timestamp - DateTime! The timestamp when the event was logged.
Example
{
  "name": "abc123",
  "user": User,
  "anonymousUserID": "abc123",
  "url": "abc123",
  "source": "WEB",
  "argument": "xyz789",
  "version": "xyz789",
  "timestamp": "2007-12-03T10:15:30Z"
}

EventLogsConnection

Description

A list of event logs.

Fields
Field Name Description
nodes - [EventLog!]! A list of event logs.
totalCount - Int! The total count of event logs in the connection. This total count may be larger than the number of nodes in this object when the result is paginated.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [EventLog],
  "totalCount": 987,
  "pageInfo": PageInfo
}

EventSource

Description

The product sources where events can come from.

Values
Enum Value Description

WEB

CODEHOSTINTEGRATION

BACKEND

STATICWEB

IDEEXTENSION

Example
"WEB"

Executor

Description

An active executor compute instance.

Fields
Field Name Description
id - ID! The unique identifier of this executor.
hostname - String! The hostname of the executor instance.
queueName - String! The queue name that the executor polls for work.
active - Boolean! Active is true, if a heartbeat from the executor has been received at most three heartbeat intervals ago.
os - String! The operating system running the executor.
architecture - String! The machine architecture running the executor.
dockerVersion - String! The version of Git used by the executor.
executorVersion - String! The version of the executor.
gitVersion - String! The version of Docker used by the executor.
igniteVersion - String! The version of Ignite used by the executor.
srcCliVersion - String! The version of src-cli used by the executor.
firstSeenAt - DateTime! The first time the executor sent a heartbeat to the Sourcegraph instance.
lastSeenAt - DateTime! The last time the executor sent a heartbeat to the Sourcegraph instance.
compatibility - ExecutorCompatibility

The compatibility of the executor with respect to the Sourcegraph instance. If outdated, please make sure that the executor and the Sourcegraph backend are of compatible versions. This means they should match in major and minor version, but they may be 1 minor version apart. If too new, please update the Sourcegraph instance to match the version of the executor or downgrade the executor.

Compatibility can be null if the executor or Sourcegraph instance runs in dev mode or there's a version mismatch.

Example
{
  "id": "4",
  "hostname": "abc123",
  "queueName": "xyz789",
  "active": false,
  "os": "xyz789",
  "architecture": "xyz789",
  "dockerVersion": "xyz789",
  "executorVersion": "abc123",
  "gitVersion": "abc123",
  "igniteVersion": "xyz789",
  "srcCliVersion": "abc123",
  "firstSeenAt": "2007-12-03T10:15:30Z",
  "lastSeenAt": "2007-12-03T10:15:30Z",
  "compatibility": "OUTDATED"
}

ExecutorCompatibility

Description

The compatibility of the executor with the sourcegraph instance.

Values
Enum Value Description

OUTDATED

Executor version is more than one version behind the Sourcegraph instance.

UP_TO_DATE

Executor is up-to-date with the Sourcegraph instance.

VERSION_AHEAD

Executor version is more than one version ahead of the Sourcegraph instance.
Example
"OUTDATED"

ExecutorConnection

Description

A list of active executors compute instances.

Fields
Field Name Description
nodes - [Executor!]! A list of executors.
totalCount - Int! The total number of executors in this result set.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [Executor],
  "totalCount": 987,
  "pageInfo": PageInfo
}

ExecutorSecret

Description

A secret to be used in executor jobs.

Fields
Field Name Description
id - ID! The unique identifier of the secret.
key - String! The key under which the secret is available. Secrets are usually exposed as environment variables named using this key. Recommended format: uppercase letters, numbers and underscores.
scope - ExecutorSecretScope! The scope of this secret. The secret will only be usable for jobs in this particular scope.
overwritesGlobalSecret - Boolean! If true, this secret is defined in a namespace and a secret with the same key is also defined in the global namespace, which this secret overwrites.
namespace - Namespace The namespace this secret belongs to. Null, if a global secret. Global secrets are available to every execution.
creator - User The creator of the secret. Null, if the creator has been deleted.
createdAt - DateTime! The date and time this secret has been created.
updatedAt - DateTime! The date and time this secret has been last updated.
accessLogs - ExecutorSecretAccessLogConnection! The list of access events to this secret. Every time the secret value is decoded and used, one of these entries is created.
Arguments
first - Int

Only return N records.

after - String

Opaque cursor for pagination.

Example
{
  "id": 4,
  "key": "xyz789",
  "scope": "BATCHES",
  "overwritesGlobalSecret": false,
  "namespace": Namespace,
  "creator": User,
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "accessLogs": ExecutorSecretAccessLogConnection
}

ExecutorSecretAccessLog

Description

An access log entry for an executor secret. These are created every time the secret value is decoded.

Fields
Field Name Description
id - ID! The unique identifier of the log entry.
executorSecret - ExecutorSecret! The secret that this log entry belongs to.
user - User The user in which name the secret has been used. This is null when the access was not by a user account, or when the user account was deleted.
machineUser - String! True when the secret was accessed by an internal procedure.
createdAt - DateTime! The date and time when the secret has been used.
Example
{
  "id": 4,
  "executorSecret": ExecutorSecret,
  "user": User,
  "machineUser": "xyz789",
  "createdAt": "2007-12-03T10:15:30Z"
}

ExecutorSecretAccessLogConnection

Description

A list of executor secret access logs.

Fields
Field Name Description
nodes - [ExecutorSecretAccessLog!]! A list of access logs.
totalCount - Int! The total number of records in this result set.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [ExecutorSecretAccessLog],
  "totalCount": 123,
  "pageInfo": PageInfo
}

ExecutorSecretConnection

Description

A list of executor secrets.

Fields
Field Name Description
nodes - [ExecutorSecret!]! A list of executor secrets.
totalCount - Int! The total number of records in this result set.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [ExecutorSecret],
  "totalCount": 987,
  "pageInfo": PageInfo
}

ExecutorSecretScope

Description

Enum of the possible scopes for executor secrets.

Values
Enum Value Description

BATCHES

The secret is meant to be used with Batch Changes execution.

CODEINTEL

The secret is meant to be used with Auto-indexing.
Example
"BATCHES"

ExtensionManifest

Description

A description of the extension, how to run or access it, and when to activate it.

Fields
Field Name Description
raw - String! The raw JSON (or JSONC) contents of the manifest. This value may be large (because many manifests contain README and icon data), and it is JSONC (not strict JSON), which means it must be parsed with a JSON parser that supports trailing commas and comments. Consider using jsonFields instead.
jsonFields - JSONValue! The manifest as JSON (not JSONC, even if the raw manifest is JSONC) with only the specified fields. This is useful for callers that only need certain fields and want to avoid fetching a large amount of data (because many manifests contain README and icon data).
Arguments
fields - [String!]!
Example
{
  "raw": "xyz789",
  "jsonFields": JSONValue
}

ExtensionRegistry

Description

An extension registry.

Fields
Field Name Description
extensions - RegistryExtensionConnection! A list of extensions published in the extension registry.
Arguments
first - Int

Returns the first n extensions from the list.

extensionIDs - [String!]

Returns only extensions with the given IDs.

Example
{"extensions": RegistryExtensionConnection}

ExternalAccount

Description

An external account associated with a user.

Fields
Field Name Description
id - ID! The unique ID for the external account.
user - User! The user on Sourcegraph.
serviceType - String! The type of the external service where the external account resides.
serviceID - String! An identifier for the external service where the external account resides.
clientID - String! An identifier for the client of the external service where the external account resides. This distinguishes among multiple authentication providers that access the same service with different parameters.
accountID - String! An identifier for the external account (typically equal to or derived from the ID on the external service).
createdAt - DateTime! The creation date of this external account on Sourcegraph.
updatedAt - DateTime! The last-updated date of this external account on Sourcegraph.
refreshURL - String A URL that, when visited, re-initiates the authentication process.
accountData - JSONValue Provider-specific data about the external account. Only site admins may query this field.
publicAccountData - PublicExternalAccountData Public provider-specific data about the external account. Only users that are linked to the external account and site admins may query this field.
Example
{
  "id": 4,
  "user": User,
  "serviceType": "xyz789",
  "serviceID": "abc123",
  "clientID": "abc123",
  "accountID": "xyz789",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "refreshURL": "xyz789",
  "accountData": JSONValue,
  "publicAccountData": PublicExternalAccountData
}

ExternalAccountConnection

Description

A list of external accounts.

Fields
Field Name Description
nodes - [ExternalAccount!]! A list of external accounts.
totalCount - Int! The total count of external accounts in the connection. This total count may be larger than the number of nodes in this object when the result is paginated.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [ExternalAccount],
  "totalCount": 123,
  "pageInfo": PageInfo
}

ExternalRepository

Description

A repository on an external service (such as GitHub, GitLab, Phabricator, etc.).

Fields
Field Name Description
id - String! The repository's ID on the external service. Example: For GitHub, this is the GitHub GraphQL API's node ID for the repository.
serviceType - String! The type of external service where this repository resides. Example: "github", "gitlab", etc.
serviceID - String! The particular instance of the external service where this repository resides. Its value is opaque but typically consists of the canonical base URL to the service. Example: For GitHub.com, this is "https://github.com/".
Example
{
  "id": "abc123",
  "serviceType": "abc123",
  "serviceID": "abc123"
}

ExternalService

Description

A configured external service.

Fields
Field Name Description
id - ID! The external service's unique ID.
kind - ExternalServiceKind! The kind of external service.
displayName - String! The display name of the external service.
config - JSONCString! The JSON configuration of the external service.
createdAt - DateTime! When the external service was created.
updatedAt - DateTime! When the external service was last updated.
repoCount - Int! The number of repos synced by the external service.
webhookURL - String An optional URL that will be populated when webhooks have been configured for the external service.
warning - String This is an optional field that's populated when we ran into errors on the backend side when trying to create/update an ExternalService, but the create/update still succeeded. It is a field on ExternalService instead of a separate thing in order to not break the API and stay backwards compatible.
lastSyncError - String External services are synced with code hosts in the background. This optional field will contain any errors that occurred during the most recent completed sync.
lastSyncAt - DateTime LastSyncAt is the time the last sync job was run for this code host. Null if it has never been synced so far.
nextSyncAt - DateTime The timestamp of the next sync job. Null if not scheduled for a re-sync.
webhookLogs - WebhookLogConnection!

Returns recently received webhooks on this external service.

Only site admins may access this field.

DEPRECATED: Webhook logs linked directly to an external service will be removed. See https://docs.sourcegraph.com/admin/config/webhooks/incoming#deprecation-notice

Webhook logs linked directly to an external service will be removed. See https://docs.sourcegraph.com/admin/config/webhooks/incoming#deprecation-notice
Arguments
first - Int

Returns the first n webhook logs.

after - String

Opaque pagination cursor.

onlyErrors - Boolean

Only include webhook logs that resulted in errors.

since - DateTime

Only include webhook logs on or after this time.

until - DateTime

Only include webhook logs on or before this time.

syncJobs - ExternalServiceSyncJobConnection! The list of recent sync jobs for this external service.
Arguments
first - Int
checkConnection - ExternalServiceAvailability! Checks the availability of the external service.
hasConnectionCheck - Boolean!

True if this external service can perform availability check by running checkConnection.

If this is false, then checkConnection responds with ExternalServiceAvailabilityUnknown.

supportsRepoExclusion - Boolean! True if this external service configuration supports exclude parameter.
Example
{
  "id": "4",
  "kind": "AWSCODECOMMIT",
  "displayName": "abc123",
  "config": JSONCString,
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "repoCount": 987,
  "webhookURL": "abc123",
  "warning": "xyz789",
  "lastSyncError": "abc123",
  "lastSyncAt": "2007-12-03T10:15:30Z",
  "nextSyncAt": "2007-12-03T10:15:30Z",
  "webhookLogs": WebhookLogConnection,
  "syncJobs": ExternalServiceSyncJobConnection,
  "checkConnection": ExternalServiceAvailable,
  "hasConnectionCheck": true,
  "supportsRepoExclusion": false
}

ExternalServiceAvailability

Description

Availability status of an external service for diagnostic purposes.

This is so that the UI can surface whether the external service can serve requests, and if not, why is the reason for that.

Example
ExternalServiceAvailable

ExternalServiceAvailabilityUnknown

Description

Availability for some external services may not be determined, or only partially supported. In that case unknown variant of ExternalServiceAvailability is returned.

Fields
Field Name Description
implementationNote - String! User-friendly textual description of the implementation status of availability. This is expected to be tied to specific kinds of external services.
Example
{"implementationNote": "xyz789"}

ExternalServiceAvailable

Description

Indicator that the external service was recently found to be available.

Fields
Field Name Description
lastCheckedAt - DateTime! The timestamp of the last successful availability check that was performed.
Example
{"lastCheckedAt": "2007-12-03T10:15:30Z"}

ExternalServiceConnection

Description

A list of external services.

Fields
Field Name Description
nodes - [ExternalService!]! A list of external services.
totalCount - Int! The total number of external services in the connection.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [ExternalService],
  "totalCount": 987,
  "pageInfo": PageInfo
}

ExternalServiceKind

Description

A specific kind of external service.

Values
Enum Value Description

AWSCODECOMMIT

AZUREDEVOPS

BITBUCKETCLOUD

BITBUCKETSERVER

GERRIT

GITHUB

GITLAB

GITOLITE

GOMODULES

JVMPACKAGES

NPMPACKAGES

OTHER

PAGURE

PERFORCE

PHABRICATOR

PYTHONPACKAGES

RUSTPACKAGES

RUBYPACKAGES

Example
"AWSCODECOMMIT"

ExternalServiceNamespace

Description

A namespace sourced from a defined external service (such as GitHub, GitLab, Phabricator, etc.) that can be discovered before any sync or mirror operations.

Fields
Field Name Description
id - ID! The unique identifier of the external service namespace.
name - String! The name of the external service namespace.
externalID - String! The Namespace's ID on the external service. Example: For GitHub, this is the GitHub GraphQL API's node ID for the organization.
Example
{
  "id": 4,
  "name": "abc123",
  "externalID": "xyz789"
}

ExternalServiceNamespaceConnection

Description

A list of namespaces available to an external service configuration.

Fields
Field Name Description
nodes - [ExternalServiceNamespace!]! A list of namespaces available on the source. Namespaces are used to organize which members and users can access repositories and are defined by external service kind (e.g. Github organizations, Bitbucket projects, etc.)
totalCount - Int! The total number of source repos in the connection.
Example
{"nodes": [ExternalServiceNamespace], "totalCount": 123}

ExternalServiceSyncError

Description

FOR INTERNAL USE ONLY: A status message produced when repositories could not be synced from an external service

Fields
Field Name Description
message - String! The message of this status message
externalService - ExternalService! The external service that failed to sync
Example
{
  "message": "xyz789",
  "externalService": ExternalService
}

ExternalServiceSyncJob

Description

An external service sync job represents one sync with the code host. It's a background job that will eventually be run by the repo syncer.

Fields
Field Name Description
id - ID! The unique identifier of the sync job.
state - ExternalServiceSyncJobState! The current state of the sync job.
queuedAt - DateTime! When the sync job was added to the queue.
startedAt - DateTime Set when sync begins.
finishedAt - DateTime Set when sync finished.
failureMessage - String Error message, if the sync failed.
reposSynced - Int! The number of repos synced during this sync job.
repoSyncErrors - Int! The number of times an error occurred syncing a repo during this sync job.
reposAdded - Int! The number of new repos discovered during this sync job.
reposDeleted - Int! The number of repos deleted as a result of this sync job.
reposModified - Int! The number of existing repos whose metadata has changed during this sync job.
reposUnmodified - Int! The number of existing repos whose metadata did not change during this sync job.
Example
{
  "id": 4,
  "state": "QUEUED",
  "queuedAt": "2007-12-03T10:15:30Z",
  "startedAt": "2007-12-03T10:15:30Z",
  "finishedAt": "2007-12-03T10:15:30Z",
  "failureMessage": "abc123",
  "reposSynced": 987,
  "repoSyncErrors": 987,
  "reposAdded": 123,
  "reposDeleted": 123,
  "reposModified": 987,
  "reposUnmodified": 123
}

ExternalServiceSyncJobConnection

Description

A list of external service sync jobs.

Fields
Field Name Description
nodes - [ExternalServiceSyncJob!]! A list of sync jobs.
totalCount - Int! The total number of jobs in the connection.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [ExternalServiceSyncJob],
  "totalCount": 987,
  "pageInfo": PageInfo
}

ExternalServiceSyncJobState

Description

The possible states of an external service sync job.

Values
Enum Value Description

QUEUED

Not yet started. Will be picked up by a worker eventually.

PROCESSING

Currently syncing.

ERRORED

An error occurred while syncing. Will be retried eventually.

FAILED

A fatal error occurred while syncing. No retries will be made.

COMPLETED

Sync finished successfully.

CANCELING

Sync job is being canceled.

CANCELED

Sync job has been canceled.
Example
"QUEUED"

ExternalServiceUnavailable

Description

Indicator that the external service was recently not found available.

Fields
Field Name Description
suspectedReason - String! User-friendly textual description of supposed reason why the service is not available.
Example
{"suspectedReason": "abc123"}

FeatureFlag

Description

A feature flag is either a static boolean feature flag or a rollout feature flag

Example
FeatureFlagBoolean

FeatureFlagBoolean

Description

A feature flag that has a statically configured value

Fields
Field Name Description
name - String! The name of the feature flag
value - Boolean! The static value of the feature flag
overrides - [FeatureFlagOverride!]! Overrides that apply to the feature flag
Example
{
  "name": "abc123",
  "value": false,
  "overrides": [FeatureFlagOverride]
}

FeatureFlagOverride

Description

A feature flag override is an override of a feature flag's value for a specific org or user

Fields
Field Name Description
id - ID! A unique ID for this feature flag override
namespace - Namespace! The namespace for this override. Will always be a user or org.
targetFlag - FeatureFlag! The name of the feature flag being overridden
value - Boolean! The overridden value of the feature flag
Example
{
  "id": "4",
  "namespace": Namespace,
  "targetFlag": FeatureFlagBoolean,
  "value": true
}

FeatureFlagRollout

Description

A feature flag that is randomly evaluated to a boolean based on the rollout parameter

Fields
Field Name Description
name - String! The name of the feature flag
rolloutBasisPoints - Int! The ratio of users that will be assigned this this feature flag, expressed in basis points (0.01%).
overrides - [FeatureFlagOverride!]! Overrides that apply to the feature flag
Example
{
  "name": "abc123",
  "rolloutBasisPoints": 123,
  "overrides": [FeatureFlagOverride]
}

File

Description

File is temporarily preserved for backcompat with browser extension search API client code.

Fields
Field Name Description
path - String! The full path (relative to the repository root) of this file.
name - String! The base name (i.e., file name only) of this file's path.
isDirectory - Boolean! Whether this is a directory.
url - String! The URL to this file on Sourcegraph.
repository - Repository! The repository that contains this file.
Example
{
  "path": "xyz789",
  "name": "abc123",
  "isDirectory": false,
  "url": "abc123",
  "repository": Repository
}

File2

Description

A file. In a future version of Sourcegraph, a repository's files may be distinct from a repository's blobs (for example, to support searching/browsing generated files that aren't committed and don't exist as Git blobs). Clients should generally use the GitBlob concrete type and GitCommit.blobs (not GitCommit.files), unless they explicitly want to opt-in to different behavior in the future. INTERNAL: This is temporarily named File2 during a migration. Do not refer to the name File2 in any API clients as the name will change soon.

Fields
Field Name Description
path - String! The full path (relative to the root) of this file.
name - String! The base name (i.e., file name only) of this file.
isDirectory - Boolean! False because this is a file, not a directory.
content - String! The content of this file.
Arguments
startLine - Int

Return file content starting at line "startLine". A value <= 0 will be the start of the file.

endLine - Int

Return file content ending at line "endLine". A value < 0 or > totalLines will set endLine to the end of the file.

byteSize - Int! The file size in bytes.
totalLines - Int! Total line count for the file. Returns 0 for binary files.
binary - Boolean! Whether or not it is binary.
richHTML - String! The file rendered as rich HTML, or an empty string if it is not a supported rich file type. This HTML string is already escaped and thus is always safe to render.
Arguments
startLine - Int

Return richHTML content starting at line "startLine". A value <= 0 will be the start of the file.

endLine - Int

Return richHTML content ending at line "endLine". A value < 0 or > totalLines will set endLine to the end of the file.

url - String! The URL to this file (using the input revision specifier, which may not be immutable).
canonicalURL - String! The canonical URL to this file (using an immutable revision specifier).
externalURLs - [ExternalLink!]! The URLs to this file on external services.
highlight - HighlightedFile! Highlight the file.
Arguments
disableTimeout - Boolean!
highlightLongLines - Boolean

If highlightLongLines is true, lines which are longer than 2000 bytes are highlighted. 2000 bytes is enabled. This may produce a significant amount of HTML which some browsers (such as Chrome, but not Firefox) may have trouble rendering efficiently.

format - HighlightResponseFormat

Specifies which format/highlighting technique to use.

startLine - Int

Return highlight content starting at line "startLine". A value <= 0 will be the start of the file. Warning: Pagination only works with the HTML_PLAINTEXT format type at the moment.

endLine - Int

Return blob highlight ending at line "endLine". A value < 0 or > totalLines will set endLine to the end of the file. Warning: Pagination only works with the HTML_PLAINTEXT format type at the moment.

Possible Types
File2 Types

VirtualFile

GitBlob

Example
{
  "path": "abc123",
  "name": "abc123",
  "isDirectory": false,
  "content": "xyz789",
  "byteSize": 987,
  "totalLines": 987,
  "binary": true,
  "richHTML": "xyz789",
  "url": "xyz789",
  "canonicalURL": "xyz789",
  "externalURLs": [ExternalLink],
  "highlight": HighlightedFile
}

FileDiff

Description

A diff for a single file.

Fields
Field Name Description
oldPath - String The old (original) path of the file, or null if the file was added.
oldFile - File2 The old file, or null if the file was created (oldFile.path == oldPath).
newPath - String The new (changed) path of the file, or null if the file was deleted.
newFile - File2 The new file, or null if the file was deleted (newFile.path == newPath).
mostRelevantFile - File2! The old file (if the file was deleted) and otherwise the new file. This file field is typically used by clients that want to show a "View" link to the file.
hunks - [FileDiffHunk!]! Hunks that were changed from old to new.
stat - DiffStat! The diff stat for the whole file.
internalID - String! FOR INTERNAL USE ONLY. An identifier for the file diff that is unique among all other file diffs in the list that contains it.
Example
{
  "oldPath": "xyz789",
  "oldFile": File2,
  "newPath": "xyz789",
  "newFile": File2,
  "mostRelevantFile": File2,
  "hunks": [FileDiffHunk],
  "stat": DiffStat,
  "internalID": "abc123"
}

FileDiffConnection

Description

A list of file diffs.

Fields
Field Name Description
nodes - [FileDiff!]! A list of file diffs.
totalCount - Int The total count of file diffs in the connection, if available. This total count may be larger than the number of nodes in this object when the result is paginated.
pageInfo - PageInfo! Pagination information.
diffStat - DiffStat! The diff stat for the file diffs in this object, which may be a subset of the entire diff if the result is paginated.
rawDiff - String! The raw diff for the file diffs in this object, which may be a subset of the entire diff if the result is paginated.
Example
{
  "nodes": [FileDiff],
  "totalCount": 987,
  "pageInfo": PageInfo,
  "diffStat": DiffStat,
  "rawDiff": "abc123"
}

FileDiffHunk

Description

A changed region ("hunk") in a file diff.

Fields
Field Name Description
oldRange - FileDiffHunkRange! The range of the old file that the hunk applies to.
oldNoNewlineAt - Boolean! Whether the old file had a trailing newline.
newRange - FileDiffHunkRange! The range of the new file that the hunk applies to.
section - String The diff hunk section heading, if any.
body - String! The hunk body, with lines prefixed with '-', '+', or ' '.
highlight - HighlightedDiffHunkBody! Highlight the hunk.
Arguments
disableTimeout - Boolean!
highlightLongLines - Boolean

If highlightLongLines is true, lines which are longer than 2000 bytes are highlighted. 2000 bytes is enabled. This may produce a significant amount of HTML which some browsers (such as Chrome, but not Firefox) may have trouble rendering efficiently.

format - HighlightResponseFormat

Specifies which format/highlighting technique to use.

Example
{
  "oldRange": FileDiffHunkRange,
  "oldNoNewlineAt": true,
  "newRange": FileDiffHunkRange,
  "section": "abc123",
  "body": "abc123",
  "highlight": HighlightedDiffHunkBody
}

FileDiffHunkRange

Description

A hunk range in one side (old/new) of a diff.

Fields
Field Name Description
startLine - Int! The first line that the hunk applies to.
lines - Int! The number of lines that the hunk applies to.
Example
{"startLine": 987, "lines": 987}

FileMatch

Description

A file match.

Fields
Field Name Description
file - GitBlob! The file containing the match. KNOWN ISSUE: This file's "commit" field contains incomplete data. KNOWN ISSUE: This field's type should be File! not GitBlob!.
repository - Repository! The repository containing the file match.
revSpec - GitRevSpec The revspec of the revision that contains this match. If no revspec was given (such as when no repository filter or revspec is specified in the search query), it is null.
symbols - [Symbol!]! The symbols found in this file that match the query.
lineMatches - [LineMatch!]! The line matches.
chunkMatches - [ChunkMatch!]! EXPERIMENTAL: This field is experimental and may be unstable. The chunk matches.
limitHit - Boolean! Whether or not the limit was hit.
Example
{
  "file": GitBlob,
  "repository": Repository,
  "revSpec": GitRef,
  "symbols": [Symbol],
  "lineMatches": [LineMatch],
  "chunkMatches": [ChunkMatch],
  "limitHit": true
}

Float

Description

The Float scalar type represents signed double-precision fractional values as specified by IEEE 754.

Example
987.65

GenericSearchResultInterface

Description

A search result. Every type of search result, except FileMatch, must implement this interface.

Fields
Field Name Description
label - Markdown! A markdown string that is rendered prominently.
url - String! The URL of the result.
detail - Markdown! A markdown string that is rendered less prominently.
matches - [SearchResultMatch!]! A list of matches in this search result.
Possible Types
GenericSearchResultInterface Types

CommitSearchResult

Repository

Example
{
  "label": Markdown,
  "url": "abc123",
  "detail": Markdown,
  "matches": [SearchResultMatch]
}

GitBlob

Description

A Git blob in a repository.

Fields
Field Name Description
path - String! The full path (relative to the repository root) of this blob.
name - String! The base name (i.e., file name only) of this blob's path.
isDirectory - Boolean! False because this is a blob (file), not a directory.
content - String! The content of this blob.
Arguments
startLine - Int

Return blob content starting at line "startLine". A value <= 0 will be the start of the file.

endLine - Int

Return blob content ending at line "endLine". A value < 0 or > totalLines will set endLine to the end of the file.

byteSize - Int! The file size in bytes.
totalLines - Int! Total line count for the Blob. Returns 0 for binary files.
binary - Boolean! Whether or not it is binary.
richHTML - String! The blob contents rendered as rich HTML, or an empty string if it is not a supported rich file type. This HTML string is already escaped and thus is always safe to render.
Arguments
startLine - Int

Return richHTML content starting at line "startLine". A value <= 0 will be the start of the file.

endLine - Int

Return richHTML content ending at line "endLine". A value < 0 or > totalLines will set endLine to the end of the file.

commit - GitCommit! The Git commit containing this blob.
repository - Repository! The repository containing this Git blob.
url - String! The URL to this blob (using the input revision specifier, which may not be immutable).
canonicalURL - String! The canonical URL to this blob (using an immutable revision specifier).
externalURLs - [ExternalLink!]! The URLs to this blob on its repository's external services.
blame - [Hunk!]! Blame the blob.
Arguments
startLine - Int!
endLine - Int!
highlight - HighlightedFile! Highlight the blob contents.
Arguments
disableTimeout - Boolean!
highlightLongLines - Boolean

If highlightLongLines is true, lines which are longer than 2000 bytes are highlighted. 2000 bytes is enabled. This may produce a significant amount of HTML which some browsers (such as Chrome, but not Firefox) may have trouble rendering efficiently.

format - HighlightResponseFormat

Specifies which format/highlighting technique to use.

startLine - Int

Return highlight content starting at line "startLine". A value <= 0 will be the start of the file. Warning: Pagination only works with the HTML_PLAINTEXT format type at the moment.

endLine - Int

Return highlight content ending at line "endLine". A value < 0 or > totalLines will set endLine to the end of the file. Warning: Pagination only works with the HTML_PLAINTEXT format type at the moment.

submodule - Submodule Submodule metadata if this tree points to a submodule
symbols - SymbolConnection! Symbols defined in this blob.
Arguments
first - Int

Returns the first n symbols from the list.

query - String

Return symbols matching the query.

symbol - Symbol (Experimental) Symbol defined in this blob at the specific line number and character offset.
Arguments
line - Int!

The line number (0-based).

character - Int!

The character offset (0-based). The offset is measured in characters, not bytes.

isSingleChild - Boolean! Always false, since a blob is a file, not directory.
Arguments
first - Int

Returns the first n files in the tree.

recursive - Boolean

Recurse into sub-trees.

recursiveSingleChild - Boolean

Recurse into sub-trees of single-child directories

lfs - LFS LFS is set if the GitBlob is a pointer to a file stored in LFS.
Example
{
  "path": "xyz789",
  "name": "xyz789",
  "isDirectory": true,
  "content": "xyz789",
  "byteSize": 123,
  "totalLines": 123,
  "binary": true,
  "richHTML": "xyz789",
  "commit": GitCommit,
  "repository": Repository,
  "url": "abc123",
  "canonicalURL": "xyz789",
  "externalURLs": [ExternalLink],
  "blame": [Hunk],
  "highlight": HighlightedFile,
  "submodule": Submodule,
  "symbols": SymbolConnection,
  "symbol": Symbol,
  "isSingleChild": false,
  "lfs": LFS
}

GitCommit

Description

A Git commit.

Fields
Field Name Description
id - ID! The globally addressable ID for this commit.
repository - Repository! The repository that contains this commit.
oid - GitObjectID! This commit's Git object ID (OID), a 40-character SHA-1 hash.
abbreviatedOID - String! The abbreviated form of this commit's OID.
author - Signature! This commit's author.
committer - Signature This commit's committer, if any.
message - String! The full commit message.
subject - String! The first line of the commit message.
body - String The contents of the commit message after the first line.
parents - [GitCommit!]! Parent commits of this commit.
url - String! The URL to this commit (using the input revision specifier, which may not be immutable).
canonicalURL - String! The canonical URL to this commit (using an immutable revision specifier).
externalURLs - [ExternalLink!]! The URLs to this commit on its repository's external services.
path - GitTreeOrBlob The Git tree or blob in this commit at the given path.
Arguments
path - String

The path of the tree or blob.

tree - GitTree The Git tree in this commit at the given path.
Arguments
path - String

The path of the tree.

recursive - Boolean

Whether to recurse into sub-trees. If true, it overrides the value of the "recursive" parameter on all of GitTree's fields. DEPRECATED: Use the "recursive" parameter on GitTree's fields instead.

fileNames - [String!]! A list of file names in this repository.
blob - GitBlob The Git blob in this commit at the given path.
Arguments
path - String!
file - File2 The file at the given path for this commit. See "File" documentation for the difference between this field and the "blob" field.
Arguments
path - String!
languages - [String!]! Lists the programming languages present in the tree at this commit.
languageStatistics - [LanguageStatistics!]! List statistics for each language present in the repository.
ancestors - GitCommitConnection! The log of commits consisting of this commit and its ancestors.
Arguments
first - Int

Returns the first n commits from the list.

query - String

Return commits that match the query.

path - String

Return commits that affect the path.

follow - Boolean

Follow history beyond renames (only works for a single file).

after - String

Return commits more recent than the specified date.

afterCursor - String

Skip the first N commits of the repo before returning the number of commits as set in the field "first".

before - String

Return commits older than the specified date.

behindAhead - BehindAheadCounts! Returns the number of commits that this commit is behind and ahead of revspec.
Arguments
revspec - String!
symbols - SymbolConnection! Symbols defined as of this commit. (All symbols, not just symbols that were newly defined in this commit.)
Arguments
first - Int

Returns the first n symbols from the list.

query - String

Return symbols matching the query.

includePatterns - [String!]

A list of regular expressions, all of which must match all file paths returned in the list.

diff - RepositoryComparison! Returns the comparison with another revision.
Arguments
base - String

The base commit to compare to. Defaults to the commit's first parent.

Example
{
  "id": 4,
  "repository": Repository,
  "oid": GitObjectID,
  "abbreviatedOID": "xyz789",
  "author": Signature,
  "committer": Signature,
  "message": "abc123",
  "subject": "xyz789",
  "body": "abc123",
  "parents": [GitCommit],
  "url": "abc123",
  "canonicalURL": "abc123",
  "externalURLs": [ExternalLink],
  "path": GitTree,
  "tree": GitTree,
  "fileNames": ["abc123"],
  "blob": GitBlob,
  "file": File2,
  "languages": ["abc123"],
  "languageStatistics": [LanguageStatistics],
  "ancestors": GitCommitConnection,
  "behindAhead": BehindAheadCounts,
  "symbols": SymbolConnection,
  "diff": RepositoryComparison
}

GitCommitConnection

Description

A list of Git commits.

Fields
Field Name Description
nodes - [GitCommit!]! A list of Git commits.
totalCount - Int The total number of Git commits in the connection. If the GitCommitConnection is paginated (e.g., because a "first" parameter was provided to the field that produced it), this field is null to avoid it taking unexpectedly long to compute the total count. Remove the pagination parameters to obtain a non-null value for this field.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [GitCommit],
  "totalCount": 123,
  "pageInfo": PageInfo
}

GitObject

Description

A Git object.

Fields
Field Name Description
oid - GitObjectID! This object's OID.
abbreviatedOID - String! The abbreviated form of this object's OID.
commit - GitCommit The commit object, if it is a commit and it exists; otherwise null.
type - GitObjectType! The Git object's type.
Example
{
  "oid": GitObjectID,
  "abbreviatedOID": "abc123",
  "commit": GitCommit,
  "type": "GIT_COMMIT"
}

GitObjectID

Description

A Git object ID (SHA-1 hash, 40 hexadecimal characters).

Example
GitObjectID

GitObjectType

Description

All possible types of Git objects.

Values
Enum Value Description

GIT_COMMIT

A Git commit object.

GIT_TAG

A Git tag object.

GIT_TREE

A Git tree object.

GIT_BLOB

A Git blob object.

GIT_UNKNOWN

A Git object of unknown type.
Example
"GIT_COMMIT"

GitRef

Description

A Git ref.

Fields
Field Name Description
id - ID! The globally addressable ID for the Git ref.
name - String! The full ref name (e.g., "refs/heads/mybranch" or "refs/tags/mytag").
abbrevName - String! An unambiguous short name for the ref.
displayName - String! The display name of the ref. For branches ("refs/heads/foo"), this is the branch name ("foo"). As a special case, for GitHub pull request refs of the form refs/pull/NUMBER/head, this is "NUMBER".
prefix - String! The prefix of the ref, either "", "refs/", "refs/heads/", "refs/pull/", or "refs/tags/". This prefix is always a prefix of the ref's name.
type - GitRefType! The type of this Git ref.
target - GitObject! The object that the ref points to.
repository - Repository! The associated repository.
url - String! The URL to this Git ref.
Example
{
  "id": "4",
  "name": "abc123",
  "abbrevName": "abc123",
  "displayName": "xyz789",
  "prefix": "abc123",
  "type": "GIT_BRANCH",
  "target": GitObject,
  "repository": Repository,
  "url": "xyz789"
}

GitRefConnection

Description

A list of Git refs.

Fields
Field Name Description
nodes - [GitRef!]! A list of Git refs.
totalCount - Int! The total count of Git refs in the connection. This total count may be larger than the number of nodes in this object when the result is paginated.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [GitRef],
  "totalCount": 123,
  "pageInfo": PageInfo
}

GitRefOrder

Description

Ordering options for Git refs.

Values
Enum Value Description

AUTHORED_OR_COMMITTED_AT

By the authored or committed at date, whichever is more recent.
Example
"AUTHORED_OR_COMMITTED_AT"

GitRefType

Description

All possible types of Git refs.

Values
Enum Value Description

GIT_BRANCH

A Git branch (in refs/heads/).

GIT_TAG

A Git tag (in refs/tags/).

GIT_REF_OTHER

A Git ref that is neither a branch nor tag.
Example
"GIT_BRANCH"

GitRevSpec

Description

A Git revspec.

Types
Union Types

GitRef

GitRevSpecExpr

GitObject

Example
GitRef

GitRevSpecExpr

Description

A Git revspec expression that (possibly) resolves to a Git revision.

Fields
Field Name Description
expr - String! The original Git revspec expression.
object - GitObject The Git object that the revspec resolves to, or null otherwise.
Example
{
  "expr": "xyz789",
  "object": GitObject
}

GitRevisionRange

Description

A Git revision range of the form "base..head" or "base...head". Other revision range formats are not supported.

Fields
Field Name Description
expr - String! The Git revision range expression of the form "base..head" or "base...head".
base - GitRevSpec! The base (left-hand side) of the range.
baseRevSpec - GitRevSpecExpr! The base's revspec as an expression.
head - GitRevSpec! The head (right-hand side) of the range.
headRevSpec - GitRevSpecExpr! The head's revspec as an expression.
mergeBase - GitObject The merge-base of the base and head revisions, if this is a "base...head" revision range. If this is a "base..head" revision range, then this field is null.
Example
{
  "expr": "abc123",
  "base": GitRef,
  "baseRevSpec": GitRevSpecExpr,
  "head": GitRef,
  "headRevSpec": GitRevSpecExpr,
  "mergeBase": GitObject
}

GitTree

Description

A Git tree in a repository.

Fields
Field Name Description
path - String! The full path (relative to the root) of this tree.
isRoot - Boolean! Whether this tree is the root (top-level) tree.
name - String! The base name (i.e., last path component only) of this tree.
isDirectory - Boolean! True because this is a directory. (The value differs for other TreeEntry interface implementations, such as File.)
commit - GitCommit! The Git commit containing this tree.
repository - Repository! The repository containing this tree.
url - String! The URL to this tree (using the input revision specifier, which may not be immutable).
canonicalURL - String! The canonical URL to this tree (using an immutable revision specifier).
externalURLs - [ExternalLink!]! The URLs to this tree on external services.
rawZipArchiveURL - String! The URL to this entry's raw contents as a Zip archive.
submodule - Submodule Submodule metadata if this tree points to a submodule
directories - [GitTree!]! A list of directories in this tree.
Arguments
first - Int

Returns the first n files in the tree.

recursive - Boolean

Recurse into sub-trees.

files - [File!]! A list of files in this tree.
Arguments
first - Int

Returns the first n files in the tree.

recursive - Boolean

Recurse into sub-trees.

entries - [TreeEntry!]! A list of entries in this tree.
Arguments
first - Int

Returns the first n files in the tree.

recursive - Boolean

Recurse into sub-trees. If true, implies recursiveSingleChild.

recursiveSingleChild - Boolean

Recurse into sub-trees of single-child directories. If true, we return a flat list of every directory that is a single child, and any directories or files that are nested in a single child.

ancestors - Boolean

Includes all parent directories and their entries. For example, if the path is /client/web/something, it will return the following entries in this order:

  • /*
  • /client/*
  • /client/web/*
  • /client/web/something/*

This is useful for rendering a collapsed tree view for the entry.

symbols - SymbolConnection! Symbols defined in this tree.
Arguments
first - Int

Returns the first n symbols from the list.

query - String

Return symbols matching the query.

isSingleChild - Boolean! Whether this tree entry is a single child
Arguments
first - Int

Returns the first n files in the tree.

recursive - Boolean

Recurse into sub-trees.

recursiveSingleChild - Boolean

Recurse into sub-trees of single-child directories

Example
{
  "path": "abc123",
  "isRoot": true,
  "name": "abc123",
  "isDirectory": false,
  "commit": GitCommit,
  "repository": Repository,
  "url": "xyz789",
  "canonicalURL": "abc123",
  "externalURLs": [ExternalLink],
  "rawZipArchiveURL": "xyz789",
  "submodule": Submodule,
  "directories": [GitTree],
  "files": [File],
  "entries": [TreeEntry],
  "symbols": SymbolConnection,
  "isSingleChild": true
}

GitTreeOrBlob

Description

Either a git tree or blob.

Types
Union Types

GitTree

GitBlob

Example
GitTree

GitUpdatesDisabled

Description

FOR INTERNAL USE ONLY: A status message produced when disableAutoGitUpdates is set to true in the site configuration

Fields
Field Name Description
message - String! The message of this status message
Example
{"message": "xyz789"}

HTTPHeader

Description

A key-value pair

Fields
Field Name Description
name - String! The header name
values - [String!]! Can be multiple values
Example
{
  "name": "abc123",
  "values": ["xyz789"]
}

HappinessFeedbackSubmissionInput

Description

Input for a happiness feedback submission.

Fields
Input Field Description
feedback - String The feedback text from the user.
currentPath - String The path that the happiness feedback will be submitted from.
Example
{
  "feedback": "xyz789",
  "currentPath": "xyz789"
}

Highlight

Description

A highlighted region in a string (e.g., matched by a query).

Fields
Field Name Description
line - Int! The 1-indexed line number.
character - Int! The 1-indexed character on the line.
length - Int! The length of the highlight, in characters (on the same line).
Example
{"line": 123, "character": 987, "length": 123}

HighlightLineRange

Description

A specific highlighted line range to fetch.

Fields
Input Field Description
startLine - Int! The first line to fetch (0-indexed, inclusive). Values outside the bounds of the file will automatically be clamped within the valid range.
endLine - Int! The last line to fetch (0-indexed, inclusive). Values outside the bounds of the file will automatically be clamped within the valid range.
Example
{"startLine": 987, "endLine": 123}

HighlightResponseFormat

Description

The format and highlighting to use when requesting highlighting information for a file.

Values
Enum Value Description

HTML_PLAINTEXT

HTML formatted file content without syntax highlighting.

HTML_HIGHLIGHT

HTML formatted file content with syntax highlighting.

JSON_SCIP

SCIP highlighting information as JSON.
Example
"HTML_PLAINTEXT"

HighlightedDiffHunkBody

Description

A highlighted hunk, consisting of all its lines.

Fields
Field Name Description
aborted - Boolean! Whether highlighting was aborted.
lines - [HighlightedDiffHunkLine!]! The highlighted lines.
Example
{"aborted": true, "lines": [HighlightedDiffHunkLine]}

HighlightedDiffHunkLine

Description

A single highlighted line, including the kind of line.

Fields
Field Name Description
html - String! The HTML containing the syntax-highlighted line of code.
kind - DiffHunkLineType! The operation that happened on this line, in patches it is prefixed with '+', '-', ' '. Can be either add, delete, or no change.
Example
{"html": "xyz789", "kind": "ADDED"}

HighlightedFile

Description

A highlighted file.

Fields
Field Name Description
aborted - Boolean! Whether or not it was aborted.
html - String! The HTML table that can be used to display the highlighted file.
lsif - String! Base64 encoded JSON payload of LSIF Typed with syntax highlighting data.
lineRanges - [String!]! A list of the desired line ranges. Each list is a list of lines, where each element is an HTML table row '...' string. This is useful if you only need to display specific subsets of the file.
Arguments
Example
{
  "aborted": true,
  "html": "xyz789",
  "lsif": "xyz789",
  "lineRanges": ["xyz789"]
}

HighlightedString

Description

A string that has highlights (e.g, query matches).

Fields
Field Name Description
value - String! The full contents of the string.
highlights - [Highlight!]! Highlighted matches of the query in the preview string.
Example
{
  "value": "abc123",
  "highlights": [Highlight]
}

Hunk

Description

A hunk.

Fields
Field Name Description
startLine - Int! The startLine.
endLine - Int! The endLine.
startByte - Int! The startByte.
endByte - Int! The endByte.
rev - String! The rev.
author - Signature! The author.
message - String! The message.
commit - GitCommit! The commit that contains the hunk.
filename - String! The original filename at the commit. Use this filename if you're reading the text contents of the file at the commit field of this hunk. The file may have been renamed after the commit so name of file where this hunk got computed may not exist.
Example
{
  "startLine": 123,
  "endLine": 123,
  "startByte": 987,
  "endByte": 123,
  "rev": "abc123",
  "author": Signature,
  "message": "abc123",
  "commit": GitCommit,
  "filename": "abc123"
}

ID

Description

The ID scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4") or integer (such as 4) input value will be accepted as an ID.

Example
"4"

IndexingProgress

Description

FOR INTERNAL USE ONLY: A status message produced when repositories are being indexed for search.

Fields
Field Name Description
notIndexed - Int! The number of repositories that have not been indexed yet.
indexed - Int! The number of repositories that have been indexed.
Example
{"notIndexed": 123, "indexed": 123}

Int

Description

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Example
987

InviteUserToOrganizationResult

Description

The result of Mutation.inviteUserToOrganization.

Fields
Field Name Description
sentInvitationEmail - Boolean! Whether an invitation email was sent. If emails are not enabled on this site or if the user has no verified email address, an email will not be sent.
invitationURL - String! The URL that the invited user can visit to accept or reject the invitation.
Example
{
  "sentInvitationEmail": true,
  "invitationURL": "abc123"
}

JSONCString

Description

A string that contains valid JSON, with additional support for //-style comments and trailing commas.

Example
JSONCString

JSONValue

Description

A valid JSON value.

Example
JSONValue

KeyPathSegment

Description

A segment of a key path that locates a nested JSON value in a root JSON value. Exactly one field in each KeyPathSegment must be non-null. For example, in {"a": [0, {"b": 3}]}, the value 3 is located at the key path ["a", 1, "b"].

Fields
Input Field Description
property - String The name of the property in the object at this location to descend into.
index - Int The index of the array at this location to descend into.
Example
{"property": "abc123", "index": 987}

KeyValuePair

Description

A key-value pair

Fields
Field Name Description
key - String! The non-nullable key.
value - String The nullable value. A null value indicates this key-value pair should be treated as a tag.
Example
{
  "key": "abc123",
  "value": "abc123"
}

LFS

Description

Information about a blob stored in Git Large File Storage (LFS).

Fields
Field Name Description
byteSize - BigInt! The size of the file in LFS in bytes. Note: the file size in the GitBlob will be the size of the pointer not the file a user checks out.
Example
{"byteSize": {}}

LanguageStatistics

Description

Statistics about a language's usage.

Fields
Field Name Description
name - String! The name of the language.
totalBytes - Float! The total bytes in the language.
totalLines - Int! The total number of lines in the language.
Example
{
  "name": "xyz789",
  "totalBytes": 987.65,
  "totalLines": 123
}

LineMatch

Description

A line match.

Fields
Field Name Description
preview - String! The preview.
lineNumber - Int! The line number. 0-based. The first line will have lineNumber 0. Note: A UI will normally display line numbers 1-based.
offsetAndLengths - [Int!]! Tuples of [offset, length] measured in characters (not bytes).
limitHit - Boolean! Whether or not the limit was hit. will always be false
Example
{
  "preview": "abc123",
  "lineNumber": 123,
  "offsetAndLengths": [123],
  "limitHit": false
}

Location

Description

A location inside a resource (in a repository at a specific commit).

Fields
Field Name Description
resource - CodeIntelGitBlob! The file that this location refers to.
range - Range The range inside the file that this location refers to.
url - String! The URL to this location (using the input revision specifier, which may not be immutable).
canonicalURL - String! The canonical URL to this location (using an immutable revision specifier).
Example
{
  "resource": CodeIntelGitBlob,
  "range": Range,
  "url": "xyz789",
  "canonicalURL": "abc123"
}

Markdown

Description

An object representing a markdown string.

Fields
Field Name Description
text - String! The raw markdown string.
html - String! HTML for the rendered markdown string, or null if there is no HTML representation provided. If specified, clients should render this directly.
Example
{
  "text": "abc123",
  "html": "xyz789"
}

MarkdownOptions

Description

Describes options for rendering Markdown.

Fields
Input Field Description
alwaysNil - String A dummy null value (empty input types are not allowed yet).
Example
{"alwaysNil": "abc123"}

MirrorRepositoryInfo

Description

Information and status about the mirroring of a repository. In this case, the remote source repository is external to Sourcegraph and the mirror is maintained by the Sourcegraph site (not the other way around).

Fields
Field Name Description
remoteURL - String! The URL of the remote source repository.
cloneInProgress - Boolean! Whether the clone of the repository has begun but not yet completed.
cloneProgress - String A single line of text that contains progress information for the running clone command. The format of the progress text is not specified. It is intended to be displayed directly to a user. e.g. "Receiving objects: 95% (2041/2148), 292.01 KiB | 515.00 KiB/s" "Resolving deltas: 9% (117/1263)"
cloned - Boolean! Whether the repository has ever been successfully cloned.
isCorrupted - Boolean! Whether the repository is currently corrupt.
corruptionLogs - [RepoCorruptionLog!]! A Log of the corruption events that have been detected on this repository. Only 10 events are kept and the events are ordered from most recent to least.
updatedAt - DateTime When the repository was last successfully updated from the remote source repository..
updateSchedule - UpdateSchedule The state of this repository in the update schedule.
updateQueue - UpdateQueue The state of this repository in the update queue.
lastError - String The last error message, if any, returned when fetching or cloning the repo
byteSize - BigInt! The byte size of the repo.
shard - String The gitserver shard on which the repository is or will be cloned. Only site admins can access this field.
Example
{
  "remoteURL": "abc123",
  "cloneInProgress": false,
  "cloneProgress": "abc123",
  "cloned": true,
  "isCorrupted": false,
  "corruptionLogs": [RepoCorruptionLog],
  "updatedAt": "2007-12-03T10:15:30Z",
  "updateSchedule": UpdateSchedule,
  "updateQueue": UpdateQueue,
  "lastError": "xyz789",
  "byteSize": {},
  "shard": "abc123"
}

MonitoringAlert

Description

A high-level monitoring alert, for details see https://docs.sourcegraph.com/admin/observability/metrics#high-level-alerting-metrics

Fields
Field Name Description
timestamp - DateTime! End time of this event, which describes the past 12h of recorded data.
name - String! Name of alert that the service fired.
serviceName - String! Name of the service that fired the alert.
owner - String! Owner of the fired alert.
average - Float! Average percentage of time (between [0, 1]) that the event was firing over the 12h of recorded data. e.g. 1.0 if it was firing 100% of the time on average during that 12h window, 0.5 if it was firing 50% of the time on average, etc.
Example
{
  "timestamp": "2007-12-03T10:15:30Z",
  "name": "xyz789",
  "serviceName": "abc123",
  "owner": "abc123",
  "average": 987.65
}

MonitoringStatistics

Description

Monitoring overview.

Fields
Field Name Description
alerts - [MonitoringAlert!]! Alerts fired in this time span. No longer supported, and will no longer return data - query will be removed after Sourcegraph 4.5
Example
{"alerts": [MonitoringAlert]}

Namespace

Description

A namespace is a container for certain types of data and settings, such as a user or organization.

Fields
Field Name Description
id - ID! The globally unique ID of this namespace.
namespaceName - String! The name of this namespace's component. For a user, this is the username. For an organization, this is the organization name.
url - String! The URL to this namespace.
Possible Types
Namespace Types

User

Org

Example
{
  "id": 4,
  "namespaceName": "abc123",
  "url": "xyz789"
}

NewRepositoryConnection

Description

A list of repositories.

The old RepositoryConnection is deprecated and is replaced by this new connection which support proper cursor based pagination. The new connection does not include precise argument for totalCount.

Fields
Field Name Description
nodes - [Repository!]! A list of repositories.
totalCount - Int! The total count of repositories in the connection.
pageInfo - ConnectionPageInfo! Pagination information.
Example
{
  "nodes": [Repository],
  "totalCount": 987,
  "pageInfo": ConnectionPageInfo
}

NewUsersConnection

Description

A paginated connection for users.

Fields
Field Name Description
nodes - [User!]! A list of users.
totalCount - Int! The total number of users in the connection.
pageInfo - ConnectionPageInfo! Pagination information.
Example
{
  "nodes": [User],
  "totalCount": 987,
  "pageInfo": ConnectionPageInfo
}

Node

Org

Description

An organization, which is a group of users.

Fields
Field Name Description
executorSecrets - ExecutorSecretConnection! The list of all available executor secrets for execution in this orgs namespace.
Arguments
scope - ExecutorSecretScope!

The scope for which secrets shall be returned.

first - Int

Only return N records.

after - String

Opaque cursor for pagination.

id - ID! The unique ID for the organization.
name - String! The organization's name. This is unique among all organizations on this Sourcegraph site.
displayName - String The organization's chosen display name.
createdAt - DateTime! The date when the organization was created.
members - NewUsersConnection! A list of users who are members of this organization.
Arguments
first - Int

The limit argument for forward pagination.

last - Int

The limit argument for backward pagination.

after - String

The cursor argument for forward pagination.

before - String

The cursor argument for backward pagination.

query - String

Return users whose usernames or display names match the query.

latestSettings - Settings The latest settings for the organization. Only organization members and site admins can access this field.
settingsCascade - SettingsCascade! All settings for this organization, and the individual levels in the settings cascade (global > organization) that were merged to produce the final merged settings. Only organization members and site admins can access this field.
configurationCascade - ConfigurationCascade! DEPRECATED Use settingsCascade instead. This field is a deprecated alias for it and will be removed in a future release.
viewerPendingInvitation - OrganizationInvitation DEPRECATED A pending invitation for the viewer to join this organization, if any. Use invitationByToken operation instead. This field is deprecated and will be removed in a future release.
viewerCanAdminister - Boolean! Whether the viewer has admin privileges on this organization. Currently, all of an organization's members have admin privileges on the organization.
viewerIsMember - Boolean! Whether the viewer is a member of this organization.
url - String! The URL to the organization.
settingsURL - String The URL to the organization's settings.
namespaceName - String! The name of this user namespace's component. For organizations, this is the organization's name.
Example
{
  "executorSecrets": ExecutorSecretConnection,
  "id": "4",
  "name": "abc123",
  "displayName": "xyz789",
  "createdAt": "2007-12-03T10:15:30Z",
  "members": NewUsersConnection,
  "latestSettings": Settings,
  "settingsCascade": SettingsCascade,
  "configurationCascade": ConfigurationCascade,
  "viewerPendingInvitation": OrganizationInvitation,
  "viewerCanAdminister": true,
  "viewerIsMember": false,
  "url": "xyz789",
  "settingsURL": "abc123",
  "namespaceName": "xyz789"
}

OrgConnection

Description

A list of organizations.

Fields
Field Name Description
nodes - [Org!]! A list of organizations.
totalCount - Int! The total count of organizations in the connection. This total count may be larger than the number of nodes in this object when the result is paginated.
Example
{"nodes": [Org], "totalCount": 123}

OrgMembersSummary

Description

Result organization members count and pending invitations count.

Fields
Field Name Description
id - ID! The unique ID for the Org.
membersCount - Int! Total number of members for the org.
invitesCount - Int! Total number of pending invites for the org.
Example
{"id": 4, "membersCount": 123, "invitesCount": 987}

OrganizationInvitation

Description

An invitation to join an organization as a member.

Fields
Field Name Description
id - ID! The ID of the invitation.
organization - Org! The organization that the invitation is for.
sender - User! The user who sent the invitation.
recipient - User The user who received the invitation.
recipientEmail - String The email address that the invitation was sent to.
createdAt - DateTime! The date when this invitation was created.
notifiedAt - DateTime The most recent date when a notification was sent to the recipient about this invitation.
respondedAt - DateTime The date when this invitation was responded to by the recipient.
responseType - OrganizationInvitationResponseType The recipient's response to this invitation, or no response (null).
respondURL - String The URL where the recipient can respond to the invitation when pending, or null if not pending.
revokedAt - DateTime The date when this invitation was revoked.
expiresAt - DateTime The date when this invitation is going to expire.
isVerifiedEmail - Boolean Boolean flag which returns true if the email on the invite matches a verified email of the user
Example
{
  "id": "4",
  "organization": Org,
  "sender": User,
  "recipient": User,
  "recipientEmail": "xyz789",
  "createdAt": "2007-12-03T10:15:30Z",
  "notifiedAt": "2007-12-03T10:15:30Z",
  "respondedAt": "2007-12-03T10:15:30Z",
  "responseType": "ACCEPT",
  "respondURL": "xyz789",
  "revokedAt": "2007-12-03T10:15:30Z",
  "expiresAt": "2007-12-03T10:15:30Z",
  "isVerifiedEmail": true
}

OrganizationInvitationResponseType

Description

The recipient's possible responses to an invitation to join an organization as a member.

Values
Enum Value Description

ACCEPT

The invitation was accepted by the recipient.

REJECT

The invitation was rejected by the recipient.
Example
"ACCEPT"

OrganizationMembership

Description

An organization membership.

Fields
Field Name Description
organization - Org! The organization.
user - User! The user.
createdAt - DateTime! The time when this was created.
updatedAt - DateTime! The time when this was updated.
Example
{
  "organization": Org,
  "user": User,
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z"
}

OrganizationMembershipConnection

Description

A list of organization memberships.

Fields
Field Name Description
nodes - [OrganizationMembership!]! A list of organization memberships.
totalCount - Int! The total count of organization memberships in the connection. This total count may be larger than the number of nodes in this object when the result is paginated.
Example
{"nodes": [OrganizationMembership], "totalCount": 987}

OutOfBandMigration

Description

An out-of-band migration is a process that runs in the background of the instance that moves data from one format into another format. Out-of-band migrations

Fields
Field Name Description
id - ID! The unique identifier of this migration.
team - String! The team that owns this migration (e.g., code-intelligence).
component - String! The component this migration affects (e.g., codeintel-db.lsif_data_documents).
description - String! A human-readable summary of the migration.
introduced - String!

The Sourcegraph version in which this migration was introduced. The format of this version includes only major and minor parts separated by a dot. The patch version can always be assumed to be zero as we'll never introduce or deprecate an out-of-band migration within a patch release.

It is necessary to completely this migration in reverse (if destructive) before downgrading to or past this version. Otherwise, the previous instance version will not be aware of the new data format.

deprecated - String

The Sourcegraph version by which this migration is assumed to have completed. The format of this version mirrors introduced and includes only major and minor parts separated by a dot.

It is necessary to have completed this migration before upgrading to or past this version. Otherwise, the next instance version will no longer be aware of the old data format.

progress - Float! The progress of the migration (in the forward direction). In the range [0, 1].
created - DateTime! The time the migration record was inserted.
lastUpdated - DateTime The last time the migration progress or error list was updated.
nonDestructive - Boolean! If false, the migration moves data destructively, and a previous version of Sourcegraph will encounter errors when interfacing with the target data unless the migration is first run in reverse prior to a downgrade.
applyReverse - Boolean! If true, the migration will run in reverse.
errors - [OutOfBandMigrationError!]! A list of errors that have occurred while performing this migration (in either direction). This list is bounded by a maximum size, and older errors will replaced by newer errors as the list capacity is reached.
Example
{
  "id": 4,
  "team": "xyz789",
  "component": "xyz789",
  "description": "abc123",
  "introduced": "abc123",
  "deprecated": "xyz789",
  "progress": 987.65,
  "created": "2007-12-03T10:15:30Z",
  "lastUpdated": "2007-12-03T10:15:30Z",
  "nonDestructive": false,
  "applyReverse": false,
  "errors": [OutOfBandMigrationError]
}

OutOfBandMigrationError

Description

An error that occurred while performing an out-of-band migration.

Fields
Field Name Description
message - String! The error message.
created - DateTime! The time the error occurred.
Example
{
  "message": "xyz789",
  "created": "2007-12-03T10:15:30Z"
}

OutboundRequest

Description

A single outbound request.

Fields
Field Name Description
id - ID! The request log item ID.
startedAt - DateTime! The time the request was sent at.
method - String! The method used in the HTTP request. E.g. GET, POST, etc.
url - String! The full URL the request was sent to.
requestHeaders - [HTTPHeader!]! The headers sent with the HTTP request.
requestBody - String! The body content of the HTTP message.
statusCode - Int! The HTTP status code received.
responseHeaders - [HTTPHeader!]! The headers received with the HTTP response.
durationMs - Int! The total time the request took to complete, in milliseconds.
errorMessage - String! Any error message got from the request Doer in case of an error, otherwise an empty string.
creationStackFrame - String! Stack information to figure out where the ExternalClientFactory was created.
callStack - String! Stack information to figure out where in the code base the request was initiated.
Example
{
  "id": 4,
  "startedAt": "2007-12-03T10:15:30Z",
  "method": "abc123",
  "url": "abc123",
  "requestHeaders": [HTTPHeader],
  "requestBody": "abc123",
  "statusCode": 987,
  "responseHeaders": [HTTPHeader],
  "durationMs": 123,
  "errorMessage": "abc123",
  "creationStackFrame": "xyz789",
  "callStack": "abc123"
}

OutboundRequestConnection

Description

A list of logged outbound requests.

Fields
Field Name Description
nodes - [OutboundRequest!]! A list of outbound requests.
totalCount - Int! The total number of outbound request log items in the connection.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [OutboundRequest],
  "totalCount": 123,
  "pageInfo": PageInfo
}

PackageRepoReference

Description

A reference to a package repo, such as a maven artifact, rust crate etc.

Fields
Field Name Description
id - ID! A unique ID for the package repo reference.
scheme - PackageRepoReferenceKind! The ecosystem/package-manager/indexer scheme under which this package repo reference is uniquely identified e.g. npm/python/rust-analyzer
name - String! The name of the package, in a format relevant to the specific ecosystem e.g. maven artifact coordinates (com.sample:text), npm scoped packages (@monkeys/banana).
versions - [PackageRepoReferenceVersion!]! The versions of this package known to the sourcegraph instance.
repository - Repository The synthetic repository (aka the package repo) created to store the contents of the synced versions of the package repo reference. This type is subject to change once package repos and other non-git code hosts become first-class.
Example
{
  "id": "4",
  "scheme": "GOMODULES",
  "name": "xyz789",
  "versions": [PackageRepoReferenceVersion],
  "repository": Repository
}

PackageRepoReferenceConnection

Description

List of package repo references.

Fields
Field Name Description
nodes - [PackageRepoReference!]! A list of package repo references.
totalCount - Int! The total number of package repo references in the connection.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [PackageRepoReference],
  "totalCount": 987,
  "pageInfo": PageInfo
}

PackageRepoReferenceKind

Description

A kind of package repo reference. ExternalServiceKind, with a more specific set of values.

Values
Enum Value Description

GOMODULES

JVMPACKAGES

NPMPACKAGES

PYTHONPACKAGES

RUSTPACKAGES

RUBYPACKAGES

Example
"GOMODULES"

PackageRepoReferenceVersion

Description

A version of a package repo reference.

Fields
Field Name Description
id - ID! A unique ID for the package repo reference version.
packageRepoReferenceID - ID! The package repo reference that this ID is for.
version - String! The version string. Not guaranteed to be semver or any other format.
Example
{
  "id": 4,
  "packageRepoReferenceID": "4",
  "version": "xyz789"
}

PageInfo

Description

Pagination information for forward-only pagination. See https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo.

Fields
Field Name Description
endCursor - String When paginating forwards, the cursor to continue.
hasNextPage - Boolean! When paginating forwards, are there more items?
Example
{"endCursor": "xyz789", "hasNextPage": true}

ParentSourcegraphDetails

Description

Parent Sourcegraph instance

Fields
Field Name Description
url - String! Sourcegraph instance URL.
Example
{"url": "xyz789"}

Person

Description

A person.

Fields
Field Name Description
name - String! The name.
email - String! The email.
displayName - String! The name if set; otherwise the email username.
avatarURL - String The avatar URL, if known.
user - User The corresponding user account for this person, if one exists.
Example
{
  "name": "xyz789",
  "email": "xyz789",
  "displayName": "xyz789",
  "avatarURL": "xyz789",
  "user": User
}

PhabricatorRepo

Description

A Phabricator repository.

Fields
Field Name Description
name - String! The canonical repo name (e.g. "github.com/gorilla/mux").
uri - String! An alias for name. use name instead
callsign - String! The unique Phabricator identifier for the repo, like "MUX"
url - String! The URL to the phabricator instance (e.g. http://phabricator.sgdev.org)
Example
{
  "name": "abc123",
  "uri": "xyz789",
  "callsign": "xyz789",
  "url": "xyz789"
}

Position

Description

A zero-based position inside a file.

Fields
Field Name Description
line - Int! The line number (zero-based) of the position.
character - Int! The character offset (zero-based) in the line of the position.
Example
{"line": 123, "character": 123}

ProductLicenseInfo

Description

Information about this site's product license (which activates certain Sourcegraph features).

Fields
Field Name Description
productNameWithBrand - String! The full name of the product that this license is for. To get the product name for the current Sourcegraph site, use ProductSubscriptionStatus.productNameWithBrand instead (to handle cases where there is no license).
tags - [String!]! Tags indicating the product plan and features activated by this license.
userCount - Int! The number of users allowed by this license.
expiresAt - DateTime! The date when this license expires.
Example
{
  "productNameWithBrand": "abc123",
  "tags": ["xyz789"],
  "userCount": 987,
  "expiresAt": "2007-12-03T10:15:30Z"
}

ProductSubscriptionStatus

Description

Information about this site's product subscription (which enables access to and renewals of a product license).

Fields
Field Name Description
productNameWithBrand - String! The full name of the product in use, such as "Sourcegraph Enterprise".
actualUserCount - Int! The max number of user accounts that have been active on this Sourcegraph site for the current license. If no license is in use, returns zero.
actualUserCountDate - String! The date and time when the max number of user accounts that have been active on this Sourcegraph site for the current license was reached. If no license is in use, returns an empty string.
maximumAllowedUserCount - Int The number of users allowed. If there is a license, this is equal to ProductLicenseInfo.userCount. Otherwise, it is the user limit for instances without a license, or null if there is no limit.
noLicenseWarningUserCount - Int The number of free users allowed on a site without a license before a warning is shown to all users, or null if a valid license is in use.
license - ProductLicenseInfo The product license associated with this subscription, if any.
Example
{
  "productNameWithBrand": "xyz789",
  "actualUserCount": 123,
  "actualUserCountDate": "abc123",
  "maximumAllowedUserCount": 987,
  "noLicenseWarningUserCount": 123,
  "license": ProductLicenseInfo
}

PublicExternalAccountData

Description

Public provider-specific data about the external account.

Fields
Field Name Description
displayName - String The text name the user is using on the external account, if any.
login - String The login or username the user is using on the external account, if any.
url - String Link to the user profile page for the external account.
Example
{
  "displayName": "xyz789",
  "login": "abc123",
  "url": "abc123"
}

RandomizeUserPasswordResult

Description

The result for Mutation.randomizeUserPassword.

Fields
Field Name Description
resetPasswordURL - String

The reset password URL that the user must visit to sign into their account again. If the builtin username-password authentication provider is not enabled, this field's value is null.

If email sending (SMTP) is configured on this instance, an email containing this URL will also be sent to the primary email address associated with the user.

emailSent - Boolean! If true, then an email with the password reset URL was sent to the primary email address associated with the user. If false, email sending (SMTP) might not be configured on this instance, or an error may have occurred - check the error logs with log scope 'randomizeUserPassword' for more details.
Example
{
  "resetPasswordURL": "xyz789",
  "emailSent": false
}

Range

Description

A range inside a file. The start position is inclusive, and the end position is exclusive.

Fields
Field Name Description
start - Position! The start position of the range (inclusive).
end - Position! The end position of the range (exclusive).
Example
{"start": Position, "end": Position}

Redirect

Description

A reference to another Sourcegraph instance.

Fields
Field Name Description
url - String! The URL of the other Sourcegraph instance.
Example
{"url": "xyz789"}

RegistryExtension

Description

An extension's listing in the extension registry.

Fields
Field Name Description
id - ID! The unique, opaque, permanent ID of the extension. Do not display this ID to the user; display RegistryExtension.extensionID instead (it is friendlier and still unique, but it can be renamed).
extensionID - String! The qualified, unique name that refers to this extension, consisting of the registry name (if non-default), publisher's name, and the extension's name, all joined by "/" (for example, "acme-corp/my-extension-name").
manifest - ExtensionManifest The extension manifest, or null if none is set.
Example
{
  "id": 4,
  "extensionID": "abc123",
  "manifest": ExtensionManifest
}

RegistryExtensionConnection

Description

A list of registry extensions.

Fields
Field Name Description
nodes - [RegistryExtension!]! A list of registry extensions.
Example
{"nodes": [RegistryExtension]}

RepoCorruptionLog

Description

A corruption log entry that that records the time of when corruption was detected and a reason why the repo is regarded as corrupt

Fields
Field Name Description
timestamp - DateTime! The time at which the repository was detected to be corrupt
reason - String! The reason why this repository was regarded as corrupt
Example
{
  "timestamp": "2007-12-03T10:15:30Z",
  "reason": "abc123"
}

Repository

Description

A repository is a Git source control repository that is mirrored from some origin code host.

Fields
Field Name Description
id - ID! The repository's unique ID.
name - String!

The repository's name, as a path with one or more components. It conventionally consists of the repository's hostname and path (joined by "/"), minus any suffixes (such as ".git"). Examples:

  • github.com/foo/bar
  • my-code-host.example.com/myrepo
  • myrepo
uri - String! DEPRECATED: Use name. Use name.
description - String! The repository's description.
language - String! The primary programming language in the repository.
createdAt - DateTime! DEPRECATED: This field is unused in known clients. The date when this repository was created on Sourcegraph.
updatedAt - DateTime DEPRECATED: This field is unused in known clients. The date when this repository's metadata was last updated on Sourcegraph.
commit - GitCommit Returns information about the given commit in the repository, or null if no commit exists with the given rev.
Arguments
rev - String!

The Git revision specifier (revspec) for the commit.

inputRevspec - String

Optional input revspec used to construct non-canonical URLs and other "friendly" field values. Used by clients that must ensure consistency of revision resolution within a session/request (so they use full SHAs) but also preserve the user input rev (for user friendliness).

firstEverCommit - GitCommit The first commit inside the repo
mirrorInfo - MirrorRepositoryInfo! Information and status related to mirroring, if this repository is a mirror of another repository (e.g., on some code host). In this case, the remote source repository is external to Sourcegraph and the mirror is maintained by the Sourcegraph site (not the other way around).
externalRepository - ExternalRepository! Information about this repository from the external service that it originates from (such as GitHub, GitLab, Phabricator, etc.).
isFork - Boolean! Whether the repository is a fork.
isArchived - Boolean! Whether the repository has been archived.
isPrivate - Boolean! Whether the repository is private.
externalServices - ExternalServiceConnection! Lists all external services which yield this repository.
Arguments
first - Int

Returns the first n external services from the list.

cloneInProgress - Boolean! Whether the repository is currently being cloned. use Repository.mirrorInfo.cloneInProgress instead
textSearchIndex - RepositoryTextSearchIndex Information about the text search index for this repository, or null if text search indexing is not enabled or supported for this repository.
url - String! The URL to this repository.
externalURLs - [ExternalLink!]! The URLs to this repository on external services associated with it.
defaultBranch - GitRef The repository's default Git branch (HEAD symbolic ref). If the repository is currently being cloned or is empty, this field will be null.
gitRefs - GitRefConnection! The repository's Git refs.
Arguments
first - Int

Returns the first n Git refs from the list.

query - String

Return Git refs whose names match the query.

type - GitRefType

Return only Git refs of the given type. Known issue: It is only supported to retrieve Git branch and tag refs, not other Git refs.

orderBy - GitRefOrder

Ordering for Git refs in the list.

interactive - Boolean

Ordering is an expensive operation that doesn't scale for lots of references. If this is true we fallback on not ordering. This should never be false in interactive API requests.

branches - GitRefConnection! The repository's Git branches.
Arguments
first - Int

Returns the first n Git branches from the list.

query - String

Return Git branches whose names match the query.

orderBy - GitRefOrder

Ordering for Git branches in the list.

interactive - Boolean

Ordering is an expensive operation that doesn't scale for lots of references. If this is true we fallback on not ordering. This should never be false in interactive API requests.

tags - GitRefConnection! The repository's Git tags.
Arguments
first - Int

Returns the first n Git tags from the list.

query - String

Return Git tags whose names match the query.

comparison - RepositoryComparison! A Git comparison in this repository between a base and head commit.
Arguments
base - String

The base of the diff ("old" or "left-hand side"), or "HEAD" if not specified.

head - String

The head of the diff ("new" or "right-hand side"), or "HEAD" if not specified.

fetchMissing - Boolean

Attempt to fetch missing revisions from remote if they are not found

contributors - RepositoryContributorConnection! The repository's contributors.
Arguments
revisionRange - String

The Git revision range to compute contributors in.

afterDate - String

The date after which to count contributions.

path - String

Return contributors to files in this path.

first - Int

Returns the first n contributors from the list.

last - Int
after - String
before - String
viewerCanAdminister - Boolean! Whether the viewer has admin privileges on this repository.
label - Markdown! A markdown string that is rendered prominently.
detail - Markdown! A markdown string of that is rendered less prominently.
matches - [SearchResultMatch!]! The result previews of the result.
codeIntelligenceCommitGraph - CodeIntelligenceCommitGraph! Information and status related to the commit graph of this repository calculated for use by code intelligence features.
stars - Int! The star count the repository has in the code host.
keyValuePairs - [KeyValuePair!]! A set of user-defined key-value pairs associated with the repo.
diskSizeBytes - BigInt The size of repo when cloned on disk
Example
{
  "id": 4,
  "name": "abc123",
  "uri": "xyz789",
  "description": "abc123",
  "language": "abc123",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "commit": GitCommit,
  "firstEverCommit": GitCommit,
  "mirrorInfo": MirrorRepositoryInfo,
  "externalRepository": ExternalRepository,
  "isFork": true,
  "isArchived": true,
  "isPrivate": false,
  "externalServices": ExternalServiceConnection,
  "cloneInProgress": false,
  "textSearchIndex": RepositoryTextSearchIndex,
  "url": "xyz789",
  "externalURLs": [ExternalLink],
  "defaultBranch": GitRef,
  "gitRefs": GitRefConnection,
  "branches": GitRefConnection,
  "tags": GitRefConnection,
  "comparison": RepositoryComparison,
  "contributors": RepositoryContributorConnection,
  "viewerCanAdminister": false,
  "label": Markdown,
  "detail": Markdown,
  "matches": [SearchResultMatch],
  "codeIntelligenceCommitGraph": CodeIntelligenceCommitGraph,
  "stars": 123,
  "keyValuePairs": [KeyValuePair],
  "diskSizeBytes": {}
}

RepositoryComparison

Description

The differences between two concrete Git commits in a repository.

Fields
Field Name Description
baseRepository - Repository! The repository that is the base (left-hand side) of this comparison.
headRepository - Repository! The repository that is the head (right-hand side) of this comparison. Cross-repository comparisons are not yet supported, so this is always equal to RepositoryComparison.baseRepository.
range - GitRevisionRange! The range that this comparison represents.
commits - GitCommitConnection! The commits in the comparison range, excluding the base and including the head.
Arguments
first - Int

Return the first n commits from the list.

path - String

Filter to only the commits that modify files that match path. Path can be either a file or a containing directory.

fileDiffs - FileDiffConnection! The file diffs for each changed file.
Arguments
first - Int

Return the first n file diffs from the list.

after - String

Return file diffs after the given cursor.

paths - [String!]

A list of paths or directories used to filter the diffs

Example
{
  "baseRepository": Repository,
  "headRepository": Repository,
  "range": GitRevisionRange,
  "commits": GitCommitConnection,
  "fileDiffs": FileDiffConnection
}

RepositoryContributor

Description

A contributor to a repository.

Fields
Field Name Description
person - Person! The personal information for the contributor.
count - Int! The number of contributions made by this contributor.
repository - Repository! The repository in which the contributions occurred.
commits - GitCommitConnection! Commits by the contributor.
Arguments
first - Int

Return the first n commits.

Example
{
  "person": Person,
  "count": 987,
  "repository": Repository,
  "commits": GitCommitConnection
}

RepositoryContributorConnection

Description

A list of contributors to a repository.

Fields
Field Name Description
nodes - [RepositoryContributor!]! A list of contributors to a repository.
totalCount - Int! The total count of contributors in the connection, if available. This total count may be larger than the number of nodes in this object when the result is paginated.
pageInfo - BidirectionalPageInfo! Pagination information.
Example
{
  "nodes": [RepositoryContributor],
  "totalCount": 987,
  "pageInfo": BidirectionalPageInfo
}

RepositoryOrderBy

Description

RepositoryOrderBy enumerates the ways a repositories list can be ordered.

Values
Enum Value Description

REPOSITORY_NAME

REPO_CREATED_AT

REPOSITORY_CREATED_AT

deprecated (use the equivalent REPOSITORY_CREATED_AT)

SIZE

Example
"REPOSITORY_NAME"

RepositoryRedirect

Description

A repository or a link to another Sourcegraph instance location where this repository may be located.

Types
Union Types

Repository

Redirect

Example
Repository

RepositoryStats

Description

FOR INTERNAL USE ONLY: A repository statistic

Fields
Field Name Description
gitDirBytes - BigInt! The amount of bytes stored in .git directories
indexedLinesCount - BigInt! The number of lines indexed
total - Int! The number of all repositories in the instance, without soft-deleted or blocked repositories.
cloned - Int! The number of cloned repositories in the instance. This number might be higher than 'total', if soft-deleted repositories haven't been cleaned up yet.
cloning - Int! The number of repositories in the instance that are currently being cloned.
notCloned - Int! The number of repositories in the instance that not cloned yet.
failedFetch - Int! The number of repositories where initial cloning or subsequent fetching resulted in an error.
indexed - Int! The number of indexed repositories
corrupted - Int! The number of repositories that are currently corrupt
Example
{
  "gitDirBytes": {},
  "indexedLinesCount": {},
  "total": 987,
  "cloned": 123,
  "cloning": 123,
  "notCloned": 987,
  "failedFetch": 987,
  "indexed": 123,
  "corrupted": 123
}

RepositoryTextSearchIndex

Description

Information about a repository's text search index.

Fields
Field Name Description
repository - Repository! The indexed repository.
status - RepositoryTextSearchIndexStatus The status of the text search index, if available.
refs - [RepositoryTextSearchIndexedRef!]! Git refs in the repository that are configured for text search indexing.
host - repositoryIndexserverHost Information about the indexserver that hosts the repo's index.
Example
{
  "repository": Repository,
  "status": RepositoryTextSearchIndexStatus,
  "refs": [RepositoryTextSearchIndexedRef],
  "host": repositoryIndexserverHost
}

RepositoryTextSearchIndexStatus

Description

The status of a repository's text search index.

Fields
Field Name Description
updatedAt - DateTime! The date that the index was last updated.
contentByteSize - BigInt! The byte size of the original content.
contentFilesCount - Int! The number of files in the original content.
indexByteSize - Int! The byte size of the index.
indexShardsCount - Int! The number of index shards.
newLinesCount - Int! EXPERIMENTAL: The number of newlines appearing in the index.
defaultBranchNewLinesCount - Int! EXPERIMENTAL: The number of newlines in the default branch.
otherBranchesNewLinesCount - Int! EXPERIMENTAL: The number of newlines in the other branches.
Example
{
  "updatedAt": "2007-12-03T10:15:30Z",
  "contentByteSize": {},
  "contentFilesCount": 123,
  "indexByteSize": 987,
  "indexShardsCount": 987,
  "newLinesCount": 123,
  "defaultBranchNewLinesCount": 123,
  "otherBranchesNewLinesCount": 123
}

RepositoryTextSearchIndexedRef

Description

A Git ref (usually a branch) in a repository that is configured to be indexed for text search.

Fields
Field Name Description
ref - GitRef! The Git ref (usually a branch) that is configured to be indexed for text search. To find the specific commit SHA that was indexed, use RepositoryTextSearchIndexedRef.indexedCommit; this field's ref target resolves to the current target, not the target at the time of indexing.
indexed - Boolean! Whether a text search index exists for this ref.
current - Boolean! Whether the text search index is of the current commit for the Git ref. If false, the index is stale.
indexedCommit - GitObject The indexed Git commit (which may differ from the ref's current target if the index is out of date). If indexed is false, this field's value is null.
skippedIndexed - SkippedIndexed EXPERIMENTAL: Information about the files that were not indexed.
Example
{
  "ref": GitRef,
  "indexed": false,
  "current": true,
  "indexedCommit": GitObject,
  "skippedIndexed": SkippedIndexed
}

SavedSearch

Description

A saved search query, defined in settings.

Fields
Field Name Description
id - ID! The unique ID of this saved query.
description - String! The description.
query - String! The query.
notify - Boolean! Whether or not to notify the owner of the saved search via email. This owner is either a single user, or every member of an organization that owns the saved search.
notifySlack - Boolean! Whether or not to notify on Slack.
namespace - Namespace! The user or org that owns this saved search.
slackWebhookURL - String The Slack webhook URL associated with this saved search, if any.
Example
{
  "id": 4,
  "description": "xyz789",
  "query": "abc123",
  "notify": true,
  "notifySlack": true,
  "namespace": Namespace,
  "slackWebhookURL": "xyz789"
}

SavedSearchesConnection

Description

A paginated connection for saved search queries, defined in settings.

Fields
Field Name Description
nodes - [SavedSearch!]! A list of saved searches.
totalCount - Int! The total number of saved searches in the connection.
pageInfo - ConnectionPageInfo! Pagination information.
Example
{
  "nodes": [SavedSearch],
  "totalCount": 987,
  "pageInfo": ConnectionPageInfo
}

SearchAlert

Description

A search-related alert message.

Fields
Field Name Description
title - String! The title.
description - String The description.
kind - String An identifier indicating the kind of alert
proposedQueries - [SearchQueryDescription!] "Did you mean: ____" query proposals
Example
{
  "title": "xyz789",
  "description": "abc123",
  "kind": "abc123",
  "proposedQueries": [SearchQueryDescription]
}

SearchFilter

Description

A search filter.

Fields
Field Name Description
value - String! The value.
label - String! The string to be displayed in the UI.
count - Int! Number of matches for a given filter.
limitHit - Boolean! Whether the results returned are incomplete.
kind - String! The kind of filter. Should be "file" or "repo".
Example
{
  "value": "xyz789",
  "label": "abc123",
  "count": 987,
  "limitHit": true,
  "kind": "abc123"
}

SearchPatternType

Description

The search pattern type.

Values
Enum Value Description

standard

literal

regexp

structural

lucky

keyword

Example
"standard"

SearchQueryAnnotation

Description

Additional information describing attributes of a query.

Fields
Field Name Description
name - String! A name for this query annotation label.
value - String! An opaque value for this query annotation.
Example
{
  "name": "xyz789",
  "value": "abc123"
}

SearchQueryDescription

Description

A search query description.

Fields
Field Name Description
description - String The description.
query - String! The query.
annotations - [SearchQueryAnnotation!] Additional optional information describing attributes of this query.
Example
{
  "description": "abc123",
  "query": "xyz789",
  "annotations": [SearchQueryAnnotation]
}

SearchQueryOutputFormat

Description

The output format to emit for a parsed query.

Values
Enum Value Description

JSON

JSON format.

SEXP

S-expression format.

MERMAID

Mermaid flowchart format.
Example
"JSON"

SearchQueryOutputPhase

Description

Represents phases in query parsing. The parse tree corresponds closely to the input query syntax. A subsequent processing phase on the parse tree generates a job tree. The job tree is an internal representation analogous to a database query plan. The job tree discards information about query syntax and corresponds closely to backend services (text search, git commit search, etc.).

Values
Enum Value Description

PARSE_TREE

JOB_TREE

Example
"PARSE_TREE"

SearchQueryOutputVerbosity

Description

The output format to emit for a parsed query.

Values
Enum Value Description

MINIMAL

Minimal verbosity outputs only nodes.

BASIC

Basic verbosity outputs nodes and essential fields associated with nodes.

MAXIMAL

Maximal verbosity outputs nodes and all information associated with nodes.
Example
"MINIMAL"

SearchResult

Description

A search result.

Example
FileMatch

SearchResultMatch

Description

A match in a search result. Matches make up the body content of a search result.

Fields
Field Name Description
url - String! URL for the individual result match.
body - Markdown! A markdown string containing the preview contents of the result match.
highlights - [Highlight!]! A list of highlights that specify locations of matches of the query in the body. Each highlight is a line number, character offset, and length. Currently, highlights are only displayed on match bodies that are code blocks. If the result body is a code block, exclude the markdown code fence lines in the line and character count. Leave as an empty list if no highlights are available.
Example
{
  "url": "abc123",
  "body": Markdown,
  "highlights": [Highlight]
}

SearchResults

Description

Search results.

Fields
Field Name Description
results - [SearchResult!]! The results. Inside each SearchResult there may be multiple matches, e.g. a FileMatch may contain multiple line matches.
matchCount - Int! The total number of matches returned by this search. This is different than the length of the results array in that e.g. a single results array entry may contain multiple matches. For example, the results array may contain two file matches and this field would report 6 ("3 line matches per file") while the length of the results array would report 3 ("3 FileMatch results"). Typically, 'approximateResultCount', not this field, is shown to users.
resultCount - Int! DEPRECATED: Renamed to 'matchCount' for less ambiguity. renamed to matchCount for less ambiguity
approximateResultCount - String! The approximate number of results. This is like the length of the results array, except it can indicate the number of results regardless of whether or not the limit was hit. Currently, this is represented as e.g. "5+" results. This string is typically shown to users to indicate the true result count.
limitHit - Boolean! Whether or not the results limit was hit. In paginated requests, this field is always false. Use 'pageInfo.hasNextPage' instead.
sparkline - [Int!]! Integers representing the sparkline for the search results.
repositories - [Repository!]! Repositories from results.
repositoriesCount - Int! The number of repositories that had results (for clients that just wish to know how many without querying the, sometimes extremely large, list).
cloning - [Repository!]! Repositories that are busy cloning onto gitserver. In paginated search requests, some repositories may be cloning. These are reported here and you may choose to retry the paginated request with the same cursor after they have cloned OR you may simply continue making further paginated requests and choose to skip the cloning repositories.
missing - [Repository!]! Repositories or commits that do not exist. In paginated search requests, some repositories may be missing (e.g. if Sourcegraph is aware of them but is temporarily unable to serve them). These are reported here and you may choose to retry the paginated request with the same cursor and they may no longer be missing OR you may simply continue making further paginated requests and choose to skip the missing repositories.
timedout - [Repository!]! Repositories or commits which we did not manage to search in time. Trying again usually will work. In paginated search requests, this field is not relevant.
indexUnavailable - Boolean! DEPRECATED: This field is not used in known clients, and will always return false. True if indexed search is enabled but was not available during this search.
alert - SearchAlert An alert message that should be displayed before any results.
elapsedMilliseconds - Int! The time it took to generate these results.
dynamicFilters - [SearchFilter!]! Dynamic filters generated by the search results
Example
{
  "results": [FileMatch],
  "matchCount": 123,
  "resultCount": 123,
  "approximateResultCount": "abc123",
  "limitHit": true,
  "sparkline": [987],
  "repositories": [Repository],
  "repositoriesCount": 987,
  "cloning": [Repository],
  "missing": [Repository],
  "timedout": [Repository],
  "indexUnavailable": true,
  "alert": SearchAlert,
  "elapsedMilliseconds": 987,
  "dynamicFilters": [SearchFilter]
}

SearchResultsStats

Description

Statistics about search results.

Fields
Field Name Description
approximateResultCount - String! The approximate number of results returned.
sparkline - [Int!]! The sparkline.
languages - [LanguageStatistics!]! Statistics about the languages represented in the search results. Known issue: The LanguageStatistics.totalBytes field values are incorrect in the result.
Example
{
  "approximateResultCount": "xyz789",
  "sparkline": [987],
  "languages": [LanguageStatistics]
}

SearchVersion

Description

The version of the search syntax.

Values
Enum Value Description

V1

Search syntax that defaults to regexp search.

V2

Search syntax that defaults to literal-only search.

V3

Search syntax that defaults to standard search.
Example
"V1"

Session

Description

An active user session.

Fields
Field Name Description
canSignOut - Boolean! Whether the user can sign out of this session on Sourcegraph.
Example
{"canSignOut": true}

Settings

Description

Settings is a version of a configuration settings file.

Fields
Field Name Description
id - Int! The ID.
subject - SettingsSubject! The subject that these settings are for.
author - User The author, or null if there is no author or the authoring user was deleted.
createdAt - DateTime! The time when this was created.
contents - JSONCString! The stringified JSON contents of the settings. The contents may include "//"-style comments and trailing commas in the JSON.
configuration - Configuration! DEPRECATED: This field will be removed in a future release. The configuration. use the contents field instead
Example
{
  "id": 987,
  "subject": SettingsSubject,
  "author": User,
  "createdAt": "2007-12-03T10:15:30Z",
  "contents": JSONCString,
  "configuration": Configuration
}

SettingsCascade

Description

The configurations for all of the relevant settings subjects, plus the merged settings.

Fields
Field Name Description
subjects - [SettingsSubject!]! The other settings subjects that are applied with lower precedence than this subject to form the final merged settings. For example, a user in 2 organizations would have the following settings subjects: site (global settings), org 1, org 2, and the user.
final - String! The effective final merged settings as (stringified) JSON, merged from all of the subjects.
merged - Configuration! DEPRECATED: This field will be removed in a future release. The effective final merged settings, merged from all of the subjects. use final instead
Example
{
  "subjects": [SettingsSubject],
  "final": "xyz789",
  "merged": Configuration
}

SettingsEdit

Description

An edit to a JSON property in a settings JSON object. The JSON property to edit can be nested.

Fields
Input Field Description
keyPath - [KeyPathSegment!]!

The key path of the property to update.

Inserting into an existing array is not yet supported.

value - JSONValue

The new JSON-encoded value to insert. If the field's value is not set, the property is removed. (This is different from the field's value being the JSON null value.)

When the value is a non-primitive type, it must be specified using a GraphQL variable, not an inline literal, or else the GraphQL parser will return an error.

valueIsJSONCEncodedString - Boolean Whether to treat the value as a JSONC-encoded string, which makes it possible to perform an edit that preserves (or adds/removes) comments. Default = false
Example
{
  "keyPath": [KeyPathSegment],
  "value": JSONValue,
  "valueIsJSONCEncodedString": true
}

SettingsMutation

Description

Mutations that update settings (global, organization, or user settings). These mutations are grouped together because they:

  • are all versioned to avoid race conditions with concurrent editors
  • all apply to a specific settings subject (i.e., a user, an organization, or the whole site)

Grouping them lets us extract those common parameters to the Mutation.settingsMutation field.

Fields
Field Name Description
editSettings - UpdateSettingsPayload Edit a single property in the settings object.
Arguments
edit - SettingsEdit!

The edit to apply to the settings.

editConfiguration - UpdateSettingsPayload DEPRECATED Use editSettings instead. This field is a deprecated alias for it and will be removed in a future release.
Arguments
overwriteSettings - UpdateSettingsPayload Overwrite the existing settings with the new settings.
Arguments
contents - String!

A JSON object (stringified) of the settings. Trailing commas and "//"-style comments are supported. The entire previous settings value will be overwritten by this new value.

Example
{
  "editSettings": UpdateSettingsPayload,
  "editConfiguration": UpdateSettingsPayload,
  "overwriteSettings": UpdateSettingsPayload
}

SettingsMutationGroupInput

Description

Input for Mutation.settingsMutation, which contains fields that all settings (global, organization, and user settings) mutations need.

Fields
Input Field Description
subject - ID! The subject whose settings to mutate (organization, user, etc.).
lastID - Int The ID of the last-known settings known to the client, or null if there is none. This field is used to prevent race conditions when there are concurrent editors.
Example
{"subject": 4, "lastID": 987}

SettingsSubject

Description

SettingsSubject is something that can have settings: a site ("global settings", which is different from "site configuration"), an organization, or a user.

Fields
Field Name Description
id - ID! The ID.
latestSettings - Settings The latest settings.
settingsURL - String The URL to the settings.
viewerCanAdminister - Boolean! Whether the viewer can modify the subject's settings.
settingsCascade - SettingsCascade! All settings for this subject, and the individual levels in the settings cascade (global > organization > user) that were merged to produce the final merged settings.
configurationCascade - ConfigurationCascade! DEPRECATED Use settingsCascade instead. This field is a deprecated alias for it and will be removed in a future release.
Possible Types
SettingsSubject Types

User

Org

DefaultSettings

Site

Example
{
  "id": 4,
  "latestSettings": Settings,
  "settingsURL": "xyz789",
  "viewerCanAdminister": true,
  "settingsCascade": SettingsCascade,
  "configurationCascade": ConfigurationCascade
}

Signature

Description

A signature.

Fields
Field Name Description
person - Person! The person.
date - String! The date.
Example
{
  "person": Person,
  "date": "abc123"
}

Site

Description

A site is an installation of Sourcegraph that consists of one or more servers that share the same configuration and database. The site is a singleton; the API only ever returns the single global site.

Fields
Field Name Description
id - ID! The site's opaque GraphQL ID. This is NOT the "site ID" as it is referred to elsewhere; use the siteID field for that. (GraphQL node types conventionally have an id field of type ID! that globally identifies the node.)
siteID - String! The site ID.
configuration - SiteConfiguration! The site's configuration. Only visible to site admins.
latestSettings - Settings The site's latest site-wide settings (which are the second-lowest-precedence in the configuration cascade for a user).
settingsCascade - SettingsCascade! The global settings for this site, and the final merged settings. All viewers can access this field.
configurationCascade - ConfigurationCascade! DEPRECATED Use settingsCascade instead. This field is a deprecated alias for it and will be removed in a future release.
settingsURL - String The URL to the site's settings.
canReloadSite - Boolean! Whether the viewer can reload the site (with the reloadSite mutation).
viewerCanAdminister - Boolean! Whether the viewer can modify the subject's settings.
accessTokens - AccessTokenConnection! A list of all access tokens on this site.
Arguments
first - Int

Returns the first n access tokens from the list.

authProviders - AuthProviderConnection! A list of all authentication providers. This information is visible to all viewers and does not contain any secret information.
externalAccounts - ExternalAccountConnection! A list of all user external accounts on this site.
Arguments
first - Int

Returns the first n external accounts from the list.

user - ID

Include only external accounts associated with this user.

serviceType - String

Include only external accounts with this service type.

serviceID - String

Include only external accounts with this service ID.

clientID - String

Include only external accounts with this client ID.

buildVersion - String! The build version of the Sourcegraph software that is running on this site (of the form NNNNN_YYYY-MM-DD_XXXXX, like 12345_2018-01-01_abcdef).
productVersion - String! The product version of the Sourcegraph software that is running on this site.
updateCheck - UpdateCheck! Information about software updates for the version of Sourcegraph that this site is running.
needsRepositoryConfiguration - Boolean! Whether the site needs to be configured to add repositories.
externalServicesFromFile - Boolean! Whether the external services haven been created from a configuration file specified in the EXTSVC_CONFIG_FILE.
allowEditExternalServicesWithFile - Boolean! Whether the external services can be updated even if externalServicesFromFile is true. All changes made while externalServicesFromFile is true will be discarded once Sourcegraph restarts.
freeUsersExceeded - Boolean! Whether the site is over the limit for free user accounts, and a warning needs to be shown to all users. Only applies if the site does not have a valid license.
alerts - [Alert!]! Alerts to display to the viewer.
hasCodeIntelligence - Boolean! BACKCOMPAT: Always returns true.
sendsEmailVerificationEmails - Boolean! Whether the server sends emails to users to verify email addresses. If false, then site admins must manually verify users' email addresses.
productSubscription - ProductSubscriptionStatus! Information about this site's product subscription status.
usageStatistics - SiteUsageStatistics! Usage statistics for this site.
Arguments
days - Int

Days of history (based on current UTC time).

weeks - Int

Weeks of history (based on current UTC time).

months - Int

Months of history (based on current UTC time).

analytics - Analytics! New usage statistics/analytics for this site.
users - SiteUsers! List all users.
Arguments
query - String

Return users whose usernames or display names match the query.

siteAdmin - Boolean

Returns users who have been active in a given period of time.

username - String

Returns users that contain filter in the username field.

email - String

Returns users that contain filter in the email field.

lastActiveAt - SiteUsersDateRangeInput

Returns users for the given lastActive enum period. When omitted does NOT apply and returns for all period available.

deletedAt - SiteUsersDateRangeInput

Returns either deleted or not deleted users. Returns all users when omitted.

createdAt - SiteUsersDateRangeInput

Returns users who where created within a given date time range.

eventsCount - SiteUsersNumberRangeInput

Returns users whose events count within a given range.

monitoringStatistics - MonitoringStatistics! Monitoring overview for this site. Note: This is primarily used for displaying recently-fired alerts in the web app. If your intent is to monitor Sourcegraph, it is better to configure alerting or query Prometheus directly in order to ensure that if the frontend goes down you still receive alerts: Configure alerting: https://docs.sourcegraph.com/admin/observability/alerting Query Prometheus directly: https://docs.sourcegraph.com/admin/observability/alerting_custom_consumption
allowSiteSettingsEdits - Boolean! Whether changes can be made to site settings through the API. When global settings are configured through the GLOBAL_SETTINGS_FILE environment variable, site settings edits cannot be made through the API.
enableLegacyExtensions - Boolean! Whether to enable the extension registry and the use of extensions. Reflects the site configuration enableLegacyExtensions experimental feature value.
upgradeReadiness - UpgradeReadiness! FOR INTERNAL USE ONLY: Returns information about instance upgrade readiness.
Example
{
  "id": 4,
  "siteID": "abc123",
  "configuration": SiteConfiguration,
  "latestSettings": Settings,
  "settingsCascade": SettingsCascade,
  "configurationCascade": ConfigurationCascade,
  "settingsURL": "abc123",
  "canReloadSite": true,
  "viewerCanAdminister": false,
  "accessTokens": AccessTokenConnection,
  "authProviders": AuthProviderConnection,
  "externalAccounts": ExternalAccountConnection,
  "buildVersion": "xyz789",
  "productVersion": "xyz789",
  "updateCheck": UpdateCheck,
  "needsRepositoryConfiguration": true,
  "externalServicesFromFile": true,
  "allowEditExternalServicesWithFile": true,
  "freeUsersExceeded": true,
  "alerts": [Alert],
  "hasCodeIntelligence": true,
  "sendsEmailVerificationEmails": true,
  "productSubscription": ProductSubscriptionStatus,
  "usageStatistics": SiteUsageStatistics,
  "analytics": Analytics,
  "users": SiteUsers,
  "monitoringStatistics": MonitoringStatistics,
  "allowSiteSettingsEdits": true,
  "enableLegacyExtensions": false,
  "upgradeReadiness": UpgradeReadiness
}

SiteConfiguration

Description

The configuration for a site.

Fields
Field Name Description
id - Int! The unique identifier of this site configuration version.
effectiveContents - JSONCString! The effective configuration JSON.
validationMessages - [String!]! Messages describing validation problems or usage of deprecated configuration in the configuration JSON. This includes both JSON Schema validation problems and other messages that perform more advanced checks on the configuration (that can't be expressed in the JSON Schema).
history - SiteConfigurationChangeConnection EXPERIMENTAL: A list of diffs to depict what changed since the previous version of this configuration. Only site admins may perform this query.
Arguments
first - Int

The number of nodes to return starting from the beginning (oldest). Note: Use either first or last (see below) in the query. Setting both will return an error.

last - Int

The number of nodes to return starting from the end (latest). Note: Use either last or first (see above) in the query. Setting both will return an error.

after - String

Opaque pagination cursor to be used when paginating forwards that may be also used in conjunction with "first" to return the first N nodes.

before - String

Opaque pagination cursor to be used when paginating backwards that may be also used in conjunction with "last" to return the last N nodes.

Example
{
  "id": 123,
  "effectiveContents": JSONCString,
  "validationMessages": ["abc123"],
  "history": SiteConfigurationChangeConnection
}

SiteConfigurationChange

Description

A diff representing the change in the site config compared to the previous version.

Fields
Field Name Description
id - ID! The ID of the site config in the history.
author - User The user who made this change. If empty, it indicates that either the author's information is not available or the change in the site config was applied via an internal process (example: site startup or SITE_CONFIG_FILE being reloaded).
reproducedDiff - Boolean! A flag to indicate if the diff of changes to the previous site configuration was reproduced or not. Sometimes it may not be possible to generate a diff (for example the redacted contents are not available) in which case the value of the flag will be false.
diff - String The diff string when diffed against the previous site config. When this is null there was no diff to the previous change.
createdAt - DateTime! The timestamp when this change in the site config was applied.
updatedAt - DateTime! The timestamp when this change in the site config was modified. Usually this should be the same as createdAt as entries in the site config history are considered immutable.
Example
{
  "id": "4",
  "author": User,
  "reproducedDiff": true,
  "diff": "abc123",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z"
}

SiteConfigurationChangeConnection

Description

A list of site config diffs.

Fields
Field Name Description
nodes - [SiteConfigurationChange!]! A list of diffs in the site config
totalCount - Int! The total number of diffs in the connection.
pageInfo - ConnectionPageInfo! Pagination information.
Example
{
  "nodes": [SiteConfigurationChange],
  "totalCount": 123,
  "pageInfo": ConnectionPageInfo
}

SiteUsagePeriod

Description

SiteUsagePeriod describes a site's usage statistics for a given timespan. This information is visible to all viewers.

Fields
Field Name Description
startTime - String! The time when this started.
userCount - Int! The user count.
registeredUserCount - Int! The registered user count.
anonymousUserCount - Int! The anonymous user count.
integrationUserCount - Int! The count of registered users that have been active on a code host integration. Excludes anonymous users.
Example
{
  "startTime": "abc123",
  "userCount": 123,
  "registeredUserCount": 123,
  "anonymousUserCount": 987,
  "integrationUserCount": 123
}

SiteUsageStatistics

Description

SiteUsageStatistics describes a site's aggregate usage statistics. This information is visible to all viewers.

Fields
Field Name Description
daus - [SiteUsagePeriod!]! Recent daily active users.
waus - [SiteUsagePeriod!]! Recent weekly active users.
maus - [SiteUsagePeriod!]! Recent monthly active users.
Example
{
  "daus": [SiteUsagePeriod],
  "waus": [SiteUsagePeriod],
  "maus": [SiteUsagePeriod]
}

SiteUser

Description

Site user.

Fields
Field Name Description
id - ID! The unique ID for the user.
username - String! User's username.
email - String User's primary email.
displayName - String User's display name
createdAt - String! The datetime when user was created in the system.
lastActiveAt - String The datetime when user was last active.
deletedAt - String The datetime when user was deleted.
siteAdmin - Boolean! Whether user is site admin or not.
eventsCount - Float! Total number of user's event_logs.
locked - Boolean! Whether or not the user account is locked.
Example
{
  "id": 4,
  "username": "abc123",
  "email": "xyz789",
  "displayName": "abc123",
  "createdAt": "xyz789",
  "lastActiveAt": "abc123",
  "deletedAt": "abc123",
  "siteAdmin": true,
  "eventsCount": 123.45,
  "locked": true
}

SiteUserOrderBy

Description

SiteUserOrderBy enumerates the ways a users list can be ordered.

Values
Enum Value Description

USERNAME

EMAIL

User's primary email.

EVENTS_COUNT

The total number of user's event_logs.

LAST_ACTIVE_AT

The last event_log datetime.

CREATED_AT

The datetime when user was added to the system.

DELETED_AT

The datetime when user was soft deleted.

SITE_ADMIN

Whether the user is site admin or not.
Example
"USERNAME"

SiteUsers

Description

Site users.

Fields
Field Name Description
totalCount - Float! User total count.
nodes - [SiteUser!]! List of users.
Arguments
limit - Int

Returns the "limit" number users from the list.

offset - Int

Skips initial "offset" number of users.

orderBy - SiteUserOrderBy

Returns users ordered by a given column.

descending - Boolean

Returns ordered users in descending order provided by orderBy field.

Example
{"totalCount": 987.65, "nodes": [SiteUser]}

SiteUsersDateRangeInput

Description

SiteUsersDateRangeInput argument to filter based on date range or date equals to null

Fields
Input Field Description
lte - DateTime Less than or equal to
gte - DateTime Greater than or equal to
not - Boolean Negation
empty - Boolean Equal to Null
Example
{
  "lte": "2007-12-03T10:15:30Z",
  "gte": "2007-12-03T10:15:30Z",
  "not": false,
  "empty": false
}

SiteUsersNumberRangeInput

Description

SiteUsersNumberRangeInput argument to filter based on the number range

Fields
Input Field Description
gte - Float Less than or equal to
lte - Float Greater than or equal to
Example
{"gte": 123.45, "lte": 123.45}

SkippedIndexed

Description

EXPERIMENTAL: Information about the files that were not indexed.

Fields
Field Name Description
count - BigInt! The count of files that were not indexed.
query - String! The query to retrieve the list of files that were not indexed.
Example
{"count": {}, "query": "abc123"}

SlowRequest

Description

A logged slow GraphQL request, captured by the backend.

Fields
Field Name Description
index - String! The index of this request.
start - DateTime! The date at which this request was started.
duration - Float! The duration of the request.
user - User The user associated with that request, if any.
name - String! The name of the GraphQL request.
source - String! The source from which the request originated.
repository - Repository The repository referenced by the request, if any.
variables - String! The variables used to build the GraphQL request.
errors - [String!]! The errors returned if the request failed.
query - String! The GraphQL query.
filepath - String The file path referenced by the request, if any.
Example
{
  "index": "xyz789",
  "start": "2007-12-03T10:15:30Z",
  "duration": 123.45,
  "user": User,
  "name": "abc123",
  "source": "abc123",
  "repository": Repository,
  "variables": "abc123",
  "errors": ["xyz789"],
  "query": "abc123",
  "filepath": "xyz789"
}

SlowRequestConnection

Description

The result for Query.slowRequests.

Fields
Field Name Description
nodes - [SlowRequest!]! A list of slow graphql requests logs.
totalCount - Int! The total number of slow graphql logs in the connection.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [SlowRequest],
  "totalCount": 123,
  "pageInfo": PageInfo
}

StatusMessage

Description

FOR INTERNAL USE ONLY: A status message

Example
GitUpdatesDisabled

String

Description

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Example
"abc123"

Submodule

Description

A Git submodule

Fields
Field Name Description
url - String! The remote repository URL of the submodule.
commit - String! The commit of the submodule.
path - String! The path to which the submodule is checked out.
Example
{
  "url": "abc123",
  "commit": "xyz789",
  "path": "xyz789"
}

SurveyResponse

Description

An individual response to a user satisfaction (NPS) survey.

Fields
Field Name Description
id - ID! The unique ID of the survey response
user - User The user who submitted the survey (if they were authenticated at the time).
email - String The email that the user manually entered (if they were NOT authenticated at the time).
score - Int! User's likelihood of recommending Sourcegraph to a friend, from 0-10.
reason - String The answer to "What is the most important reason for the score you gave".
better - String The answer to "What can Sourcegraph do to provide a better product"
otherUseCase - String The answer to "What do you use Sourcegraph for?".
createdAt - DateTime! The time when this response was created.
Example
{
  "id": "4",
  "user": User,
  "email": "xyz789",
  "score": 123,
  "reason": "xyz789",
  "better": "xyz789",
  "otherUseCase": "abc123",
  "createdAt": "2007-12-03T10:15:30Z"
}

SurveyResponseConnection

Description

A list of survey responses

Fields
Field Name Description
nodes - [SurveyResponse!]! A list of survey responses.
totalCount - Int! The total count of survey responses in the connection. This total count may be larger than the number of nodes in this object when the result is paginated.
last30DaysCount - Int! The count of survey responses submitted since 30 calendar days ago at 00:00 UTC.
averageScore - Float! The average score of survey responses in the connection submitted since 30 calendar days ago at 00:00 UTC.
netPromoterScore - Int! The net promoter score (NPS) of survey responses in the connection submitted since 30 calendar days ago at 00:00 UTC. Return value is a signed integer, scaled from -100 (all detractors) to +100 (all promoters). See https://en.wikipedia.org/wiki/Net_Promoter for explanation.
Example
{
  "nodes": [SurveyResponse],
  "totalCount": 123,
  "last30DaysCount": 123,
  "averageScore": 987.65,
  "netPromoterScore": 987
}

SurveySubmissionInput

Description

Input for a user satisfaction (NPS) survey submission.

Fields
Input Field Description
email - String User-provided email address, if there is no currently authenticated user. If there is, this value will not be used.
score - Int! User's likelihood of recommending Sourcegraph to a friend, from 0-10.
otherUseCase - String The answer to "What do you use Sourcegraph for?".
better - String The answer to "What would make Sourcegraph better?"
Example
{
  "email": "xyz789",
  "score": 987,
  "otherUseCase": "xyz789",
  "better": "abc123"
}

Symbol

Description

A code symbol (e.g., a function, variable, type, class, etc.). It is derived from DocumentSymbol as defined in the Language Server Protocol (see https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textDocument_documentSymbol).

Fields
Field Name Description
name - String! The name of the symbol.
containerName - String The name of the symbol that contains this symbol, if any. This field's value is not guaranteed to be structured in such a way that callers can infer a hierarchy of symbols.
kind - SymbolKind! The kind of the symbol.
language - String! The programming language of the symbol.
location - Location! The location where this symbol is defined.
url - String! The URL to this symbol (using the input revision specifier, which may not be immutable).
canonicalURL - String! The canonical URL to this symbol (using an immutable revision specifier).
fileLocal - Boolean! Whether or not the symbol is local to the file it's defined in.
Example
{
  "name": "abc123",
  "containerName": "abc123",
  "kind": "UNKNOWN",
  "language": "abc123",
  "location": Location,
  "url": "abc123",
  "canonicalURL": "abc123",
  "fileLocal": false
}

SymbolConnection

Description

A list of symbols.

Fields
Field Name Description
nodes - [Symbol!]! A list of symbols.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [Symbol],
  "pageInfo": PageInfo
}

SymbolKind

Description

All possible kinds of symbols. This set matches that of the Language Server Protocol (https://microsoft.github.io/language-server-protocol/specification#workspace_symbol).

Values
Enum Value Description

UNKNOWN

FILE

MODULE

NAMESPACE

PACKAGE

CLASS

METHOD

PROPERTY

FIELD

CONSTRUCTOR

ENUM

INTERFACE

FUNCTION

VARIABLE

CONSTANT

STRING

NUMBER

BOOLEAN

ARRAY

OBJECT

KEY

NULL

ENUMMEMBER

STRUCT

EVENT

OPERATOR

TYPEPARAMETER

Example
"UNKNOWN"

SyncError

Description

FOR INTERNAL USE ONLY: A status message produced when repositories could not be synced

Fields
Field Name Description
message - String! The message of this status message
Example
{"message": "xyz789"}

Team

Description

A team is a grouping of users/persons into a common handle. Teams are commonly used to define codeowners.

Fields
Field Name Description
id - ID! The unique ID of the team.
name - String! The name of the team. Needs to be globally unique across usernames, organization names, and team names. Team names can use alphanumeric characters, - dash and / forward slash.
url - String! URL to link to the teams profile page.
displayName - String A human readable name substitute for the name. Null, if not defined.
readonly - Boolean! A team can be made read-only from the CLI instructing the UI to show a warning banner that this is managed externally, and management features will only be available to site-admins. It can also still be manipulated from the CLI.
members - TeamMemberConnection! The teams direct members. That is members that are strictly part of this team, but not members of child teams. Team membership is NOT inherited.
Arguments
first - Int

Returns the first n team members from the list.

after - String

Opaque pagination cursor.

search - String

Optionally apply a text search filter over the results.

parentTeam - Team Parent team can be null, if this is a root team.
childTeams - TeamConnection! The list of direct child teams.
Arguments
first - Int

Returns the first n teams from the list.

after - String

Opaque pagination cursor.

search - String

Optionally apply a text search filter over the results.

viewerCanAdminister - Boolean! True, if the current user can modify this team.
Example
{
  "id": "4",
  "name": "abc123",
  "url": "xyz789",
  "displayName": "abc123",
  "readonly": false,
  "members": TeamMemberConnection,
  "parentTeam": Team,
  "childTeams": TeamConnection,
  "viewerCanAdminister": true
}

TeamConnection

Description

A list of teams.

Fields
Field Name Description
totalCount - Int! The total count of items in the connection.
pageInfo - PageInfo! The pagination info for the connection.
nodes - [Team!]! The current page of teams in this connection.
Example
{
  "totalCount": 987,
  "pageInfo": PageInfo,
  "nodes": [Team]
}

TeamMember

Description

A team member is an entity that can be associated to a team.

For now, this will be User, and will be expanded to User | Person later.

Fields
Field Name Description
teams - TeamConnection! All the teams this TeamMember is a direct member of.
Arguments
first - Int

Returns the first n teams from the list.

after - String

Opaque pagination cursor.

search - String

Optionally apply a text search filter over the results.

Possible Types
TeamMember Types

User

Example
{"teams": TeamConnection}

TeamMemberConnection

Description

A list of team members.

Fields
Field Name Description
totalCount - Int! The total count of items in the connection.
pageInfo - PageInfo! The pagination info for the connection.
nodes - [TeamMember!]! The current page of team members in this connection.
Example
{
  "totalCount": 123,
  "pageInfo": PageInfo,
  "nodes": [TeamMember]
}

TemporarySettings

Description

Temporary settings for a user.

Fields
Field Name Description
contents - String! A JSON string representing the temporary settings.
Example
{"contents": "abc123"}

TreeEntry

Description

A file, directory, or other tree entry.

Fields
Field Name Description
path - String! The full path (relative to the repository root) of this tree entry.
name - String! The base name (i.e., file name only) of this tree entry.
isDirectory - Boolean! Whether this tree entry is a directory.
url - String! The URL to this tree entry (using the input revision specifier, which may not be immutable).
canonicalURL - String! The canonical URL to this tree entry (using an immutable revision specifier).
externalURLs - [ExternalLink!]! The URLs to this tree entry on external services.
symbols - SymbolConnection! Symbols defined in this file or directory.
Arguments
first - Int

Returns the first n symbols from the list.

query - String

Return symbols matching the query.

submodule - Submodule Submodule metadata if this tree points to a submodule
isSingleChild - Boolean! Whether this tree entry is a single child
Arguments
first - Int

Returns the first n files in the tree.

recursive - Boolean

Recurse into sub-trees.

recursiveSingleChild - Boolean

Recurse into sub-trees of single-child directories

Possible Types
TreeEntry Types

GitTree

GitBlob

Example
{
  "path": "xyz789",
  "name": "xyz789",
  "isDirectory": true,
  "url": "xyz789",
  "canonicalURL": "xyz789",
  "externalURLs": [ExternalLink],
  "symbols": SymbolConnection,
  "submodule": Submodule,
  "isSingleChild": false
}

UpdateCheck

Description

Information about software updates for Sourcegraph.

Fields
Field Name Description
pending - Boolean! Whether an update check is currently in progress.
checkedAt - DateTime When the last update check was completed, or null if no update check has been completed (or performed) yet.
errorMessage - String If an error occurred during the last update check, this message describes the error.
updateVersionAvailable - String If an update is available, the version string of the updated version.
Example
{
  "pending": true,
  "checkedAt": "2007-12-03T10:15:30Z",
  "errorMessage": "xyz789",
  "updateVersionAvailable": "xyz789"
}

UpdateExternalServiceInput

Description

Fields to update for an existing external service.

Fields
Input Field Description
id - ID! The id of the external service to update.
displayName - String The updated display name, if provided.
config - String The updated config, if provided.
Example
{
  "id": "4",
  "displayName": "xyz789",
  "config": "xyz789"
}

UpdateQueue

Description

The state of a repository in the update queue.

Fields
Field Name Description
index - Int! The index of the repo in the update queue. Updating repos are placed at the end of the queue until they finish updating so don't display this if updating is true.
updating - Boolean! True if the repo is currently updating.
total - Int! The total number of repos in the update queue (including updating repos).
Example
{"index": 123, "updating": false, "total": 123}

UpdateSchedule

Description

The state of a repository in the update schedule.

Fields
Field Name Description
intervalSeconds - Int! The interval that was used when scheduling the current due time.
due - DateTime! The next time that the repo will be inserted into the update queue.
index - Int! The index of the repo in the schedule.
total - Int! The total number of repos in the schedule.
Example
{
  "intervalSeconds": 123,
  "due": "2007-12-03T10:15:30Z",
  "index": 123,
  "total": 123
}

UpdateSettingsPayload

Description

The payload for SettingsMutation.updateConfiguration.

Fields
Field Name Description
empty - EmptyResponse An empty response.
Example
{"empty": EmptyResponse}

UpgradeReadiness

Description

Instance upgrade readiness information includes schema drifts and deprecated-but-unfinished out-of-band migrations.

Fields
Field Name Description
schemaDrift - String! The schema drift details.
requiredOutOfBandMigrations - [OutOfBandMigration!]! The list of deprecated-but-unfinished out-of-band migrations.
Example
{
  "schemaDrift": "xyz789",
  "requiredOutOfBandMigrations": [OutOfBandMigration]
}

User

Description

A user.

Fields
Field Name Description
executorSecrets - ExecutorSecretConnection! The list of all available executor secrets for execution in this users namespace.
Arguments
scope - ExecutorSecretScope!

The scope for which secrets shall be returned.

first - Int

Only return N records.

after - String

Opaque cursor for pagination.

id - ID! The unique ID for the user.
username - String! The user's username.
email - String! The user's primary email address. Only the user and site admins can access this field. use emails instead
displayName - String The display name chosen by the user.
avatarURL - String The URL of the user's avatar image.
url - String! The URL to the user's profile on Sourcegraph.
settingsURL - String The URL to the user's settings.
createdAt - DateTime! The date when the user account was created on Sourcegraph.
updatedAt - DateTime The date when the user account was last updated on Sourcegraph.
siteAdmin - Boolean! Whether the user is a site admin. Only the user and site admins can access this field.
builtinAuth - Boolean! Whether the user account uses built in auth.
latestSettings - Settings The latest settings for the user. Only the user and site admins can access this field.
settingsCascade - SettingsCascade! All settings for this user, and the individual levels in the settings cascade (global > organization > user) that were merged to produce the final merged settings. Only the user and site admins can access this field.
configurationCascade - ConfigurationCascade! DEPRECATED Use settingsCascade instead. This field is a deprecated alias for it and will be removed in a future release.
organizations - OrgConnection! The organizations that this user is a member of.
organizationMemberships - OrganizationMembershipConnection! This user's organization memberships.
tags - [String!]! Tags associated with the user. These are used for internal site management and feature selection. Only the user and site admins can access this field.
tosAccepted - Boolean! Whether the user has already accepted the terms of service or not.
searchable - Boolean! Whether the user accepted to be searched in the users picker or not.
usageStatistics - UserUsageStatistics! The user's usage statistics on Sourcegraph.
eventLogs - EventLogsConnection! The user's events on Sourcegraph.
Arguments
first - Int

Returns the first n event logs from the list.

eventName - String

Only return events matching this event name

emails - [UserEmail!]! The user's email addresses. Only the user and site admins can access this field.
accessTokens - AccessTokenConnection! The user's access tokens (which grant to the holder the privileges of the user). This consists of all access tokens whose subject is this user. Only the user and site admins can access this field.
Arguments
first - Int

Returns the first n access tokens from the list.

externalAccounts - ExternalAccountConnection! A list of external accounts that are associated with the user.
Arguments
first - Int

Returns the first n external accounts from the list.

session - Session! The user's currently active session. Only the currently authenticated user can access this field. Site admins are not able to access sessions for other users.
viewerCanAdminister - Boolean! Whether the viewer has admin privileges on this user. The user has admin privileges on their own user, and site admins have admin privileges on all users.
viewerCanChangeUsername - Boolean! Whether the viewer can change the username of this user. The user can change their username unless auth.disableUsernameChanges is set. Site admins can always change the username of any user.
surveyResponses - [SurveyResponse!]! The user's survey responses. Only the user and site admins can access this field.
databaseID - Int! The unique numeric ID for the user. FOR INTERNAL USE ONLY.
namespaceName - String! The name of this user namespace's component. For users, this is the username.
invitableCollaborators - [Person!]! EXPERIMENTAL: Collaborators who can be invited to Sourcegraph. This typically comes from a few repositories this user has access to, and is derived from recent commit history of those.
teams - TeamConnection! All the teams this user is a direct member of.
Arguments
first - Int

Returns the first n teams from the list.

after - String

Opaque pagination cursor.

search - String

Optionally apply a text search filter over the results.

Example
{
  "executorSecrets": ExecutorSecretConnection,
  "id": "4",
  "username": "abc123",
  "email": "xyz789",
  "displayName": "xyz789",
  "avatarURL": "abc123",
  "url": "xyz789",
  "settingsURL": "abc123",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "siteAdmin": true,
  "builtinAuth": false,
  "latestSettings": Settings,
  "settingsCascade": SettingsCascade,
  "configurationCascade": ConfigurationCascade,
  "organizations": OrgConnection,
  "organizationMemberships": OrganizationMembershipConnection,
  "tags": ["xyz789"],
  "tosAccepted": true,
  "searchable": false,
  "usageStatistics": UserUsageStatistics,
  "eventLogs": EventLogsConnection,
  "emails": [UserEmail],
  "accessTokens": AccessTokenConnection,
  "externalAccounts": ExternalAccountConnection,
  "session": Session,
  "viewerCanAdminister": true,
  "viewerCanChangeUsername": true,
  "surveyResponses": [SurveyResponse],
  "databaseID": 123,
  "namespaceName": "xyz789",
  "invitableCollaborators": [Person],
  "teams": TeamConnection
}

UserActivePeriod

Description

A period of time in which a set of users have been active.

Values
Enum Value Description

TODAY

Since today at 00:00 UTC.

THIS_WEEK

Since the latest Monday at 00:00 UTC.

THIS_MONTH

Since the first day of the current month at 00:00 UTC.

ALL_TIME

All time.
Example
"TODAY"

UserConnection

Description

A list of users.

Fields
Field Name Description
nodes - [User!]! A list of users.
totalCount - Int! The total count of users in the connection. This total count may be larger than the number of nodes in this object when the result is paginated.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [User],
  "totalCount": 123,
  "pageInfo": PageInfo
}

UserEmail

Description

A user's email address.

Fields
Field Name Description
email - String! The email address.
isPrimary - Boolean! Whether the email address is the user's primary email address. Currently this is defined as the earliest email address associated with the user, preferring verified emails to unverified emails.
verified - Boolean! Whether the email address has been verified by the user.
verificationPending - Boolean! Whether the email address is pending verification.
user - User! The user associated with this email address.
viewerCanManuallyVerify - Boolean! Whether the viewer has privileges to manually mark this email address as verified (without the user going through the normal verification process). Only site admins have this privilege.
Example
{
  "email": "xyz789",
  "isPrimary": false,
  "verified": false,
  "verificationPending": false,
  "user": User,
  "viewerCanManuallyVerify": false
}

UserEvent

Description

A user event.

Values
Enum Value Description

PAGEVIEW

SEARCHQUERY

CODEINTEL

CODEINTELREFS

CODEINTELINTEGRATION

CODEINTELINTEGRATIONREFS

STAGEMANAGE

Product stages

STAGEPLAN

STAGECODE

STAGEREVIEW

STAGEVERIFY

STAGEPACKAGE

STAGEDEPLOY

STAGECONFIGURE

STAGEMONITOR

STAGESECURE

STAGEAUTOMATE

Example
"PAGEVIEW"

UserUsageStatistics

Description

UserUsageStatistics describes a user's usage statistics. This information is visible to all viewers.

Fields
Field Name Description
searchQueries - Int! The number of search queries that the user has performed.
pageViews - Int! The number of page views that the user has performed.
codeIntelligenceActions - Int! The number of code intelligence actions that the user has performed.
findReferencesActions - Int! The number of find-refs actions that the user has performed.
lastActiveTime - String The last time the user was active (any action, any platform).
lastActiveCodeHostIntegrationTime - String The last time the user was active on a code host integration.
Example
{
  "searchQueries": 123,
  "pageViews": 987,
  "codeIntelligenceActions": 987,
  "findReferencesActions": 123,
  "lastActiveTime": "abc123",
  "lastActiveCodeHostIntegrationTime": "xyz789"
}

VirtualFile

Description

A virtual file is an arbitrary file that is generated in memory.

Fields
Field Name Description
path - String! The full path (relative to the root) of this file.
name - String! The base name (i.e., file name only) of this file.
isDirectory - Boolean! False because this is a file, not a directory.
content - String! The content of this file.
Arguments
startLine - Int

Return file content starting at line "startLine". A value <= 0 will be the start of the file.

endLine - Int

Return file content ending at line "endLine". A value < 0 or > totalLines will set endLine to the end of the file.

byteSize - Int! The file size in bytes.
totalLines - Int! Total line count for the file. Returns 0 for binary files.
binary - Boolean! Whether or not it is binary.
richHTML - String! The file rendered as rich HTML, or an empty string if it is not a supported rich file type. This HTML string is already escaped and thus is always safe to render.
Arguments
startLine - Int

Return richHTML content starting at line "startLine". A value <= 0 will be the start of the file.

endLine - Int

Return richHTML content ending at line "endLine". A value < 0 or > totalLines will set endLine to the end of the file.

url - String! Not implemented.
canonicalURL - String! Not implemented.
externalURLs - [ExternalLink!]! Not implemented.
highlight - HighlightedFile! Highlight the file.
Arguments
disableTimeout - Boolean!
highlightLongLines - Boolean

If highlightLongLines is true, lines which are longer than 2000 bytes are highlighted. 2000 bytes is enabled. This may produce a significant amount of HTML which some browsers (such as Chrome, but not Firefox) may have trouble rendering efficiently.

format - HighlightResponseFormat

Specifies which format/highlighting technique to use.

startLine - Int

Return highlight content starting at line "startLine". A value <= 0 will be the start of the file. Warning: Pagination only works with the HTML_PLAINTEXT format type at the moment.

endLine - Int

Return highlight content ending at line "endLine". A value < 0 or > totalLines will set endLine to the end of the file. Warning: Pagination only works with the HTML_PLAINTEXT format type at the moment.

Example
{
  "path": "xyz789",
  "name": "abc123",
  "isDirectory": false,
  "content": "abc123",
  "byteSize": 123,
  "totalLines": 123,
  "binary": false,
  "richHTML": "xyz789",
  "url": "xyz789",
  "canonicalURL": "abc123",
  "externalURLs": [ExternalLink],
  "highlight": HighlightedFile
}

Webhook

Description

Represents an incoming webhook from a code host.

Fields
Field Name Description
id - ID! The unique ID of the webhook.
uuid - String! The user facing UUID of the webhook.
url - String! The URL of the webhook in the instance. This is the location where we expect to receive payloads.
name - String! Descriptive webhook name.
codeHostKind - ExternalServiceKind! The kind of code host sending payloads. (eg. GitHub, GitLab)
codeHostURN - String! The URN of the code host instance. (eg. https://gitlab.com)
secret - String Optional secret.
updatedAt - DateTime! The last time this webhook was updated.
updatedBy - User The user who last updated this webhook. Null if the user was deleted or if the webhook hasn't been updated yet.
createdAt - DateTime! When the webhook was created.
createdBy - User The user who created this webhook. Null if the user was deleted.
webhookLogs - WebhookLogConnection! The logs related to this webhook.
Arguments
first - Int

Returns the first n webhook logs.

after - String

Opaque pagination cursor.

onlyErrors - Boolean

Only include webhook logs that resulted in errors.

since - DateTime

Only include webhook logs on or after this time.

until - DateTime

Only include webhook logs on or before this time.

Example
{
  "id": "4",
  "uuid": "abc123",
  "url": "abc123",
  "name": "abc123",
  "codeHostKind": "AWSCODECOMMIT",
  "codeHostURN": "abc123",
  "secret": "xyz789",
  "updatedAt": "2007-12-03T10:15:30Z",
  "updatedBy": User,
  "createdAt": "2007-12-03T10:15:30Z",
  "createdBy": User,
  "webhookLogs": WebhookLogConnection
}

WebhookConnection

Description

A list of webhooks

Fields
Field Name Description
nodes - [Webhook!]! A list of webhooks.
totalCount - Int! The total number of webhooks in the connection.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [Webhook],
  "totalCount": 123,
  "pageInfo": PageInfo
}

WebhookLog

Description

A single logged webhook delivery.

Fields
Field Name Description
id - ID! The webhook log ID.
receivedAt - DateTime! The time the webhook was received at.
externalService - ExternalService The external service the webhook was matched to, if any.
statusCode - Int! The HTTP status code returned from the webhook handler.
request - WebhookLogRequest! The received webhook request.
response - WebhookLogResponse! The response sent by the webhook handler.
Example
{
  "id": 4,
  "receivedAt": "2007-12-03T10:15:30Z",
  "externalService": ExternalService,
  "statusCode": 123,
  "request": WebhookLogRequest,
  "response": WebhookLogResponse
}

WebhookLogConnection

Description

A list of logged webhook deliveries.

Fields
Field Name Description
nodes - [WebhookLog!]! A list of webhook logs.
totalCount - Int! The total number of webhook logs in the connection.
pageInfo - PageInfo! Pagination information.
Example
{
  "nodes": [WebhookLog],
  "totalCount": 123,
  "pageInfo": PageInfo
}

WebhookLogMessage

Description

A HTTP message (request or response) within a webhook log.

Fields
Field Name Description
headers - [HTTPHeader!]! The headers in the HTTP message.
body - String! The body content of the HTTP message.
Possible Types
WebhookLogMessage Types

WebhookLogRequest

WebhookLogResponse

Example
{
  "headers": [HTTPHeader],
  "body": "xyz789"
}

WebhookLogRequest

Description

A HTTP request within a webhook log.

Fields
Field Name Description
headers - [HTTPHeader!]! The headers in the HTTP message.
body - String! The body content of the HTTP message.
method - String! The method used in the HTTP request.
url - String! The requested URL.
version - String! The HTTP version in use.
Example
{
  "headers": [HTTPHeader],
  "body": "abc123",
  "method": "xyz789",
  "url": "abc123",
  "version": "xyz789"
}

WebhookLogResponse

Description

A HTTP response within a webhook log.

Fields
Field Name Description
headers - [HTTPHeader!]! The headers in the HTTP message.
body - String! The body content of the HTTP message.
Example
{
  "headers": [HTTPHeader],
  "body": "xyz789"
}

repositoryIndexserverHost

Description

Information about the indexserver that hosts the repo's index.

Fields
Field Name Description
name - String! The hostname of the indexserver.
Example
{"name": "xyz789"}