Skip to main content

This version of GitHub Enterprise Server was discontinued on 2024-01-04. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise Server. For help with the upgrade, contact GitHub Enterprise support.

After a site administrator upgrades your Enterprise Server instance to Enterprise Server 3.9 or later, the REST API will be versioned. To learn how to find your instance's version, see "About versions of GitHub Docs". For more information, see "About API versioning."

Organizations

Use the REST API to create organizations on your enterprise.

About organization administration

These endpoints are only available to authenticated site administrators. Normal users will receive a 404 response.

Create an organization

Parameters for "Create an organization"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Body parameters
Name, Type, Description
login string Required

The organization's username.

admin string Required

The login of the user who will manage this organization.

profile_name string

The organization's display name.

HTTP response status codes for "Create an organization"

Status codeDescription
201

Created

Code samples for "Create an organization"

post/admin/organizations
curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/organizations \ -d '{"login":"github","profile_name":"GitHub, Inc.","admin":"monalisaoctocat"}'

Response

Status: 201
{ "login": "github", "id": 1, "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=", "url": "https://HOSTNAME/orgs/github", "repos_url": "https://HOSTNAME/orgs/github/repos", "events_url": "https://HOSTNAME/orgs/github/events", "hooks_url": "https://HOSTNAME/orgs/github/hooks", "issues_url": "https://HOSTNAME/orgs/github/issues", "members_url": "https://HOSTNAME/orgs/github/members{/member}", "public_members_url": "https://HOSTNAME/orgs/github/public_members{/member}", "avatar_url": "https://github.com/images/error/octocat_happy.gif", "description": "A great organization" }

Update an organization name

Parameters for "Update an organization name"

Headers
Name, Type, Description
accept string

Setting to application/vnd.github+json is recommended.

Path parameters
Name, Type, Description
org string Required

The organization name. The name is not case sensitive.

Body parameters
Name, Type, Description
login string Required

The organization's new name.

HTTP response status codes for "Update an organization name"

Status codeDescription
202

Accepted

Code samples for "Update an organization name"

patch/admin/organizations/{org}
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ http(s)://HOSTNAME/api/v3/admin/organizations/ORG \ -d '{"login":"the-new-octocats"}'

Response

Status: 202
{ "message": "Job queued to rename organization. It may take a few minutes to complete.", "url": "https://<hostname>/api/v3/organizations/1" }