v56

latestOpenAPI 3.0.3MITraw.githubusercontent.com2026-08-011,21696712.2 MB
campaigns

Create a campaign for an organization

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.

post/orgs/{org}/campaigns

Path parameters

orgstring required

The organization name. The name is not case sensitive.

Request body

OR

Response

Response

numberinteger required

The number of the newly created campaign

created_atstring date-time required

The date and time the campaign was created, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.

updated_atstring date-time required

The date and time the campaign was last updated, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.

namestring

The campaign name

descriptionstring required

The campaign description

published_atstring date-time

The date and time the campaign was published, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.

ends_atstring date-time required

The date and time the campaign has ended, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ.

closed_atstring date-time nullable

The date and time the campaign was closed, in ISO 8601 format':' YYYY-MM-DDTHH:MM:SSZ. Will be null if the campaign is still open.

state'open' | 'closed' required

Indicates whether a campaign is open or closed

contact_linkstring uri nullable required

The contact link of the campaign.

Example response

{
  "managers": [
    {
      "login": "octocat",
      "id": 1,
      "node_id": "MDQ6VXNlcjE=",
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "41d064eb2195891e12d0413f63227ea7",
      "url": "https://api.github.com/users/octocat",
      "html_url": "https://github.com/octocat",
      "followers_url": "https://api.github.com/users/octocat/followers",
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
      "organizations_url": "https://api.github.com/users/octocat/orgs",
      "repos_url": "https://api.github.com/users/octocat/repos",
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
      "received_events_url": "https://api.github.com/users/octocat/received_events",
      "type": "User",
      "starred_at": "\"2020-07-09T00:17:55Z\"",
      "user_view_type": "public"
    }
  ],
  "team_managers": [
    {
      "html_url": "https://github.com/orgs/rails/teams/core",
      "access_source": "direct",
      "organization_id": 37,
      "enterprise_id": 42,
      "parent": {
        "id": 1,
        "node_id": "MDQ6VGVhbTE=",
        "url": "https://api.github.com/organizations/1/team/1",
        "members_url": "https://api.github.com/organizations/1/team/1/members{/member}",
        "name": "Justice League",
        "description": "A great team.",
        "permission": "admin",
        "privacy": "closed",
        "notification_setting": "notifications_enabled",
        "html_url": "https://github.com/orgs/rails/teams/core",
        "repositories_url": "https://api.github.com/organizations/1/team/1/repos",
        "slug": "justice-league",
        "ldap_dn": "uid=example,ou=users,dc=github,dc=com",
        "organization_id": 37,
        "enterprise_id": 42
      }
    }
  ]
}