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