REST API endpoints for security campaigns

Use the REST API to create and manage security campaigns for your organization.

Note

These endpoints only interact with published campaigns. Draft campaigns cannot currently be viewed or managed through the API.

Note

Most endpoints use Authorization: Bearer <YOUR-TOKEN> and Accept: application/vnd.github+json headers, plus X-GitHub-Api-Version: 2026-03-10. Curl examples below omit these standard headers for brevity.

List campaigns for an organization

GET /orgs/{org}/campaigns

Lists campaigns in an organization.
The authenticated user must be an owner or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/orgs/ORG/campaigns

Response schema (Status: 200):

Array of Campaign summary:

Create a campaign for an organization

POST /orgs/{org}/campaigns

Create a campaign for an organization.
The authenticated user must be an owner or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint.
Fine-grained tokens must have the "Code scanning alerts" repository permissions (read) on all repositories included
in the campaign.

Parameters

Headers

Path and query parameters

Body parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X POST \
  https://api.github.com/orgs/ORG/campaigns \
  -d '{
  "name": "Critical CodeQL alerts",
  "description": "Address critical alerts before they are exploited to prevent breaches, protect sensitive data, and mitigate financial and reputational damage.",
  "managers": [
    "octocat"
  ],
  "ends_at": "2024-03-14T00:00:00Z",
  "code_scanning_alerts": [
    {
      "repository_id": 1296269,
      "alert_numbers": [
        1,
        2
      ]
    }
  ]
}'

Response schema (Status: 200):

Get a campaign for an organization

GET /orgs/{org}/campaigns/{campaign_number}

Gets a campaign for an organization.
The authenticated user must be an owner or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/orgs/ORG/campaigns/CAMPAIGN_NUMBER

Response schema (Status: 200):

Same response schema as Create a campaign for an organization.

Update a campaign

PATCH /orgs/{org}/campaigns/{campaign_number}

Updates a campaign in an organization.
The authenticated user must be an owner or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint.

Parameters

Headers

Path and query parameters

Body parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X PATCH \
  https://api.github.com/orgs/ORG/campaigns/CAMPAIGN_NUMBER \
  -d '{
  "name": "Critical CodeQL alerts"
}'

Response schema (Status: 200):

Same response schema as Create a campaign for an organization.

Delete a campaign for an organization

DELETE /orgs/{org}/campaigns/{campaign_number}

Deletes a campaign in an organization.
The authenticated user must be an owner or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the security_events scope to use this endpoint.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X DELETE \
  https://api.github.com/orgs/ORG/campaigns/CAMPAIGN_NUMBER

Response schema (Status: 204):