# Organization API: Organization deployments: Hooks

> The 3 Organization API operations for hooks.

Source: https://www.coritan.com/docs/api/reference/organizations/organization-deployments/deployments-hooks/

Part of [Organization deployments](/docs/api/reference/organizations/organization-deployments/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/hooks`](#op-get-api-v1-orgs-org-slug-deployments-deployment-uuid-hooks) | List deploy hooks |
| POST | [`/api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/hooks`](#op-post-api-v1-orgs-org-slug-deployments-deployment-uuid-hooks) | Create deploy hook |
| DELETE | [`/api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/hooks/{hook_id}`](#op-delete-api-v1-orgs-org-slug-deployments-deployment-uuid-hooks-hook-id) | Delete a deploy hook |

### List deploy hooks {#op-get-api-v1-orgs-org-slug-deployments-deployment-uuid-hooks}

`GET /api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/hooks`

The deployment's deploy hooks, oldest first: each one's name, the
branch it builds, the environment a call releases to (``production``
for the production branch, ``preview`` for another) and when it was
made and last called. Never an address: that is answered once, when
the hook is made.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `deployment_uuid` | path | string (uuid) | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Create deploy hook {#op-post-api-v1-orgs-org-slug-deployments-deployment-uuid-hooks}

`POST /api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/hooks`

Make a deploy hook: an address that builds ``branch`` (the production
branch when left out) each time it is sent a POST. ``url`` is in this
answer only, since only a hash of it is kept; a lost one is replaced by
deleting the hook and making another. A hook of another branch makes
previews, so it answers 402 or 409 when called while previews are
unavailable. 409 for a deployment not built from a repository
(``not_git``), a name the deployment already uses (``name_taken``) or
more than 20 hooks (``limit``).

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `deployment_uuid` | path | string (uuid) | yes |
| `org_slug` | path | string | yes |

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `branch` | string or null | no | The branch it builds; the production branch when left out |

#### Responses

| Status | Meaning |
| --- | --- |
| `201` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |

### Delete a deploy hook {#op-delete-api-v1-orgs-org-slug-deployments-deployment-uuid-hooks-hook-id}

`DELETE /api/v1/orgs/{org_slug}/deployments/{deployment_uuid}/hooks/{hook_id}`

Delete a deploy hook. Its address stops answering at once; a release
it already started carries on. 404 for a hook the deployment does not have.

#### Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| `deployment_uuid` | path | string (uuid) | yes |
| `hook_id` | path | integer | yes |
| `org_slug` | path | string | yes |

#### Responses

| Status | Meaning |
| --- | --- |
| `200` | Success. |
| `422` | The request is not valid. `detail` lists each problem. |
