Skip to main content

Enterprise Server 3.21 is currently available as a release candidate.

The REST API is now versioned. For more information, see "About API versioning."

REST API endpoints for rules

Use the REST API to manage rulesets for an enterprise. Rulesets control how people can interact with repositories and code.

Get enterprise ruleset history

Get the history of an enterprise ruleset.

fine_grained_access

no_fine_grained_access

Parameters for "Get enterprise ruleset history"

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.

ruleset_id integer Required

The ID of the ruleset.

Query parameters
Name, Type, Description
per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Default: 30

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Default: 1

http_status_code

status_codeDescription
200

OK

404

Resource not found

500

Internal Error

code_samples

request_example

get/enterprises/{enterprise}/rulesets/{ruleset_id}/history
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/rulesets/RULESET_ID/history

Response

Status: 200
[ { "version_id": 3, "actor": { "id": 1, "type": "User" }, "updated_at": "2024-10-23T16:29:47Z" }, { "version_id": 2, "actor": { "id": 2, "type": "User" }, "updated_at": "2024-09-23T16:29:47Z" }, { "version_id": 1, "actor": { "id": 1, "type": "User" }, "updated_at": "2024-08-23T16:29:47Z" } ]

Get enterprise ruleset version

Get a version of an enterprise ruleset.

fine_grained_access

no_fine_grained_access

Parameters for "Get enterprise ruleset version"

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.

ruleset_id integer Required

The ID of the ruleset.

version_id integer Required

The ID of the version

http_status_code

status_codeDescription
200

OK

404

Resource not found

500

Internal Error

code_samples

request_example

get/enterprises/{enterprise}/rulesets/{ruleset_id}/history/{version_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2026-03-10" \ http(s)://HOSTNAME/api/v3/enterprises/ENTERPRISE/rulesets/RULESET_ID/history/VERSION_ID

Response

Status: 200
{ "version_id": 3, "actor": { "id": 1, "type": "User" }, "updated_at": "2024-10-23T16:29:47Z", "state": { "id": 21, "name": "super cool ruleset", "target": "repository", "source_type": "Enterprise", "source": "my-enterprise", "enforcement": "active", "conditions": { "organization_name": { "include": [ "important_organization" ] }, "repository_name": { "include": [ "~ALL" ] } }, "rules": [ { "type": "repository_delete" } ] } }