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.
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.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
page (integer)
The page number of the results to fetch. For more information, see "Using pagination in the REST API."
Default: 1
per_page (integer)
The number of results per page (max 100). For more information, see "Using pagination in the REST API."
Default: 30
direction (string)
The direction to sort the results by.
Default: desc
Can be one of: asc, desc
state (string)
If specified, only campaigns with this state will be returned.
Can be one of: open, closed
sort (string)
The property by which to sort the results.
Default: created
Can be one of: created, updated, ends_at, published
200 - OK
404 - Resource not found
503 - Service unavailable
Request:
curl -L \
-X GET \
https://api.github.com/orgs/ORG/campaigns
Response schema (Status: 200):
Array of Campaign summary:
number: required, integercreated_at: required, string, format: date-timeupdated_at: required, string, format: date-timename: stringdescription: required, stringmanagers: required, array of Simple User:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringteam_managers: array of Team:
id: required, integernode_id: required, stringname: required, stringslug: required, stringdescription: required, string or nullprivacy: stringnotification_setting: stringpermission: required, stringpermissions: object:
pull: required, booleantriage: required, booleanpush: required, booleanmaintain: required, booleanadmin: required, booleanurl: required, string, format: urihtml_url: required, string, format: urimembers_url: required, stringrepositories_url: required, string, format: uritype: required, string, enum: enterprise, organizationaccess_source: string, enum: direct, organization, enterpriseorganization_id: integerenterprise_id: integerparent: required, any of:
id: required, integernode_id: required, stringurl: required, string, format: urimembers_url: required, stringname: required, stringdescription: required, string or nullpermission: required, stringprivacy: stringnotification_setting: stringhtml_url: required, string, format: urirepositories_url: required, string, format: urislug: required, stringldap_dn: stringtype: required, string, enum: enterprise, organizationorganization_id: integerenterprise_id: integerpublished_at: string, format: date-timeends_at: required, string, format: date-timeclosed_at: string or null, format: date-timestate: required, string, enum: open, closedcontact_link: required, string or null, format: urialert_stats: object:
open_count: required, integerclosed_count: required, integerin_progress_count: required, integerPOST /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.
accept (string)application/vnd.github+json is recommended.org (string) (required)name (string) (required)
The name of the campaign
description (string) (required)
A description for the campaign
managers (array of strings)
The logins of the users to set as the campaign managers. At this time, only a single manager can be supplied.
team_managers (array of strings)
The slugs of the teams to set as the campaign managers.
ends_at (string) (required)
The end date and time of the campaign. The date must be in the future.
contact_link (string or null)
The contact link of the campaign. Must be a URI.
code_scanning_alerts (array of objects or null)
The code scanning alerts to include in this campaign
repository_id (integer) (required)alert_numbers (array of integers) (required)generate_issues (boolean)
If true, will automatically generate issues for the campaign. The default is false.
Default: false
200 - OK
400 - Bad Request
404 - Resource not found
422 - Unprocessable Entity
429 - Too Many Requests
503 - Service unavailable
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):
number: required, integercreated_at: required, string, format: date-timeupdated_at: required, string, format: date-timename: stringdescription: required, stringmanagers: required, array of Simple User:
name: string or nullemail: string or nulllogin: required, stringid: required, integer, format: int64node_id: required, stringavatar_url: required, string, format: urigravatar_id: required, string or nullurl: required, string, format: urihtml_url: required, string, format: urifollowers_url: required, string, format: urifollowing_url: required, stringgists_url: required, stringstarred_url: required, stringsubscriptions_url: required, string, format: uriorganizations_url: required, string, format: urirepos_url: required, string, format: urievents_url: required, stringreceived_events_url: required, string, format: uritype: required, stringsite_admin: required, booleanstarred_at: stringuser_view_type: stringteam_managers: array of Team:
id: required, integernode_id: required, stringname: required, stringslug: required, stringdescription: required, string or nullprivacy: stringnotification_setting: stringpermission: required, stringpermissions: object:
pull: required, booleantriage: required, booleanpush: required, booleanmaintain: required, booleanadmin: required, booleanurl: required, string, format: urihtml_url: required, string, format: urimembers_url: required, stringrepositories_url: required, string, format: uritype: required, string, enum: enterprise, organizationaccess_source: string, enum: direct, organization, enterpriseorganization_id: integerenterprise_id: integerparent: required, any of:
id: required, integernode_id: required, stringurl: required, string, format: urimembers_url: required, stringname: required, stringdescription: required, string or nullpermission: required, stringprivacy: stringnotification_setting: stringhtml_url: required, string, format: urirepositories_url: required, string, format: urislug: required, stringldap_dn: stringtype: required, string, enum: enterprise, organizationorganization_id: integerenterprise_id: integerpublished_at: string, format: date-timeends_at: required, string, format: date-timeclosed_at: string or null, format: date-timestate: required, string, enum: open, closedcontact_link: required, string or null, format: urialert_stats: object:
open_count: required, integerclosed_count: required, integerin_progress_count: required, integerGET /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.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
campaign_number (integer) (required)
The campaign number.
200 - OK
404 - Resource not found
422 - Unprocessable Entity
503 - Service unavailable
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.
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.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
campaign_number (integer) (required)
The campaign number.
name (string)
The name of the campaign
description (string)
A description for the campaign
managers (array of strings)
The logins of the users to set as the campaign managers. At this time, only a single manager can be supplied.
team_managers (array of strings)
The slugs of the teams to set as the campaign managers.
ends_at (string)
The end date and time of the campaign, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.
contact_link (string or null)
The contact link of the campaign. Must be a URI.
state (string)
Indicates whether a campaign is open or closed
Can be one of: open, closed
200 - OK
400 - Bad Request
404 - Resource not found
422 - Unprocessable Entity
503 - Service unavailable
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 /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.
accept (string)application/vnd.github+json is recommended.org (string) (required)
The organization name. The name is not case sensitive.
campaign_number (integer) (required)
The campaign number.
204 - Deletion successful
404 - Resource not found
503 - Service unavailable
Request:
curl -L \
-X DELETE \
https://api.github.com/orgs/ORG/campaigns/CAMPAIGN_NUMBER
Response schema (Status: 204):