{"meta":{"title":"Points de terminaison d’API REST pour hooks de pré-réception d’organisation","intro":"Utilisez l’API REST pour visualiser et modifier l’application des hooks de pré-réception qui sont disponibles pour une organisation.","product":"API REST","breadcrumbs":[{"href":"/fr/enterprise-server@3.21/rest","title":"API REST"},{"href":"/fr/enterprise-server@3.21/rest/enterprise-admin","title":"Administration d’entreprise"},{"href":"/fr/enterprise-server@3.21/rest/enterprise-admin/org-pre-receive-hooks","title":"Hooks de préréception de l’organisation"}],"documentType":"article"},"body":"# Points de terminaison d’API REST pour hooks de pré-réception d’organisation\n\nUtilisez l’API REST pour visualiser et modifier l’application des hooks de pré-réception qui sont disponibles pour une organisation.\n\n## À propos des hooks de préréception de l’organisation\n\n> \\[!NOTE]\n> Ces points de terminaison prennent uniquement en charge l’authentification à l’aide d’un personal access token (classic). Pour plus d’informations, consultez « [Gestion de vos jetons d’accès personnels](/fr/enterprise-server@3.21/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic) ».\n\n### Attributs d’objet\n\n| Nom                              | Type      | Description                                                        |\n| -------------------------------- | --------- | ------------------------------------------------------------------ |\n| `name`                           | `string`  | Nom du crochet.                                                    |\n| `enforcement`                    | `string`  | État d’application du hook sur ce référentiel.                     |\n| `allow_downstream_configuration` | `boolean` | Si des référentiels peuvent remplacer l’application.               |\n| `configuration_url`              | `string`  | URL du point de terminaison où la mise en application est définie. |\n\nLes valeurs possibles pour `enforcement` sont `enabled`, `disabled` et `testing`.\n`disabled` indique que le hook pré-réception ne s’exécute pas.\n`enabled` indique qu’il s’exécute et rejette tous les envois qui entraînent un état différent de zéro.\n`testing` signifie que le script s’exécute, mais n’entraîne pas de rejet des envois.\n\n`configuration_url` peut être un lien vers ce point de terminaison ou la configuration globale de ce hook. Seuls les administrateurs de site sont en mesure d’accéder à la configuration globale.\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## List pre-receive hooks for an organization\n\n```\nGET /orgs/{org}/pre-receive-hooks\n```\n\nList all pre-receive hooks that are enabled or testing for this organization as well as any disabled hooks that can be configured at the organization level. Globally disabled pre-receive hooks that do not allow downstream configuration are not listed.\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* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n* **`direction`** (string)\n  The direction to sort the results by.\n  Default: `desc`\n  Can be one of: `asc`, `desc`\n\n* **`sort`** (string)\n  The sort order for the response collection.\n  Default: `created`\n  Can be one of: `created`, `updated`, `name`\n\n### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  http(s)://HOSTNAME/api/v3/orgs/ORG/pre-receive-hooks\n```\n\n**Response schema (Status: 200):**\n\nArray of objects:\n\n* `id`: integer\n* `name`: string\n* `enforcement`: string\n* `configuration_url`: string\n* `allow_downstream_configuration`: boolean\n\n## Get a pre-receive hook for an organization\n\n```\nGET /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id}\n```\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* **`pre_receive_hook_id`** (string) (required)\n  The unique identifier of the pre-receive hook.\n\n### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  http(s)://HOSTNAME/api/v3/orgs/ORG/pre-receive-hooks/PRE_RECEIVE_HOOK_ID\n```\n\n**Response schema (Status: 200):**\n\n* `id`: integer\n* `name`: string\n* `enforcement`: string\n* `configuration_url`: string\n* `allow_downstream_configuration`: boolean\n\n## Update pre-receive hook enforcement for an organization\n\n```\nPATCH /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id}\n```\n\nFor pre-receive hooks which are allowed to be configured at the org level, you can set enforcement and allow\\_downstream\\_configuration\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* **`pre_receive_hook_id`** (string) (required)\n  The unique identifier of the pre-receive hook.\n\n#### Body parameters\n\n* **`enforcement`** (string)\n  The state of enforcement for the hook on this repository.\n\n* **`allow_downstream_configuration`** (boolean)\n  Whether repositories can override enforcement.\n\n### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PATCH \\\n  http(s)://HOSTNAME/api/v3/orgs/ORG/pre-receive-hooks/PRE_RECEIVE_HOOK_ID \\\n  -d '{\n  \"enforcement\": \"enabled\",\n  \"allow_downstream_configuration\": false\n}'\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Get a pre-receive hook for an organization](#get-a-pre-receive-hook-for-an-organization).\n\n## Remove pre-receive hook enforcement for an organization\n\n```\nDELETE /orgs/{org}/pre-receive-hooks/{pre_receive_hook_id}\n```\n\nRemoves any overrides for this hook at the org level for this org.\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* **`pre_receive_hook_id`** (string) (required)\n  The unique identifier of the pre-receive hook.\n\n### HTTP response status codes\n\n* **200** - OK\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  http(s)://HOSTNAME/api/v3/orgs/ORG/pre-receive-hooks/PRE_RECEIVE_HOOK_ID\n```\n\n**Response schema (Status: 200):**\n\nSame response schema as [Get a pre-receive hook for an organization](#get-a-pre-receive-hook-for-an-organization)."}