For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/api/latest/ci-visibility-github-accounts/update-github-ci-visibility-status.md. A documentation index is available at /llms.txt.
Language
Datadog site

Update GitHub CI Visibility status

PATCHhttps://api.datadoghq.com/api/v2/ci/github/accountshttps://api.us3.datadoghq.com/api/v2/ci/github/accountshttps://api.us5.datadoghq.com/api/v2/ci/github/accountshttps://api.datadoghq.eu/api/v2/ci/github/accountshttps://api.ap1.datadoghq.com/api/v2/ci/github/accountshttps://api.ap2.datadoghq.com/api/v2/ci/github/accountshttps://api.uk1.datadoghq.com/api/v2/ci/github/accountshttps://api.ddog-gov.com/api/v2/ci/github/accountshttps://api.us2.ddog-gov.com/api/v2/ci/github/accounts

Overview

Enable or disable CI Visibility for a GitHub account, one of its repositories, or both in the same request. The account (and, optionally, repository) are identified by name. Account-level and repository-level changes are independent and may both be supplied in the same request. At least one of enabled or repository.enabled must be provided. If the account name matches installations on more than one host, host must be supplied to disambiguate, otherwise a 409 is returned. Returns a 404 if the CI Visibility GitHub integration is not enabled for this organization, or if the given account or repository cannot be found by name.

This endpoint requires the ci_provider_settings_write permission.

OAuth apps require the ci_provider_settings_write authorization scope to access this endpoint.

Request

Body Data (required)

Field
Type
Description
data [required]
object

Data object for updating a GitHub account's CI Visibility opt-in status.

Response

OK

Response object containing a single GitHub account's CI Visibility opt-in status.

Field
Type
Description
data [required]
object

Data object for a GitHub account.

Code Example

Update GitHub CI Visibility status
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account": "datadog",
      "enabled": true,
      "host": "github.com",
      "repository": {
        "enabled": true,
        "name": "shopist"
      }
    },
    "type": "ci_github_account"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account": "datadog",
      "enabled": true,
      "host": "github.com",
      "repository": {
        "enabled": true,
        "name": "shopist"
      }
    },
    "type": "ci_github_account"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account": "datadog",
      "enabled": true,
      "host": "github.com",
      "repository": {
        "enabled": true,
        "name": "shopist"
      }
    },
    "type": "ci_github_account"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account": "datadog",
      "enabled": true,
      "host": "github.com",
      "repository": {
        "enabled": true,
        "name": "shopist"
      }
    },
    "type": "ci_github_account"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account": "datadog",
      "enabled": true,
      "host": "github.com",
      "repository": {
        "enabled": true,
        "name": "shopist"
      }
    },
    "type": "ci_github_account"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account": "datadog",
      "enabled": true,
      "host": "github.com",
      "repository": {
        "enabled": true,
        "name": "shopist"
      }
    },
    "type": "ci_github_account"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account": "datadog",
      "enabled": true,
      "host": "github.com",
      "repository": {
        "enabled": true,
        "name": "shopist"
      }
    },
    "type": "ci_github_account"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account": "datadog",
      "enabled": true,
      "host": "github.com",
      "repository": {
        "enabled": true,
        "name": "shopist"
      }
    },
    "type": "ci_github_account"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PATCH "https://api.${DD_SITE}/api/v2/ci/github/accounts" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "account": "datadog",
      "enabled": true,
      "host": "github.com",
      "repository": {
        "enabled": true,
        "name": "shopist"
      }
    },
    "type": "ci_github_account"
  }
}
EOF