REST API endpoints for organization announcement banners
The Organization Announcement Banners API allows you to get, set, and remove the announcement banner for your organization.
Get announcement banner for organization
Gets the announcement banner currently set for the organization. Only returns the announcement banner set at the organization level. Organization members may also see an enterprise-level announcement banner. To get an announcement banner displayed at the enterprise level, use the enterprise-level endpoint.
Fine-grained access tokens for "Get announcement banner for organization"
This endpoint works with the following fine-grained token types:
- GitHub App user access tokens
- GitHub App installation access tokens
- Fine-grained personal access tokens
The fine-grained token must have the following permission set:
- "Organization announcement banners" organization permissions (read)
Parameters for "Get announcement banner for organization"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
org string RequiredThe organization name. The name is not case sensitive. |
HTTP response status codes for "Get announcement banner for organization"
Status code | Description |
---|---|
200 | OK |
Code samples for "Get announcement banner for organization"
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Request example
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/orgs/ORG/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 organization
Sets the announcement banner to display for the organization.
Fine-grained access tokens for "Set announcement banner for organization"
This endpoint works with the following fine-grained token types:
- GitHub App user access tokens
- GitHub App installation access tokens
- Fine-grained personal access tokens
The fine-grained token must have the following permission set:
- "Organization announcement banners" organization permissions (write)
Parameters for "Set announcement banner for organization"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
org string RequiredThe organization name. The name is not case sensitive. |
Name, Type, Description |
---|
announcement string or null RequiredThe 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: |
HTTP response status codes for "Set announcement banner for organization"
Status code | Description |
---|---|
200 | OK |
Code samples for "Set announcement banner for organization"
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Request example
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/orgs/ORG/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 organization
Removes the announcement banner currently set for the organization.
Fine-grained access tokens for "Remove announcement banner from organization"
This endpoint works with the following fine-grained token types:
- GitHub App user access tokens
- GitHub App installation access tokens
- Fine-grained personal access tokens
The fine-grained token must have the following permission set:
- "Organization announcement banners" organization permissions (write)
Parameters for "Remove announcement banner from organization"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
org string RequiredThe organization name. The name is not case sensitive. |
HTTP response status codes for "Remove announcement banner from organization"
Status code | Description |
---|---|
204 | No Content |
Code samples for "Remove announcement banner from organization"
If you access GitHub at GHE.com, replace api.github.com
with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com
.
Request example
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/orgs/ORG/announcement
Response
Status: 204