GitHub v3 REST API

Create a GitHub license

When you boot a GitHub instance for the first time, you can use the following endpoint to upload a license.

Note that you need to POST to /setup/api/configure to start the actual configuration process.

When using this endpoint, your GitHub instance must have a password set. This can be accomplished two ways:

  1. If you’re working directly with the API before accessing the web interface, you must pass in the password parameter to set your password.
  2. If you set up your instance via the web interface before accessing the API, your calls to this endpoint do not need the password parameter.

Note: The request body for this operation must be submitted as application/x-www-form-urlencoded data. You can submit a parameter value as a string, or you can use a tool such as curl to submit a parameter value as the contents of a text file. For more information, see the curl documentation.

post
{protocol}://{hostname}/api/v3/setup/api/start

Body

application/x-www-form-urlencoded
licensestringrequired

The content of your .ghl license file.

passwordstring

You must provide a password only if you are uploading your license for the first time. If you previously set a password through the web interface, you don’t need this parameter.

settingsstring

An optional JSON string containing the installation settings. For a list of the available settings, see the Get settings endpoint.

Response

202

Response

post/setup/api/start

Body

{ "license": "license" }
 
202

Upgrade a license

This API upgrades your license and also triggers the configuration process.

Note: The request body for this operation must be submitted as application/x-www-form-urlencoded data. You can submit a parameter value as a string, or you can use a tool such as curl to submit a parameter value as the contents of a text file. For more information, see the curl documentation.

post
{protocol}://{hostname}/api/v3/setup/api/upgrade

Body

application/x-www-form-urlencoded
licensestring

The content of your new .ghl license file.

Response

202

Response

post/setup/api/upgrade

Body

{}
 
202

Promote a user to be a site administrator

Note that you’ll need to set Content-Length to zero when calling out to this endpoint. For more information, see “HTTP verbs.”

put
{protocol}://{hostname}/api/v3/users/{username}/site_admin

Path Parameters

usernamestringrequired

Response

204

Response

put/users/{username}/site_admin
 
204

Demote a site administrator

You can demote any user account except your own.

delete
{protocol}://{hostname}/api/v3/users/{username}/site_admin

Path Parameters

usernamestringrequired

Response

204

Response

delete/users/{username}/site_admin
 
204

Suspend a user

If your GitHub instance uses LDAP Sync with Active Directory LDAP servers, Active Directory LDAP-authenticated users cannot be suspended through this API. If you attempt to suspend an Active Directory LDAP-authenticated user through this API, it will return a 403 response.

You can suspend any user account except your own.

Note that, if you choose not to pass any parameters, you’ll need to set Content-Length to zero when calling out to this endpoint. For more information, see “HTTP verbs.”

put
{protocol}://{hostname}/api/v3/users/{username}/suspended

Path Parameters

usernamestringrequired

Body

application/json
reasonstring

The reason the user is being suspended. This message will be logged in the audit log. If you don’t provide a reason, it will default to “Suspended via API by SITE_ADMINISTRATOR”, where SITE_ADMINISTRATOR is the person who performed the action.

Response

204

Response

put/users/{username}/suspended

Body

{}
 
204