{"meta":{"title":"组织自定义属性值的 REST API 终结点","intro":"使用 REST API 管理组织的自定义属性值","product":"REST API","breadcrumbs":[{"href":"/zh/enterprise-cloud@latest/rest","title":"REST API"},{"href":"/zh/enterprise-cloud@latest/rest/orgs","title":"组织"},{"href":"/zh/enterprise-cloud@latest/rest/orgs/custom-properties-for-orgs","title":"组织的自定义属性"}],"documentType":"article"},"body":"# 组织自定义属性值的 REST API 终结点\n\n使用 REST API 管理组织的自定义属性值\n\n> [!NOTE]\n> Most endpoints use `Authorization: Bearer <YOUR-TOKEN>` and `Accept: application/vnd.github+json` headers, plus `X-GitHub-Api-Version: 2026-03-10`. Curl examples below omit these standard headers for brevity.\n\n## Get all custom property values for an organization\n\n```\nGET /organizations/{org}/org-properties/values\n```\n\nGets all custom property values that are set for an organization.\nThe organization must belong to an enterprise.\nAccess requirements:\n\nOrganization admins\nOAuth tokens and personal access tokens (classic) with the read:org scope\nActors with the organization-level \"read custom properties for an organization\" fine-grained permission or above\n\n### Parameters\n\n#### Headers\n\n- **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n### HTTP response status codes\n\n- **200** - OK\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/organizations/ORG/org-properties/values\n```\n\n**Response schema (Status: 200):**\n\nArray of `Custom Property Value`:\n  * `property_name`: required, string\n  * `value`: required, one of:\n    * **string**\n    * **array**\n\n## Create or update custom property values for an organization\n\n```\nPATCH /organizations/{org}/org-properties/values\n```\n\nCreate new or update existing custom property values for an organization.\nTo remove a custom property value from an organization, set the property value to null.\nThe organization must belong to an enterprise.\nAccess requirements:\n\nOrganization admins\nOAuth tokens and personal access tokens (classic) with the admin:org scope\nActors with the organization-level \"edit custom properties for an organization\" fine-grained permission\n\n### Parameters\n\n#### Headers\n\n- **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n#### Body parameters\n\n- **`properties`** (array of objects) (required)\n  A list of custom property names and associated values to apply to the organization.\n  - **`property_name`** (string) (required)\n    The name of the property\n  - **`value`** (null or string or array) (required)\n    The value assigned to the property\n\n### HTTP response status codes\n\n- **204** - No Content when custom property values are successfully created or updated\n\n- **403** - Forbidden\n\n- **404** - Resource not found\n\n- **422** - Validation failed, or the endpoint has been spammed.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PATCH \\\n  https://api.github.com/organizations/ORG/org-properties/values \\\n  -d '{\n  \"properties\": [\n    {\n      \"property_name\": \"environment\",\n      \"value\": \"production\"\n    },\n    {\n      \"property_name\": \"service\",\n      \"value\": \"web\"\n    },\n    {\n      \"property_name\": \"team\",\n      \"value\": \"octocat\"\n    }\n  ]\n}'\n```\n\n**Response schema (Status: 204):**"}