Custom properties
Use the REST API to list the custom properties assigned to a repository by the organization.
About custom properties
You can use the REST API to view the custom properties that were assigned to a repository by the organization that owns the repository. For more information, see "Managing custom properties for repositories in your organization." For more information about the REST API endpoints to manage custom properties, see "Custom properties."
Note: The API endpoints for custom properties are in public beta and subject to change.
Get all custom property values for a repository
Gets all custom property values that are set for a repository. Users with read access to the repository can use this endpoint.
GitHub Apps must have the metadata:read repository permission to use this endpoint.
Parameters for "Get all custom property values for a repository"
| Name, Type, Description |
|---|
accept string Setting to |
| Name, Type, Description |
|---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
HTTP response status codes for "Get all custom property values for a repository"
| Status code | Description |
|---|---|
200 | OK |
403 | Forbidden |
404 | Resource not found |
Code samples for "Get all custom property values for a repository"
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/repos/OWNER/REPO/properties/valuesResponse
Status: 200[
{
"property_name": "environment",
"value": "production"
},
{
"property_name": "service",
"value": "web"
},
{
"property_name": "team",
"value": "octocat"
}
]Create or update custom property values for a repository
Create new or update existing custom property values for a repository.
Using a value of null for a custom property will remove or 'unset' the property value from the repository.
Repository admins and other users with the repository-level "edit custom property values" fine-grained permission can use this endpoint.
GitHub Apps must have the repository_custom_properties:write permission to use this endpoint.
Parameters for "Create or update custom property values for a repository"
| Name, Type, Description |
|---|
accept string Setting to |
| Name, Type, Description |
|---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
| Name, Type, Description | |||
|---|---|---|---|
properties array of objects RequiredA list of custom property names and associated values to apply to the repositories. | |||
Properties of |
| Name, Type, Description |
|---|
property_name string RequiredThe name of the property |
value string or null RequiredThe value assigned to the property |
HTTP response status codes for "Create or update custom property values for a repository"
| Status code | Description |
|---|---|
204 | No Content when custom property values are successfully created or updated |
403 | Forbidden |
404 | Resource not found |
Code samples for "Create or update custom property values for a repository"
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/repos/OWNER/REPO/properties/values \
-d '{"properties":[{"property_name":"environment","value":"production"},{"property_name":"service","value":"web"},{"property_name":"team","value":"octocat"}]}'No Content when custom property values are successfully created or updated
Status: 204