Skip to main content
The REST API is now versioned. For more information, see "About API versioning."

REST API endpoints for enterprise announcement banners

The Enterprise Announcement Banners API allows you to get, set, and remove the announcement banner for your enterprise.

Get announcement banner for enterprise

Gets the announcement banner currently set for the enterprise.

Fine-grained access tokens for "Get announcement banner for enterprise"

This endpoint does not work with GitHub App user access tokens, GitHub App installation access tokens, or fine-grained personal access tokens.

Parameters for "Get announcement banner for enterprise"

Headers
Name, Type, Description
accept string

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

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

HTTP response status codes for "Get announcement banner for enterprise"

Status codeDescription
200

OK

Code samples for "Get announcement banner for enterprise"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Request example

get/enterprises/{enterprise}/announcement
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/enterprises/ENTERPRISE/announcement

Announcement banner

Status: 200
{ "announcement": "Very **important** announcement about _something_.", "expires_at": "2021-01-01T00:00:00.000+00:00", "user_dismissible": false }

Set announcement banner for enterprise

Sets the announcement banner to display for the enterprise.

Fine-grained access tokens for "Set announcement banner for enterprise"

This endpoint does not work with GitHub App user access tokens, GitHub App installation access tokens, or fine-grained personal access tokens.

Parameters for "Set announcement banner for enterprise"

Headers
Name, Type, Description
accept string

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

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

Body parameters
Name, Type, Description
announcement string or null Required

The announcement text in GitHub Flavored Markdown. For more information about GitHub Flavored Markdown, see "Basic writing and formatting syntax."

expires_at string or null

The time at which the announcement expires. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. To set an announcement that never expires, omit this parameter, set it to null, or set it to an empty string.

HTTP response status codes for "Set announcement banner for enterprise"

Status codeDescription
200

OK

Code samples for "Set announcement banner for enterprise"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Request example

patch/enterprises/{enterprise}/announcement
curl -L \ -X PATCH \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/enterprises/ENTERPRISE/announcement \ -d '{"announcement":"Very **important** announcement about _something_.","expires_at":"2021-01-01T00:00:00.000+00:00","user_dismissible":false}'

Announcement banner

Status: 200
{ "announcement": "Very **important** announcement about _something_.", "expires_at": "2021-01-01T00:00:00.000+00:00", "user_dismissible": false }

Remove announcement banner from enterprise

Removes the announcement banner currently set for the enterprise.

Fine-grained access tokens for "Remove announcement banner from enterprise"

This endpoint does not work with GitHub App user access tokens, GitHub App installation access tokens, or fine-grained personal access tokens.

Parameters for "Remove announcement banner from enterprise"

Headers
Name, Type, Description
accept string

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

Path parameters
Name, Type, Description
enterprise string Required

The slug version of the enterprise name. You can also substitute this value with the enterprise id.

HTTP response status codes for "Remove announcement banner from enterprise"

Status codeDescription
204

No Content

Code samples for "Remove announcement banner from enterprise"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Request example

delete/enterprises/{enterprise}/announcement
curl -L \ -X DELETE \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ https://api.github.com/enterprises/ENTERPRISE/announcement

Response

Status: 204