# Client API: Deployments: Bindings

> The 4 Client API operations for bindings.

Source: https://www.coritan.com/docs/api/reference/client/deployments/deployments-bindings/

Part of [Deployments](/docs/api/reference/client/deployments/).

## Operations

| Method | Path | Summary |
| --- | --- | --- |
| GET | [`/api/v1/client/deployments/{deployment_uuid}/bindings`](#op-get-api-v1-client-deployments-deployment-uuid-bindings) | List bindings |
| POST | [`/api/v1/client/deployments/{deployment_uuid}/bindings`](#op-post-api-v1-client-deployments-deployment-uuid-bindings) | Bind a resource |
| GET | [`/api/v1/client/deployments/{deployment_uuid}/bindings/options`](#op-get-api-v1-client-deployments-deployment-uuid-bindings-options) | Binding options |
| DELETE | [`/api/v1/client/deployments/{deployment_uuid}/bindings/{binding_id}`](#op-delete-api-v1-client-deployments-deployment-uuid-bindings-binding-id) | Remove binding |

### List bindings {#op-get-api-v1-client-deployments-deployment-uuid-bindings}

`GET /api/v1/client/deployments/{deployment_uuid}/bindings`

The deployment's bindings, oldest first: each one's kind, status
(``active``; ``pending`` while an order's binding waits for the
deployment to be provisioned; ``error`` with the reason), the names
of the variables it sets and what it made (the bucket and key id, the
credential's address, the records, the addresses).

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

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

#### Responses

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

### Bind a resource {#op-post-api-v1-client-deployments-deployment-uuid-bindings}

`POST /api/v1/client/deployments/{deployment_uuid}/bindings`

Bind a resource. ``object_storage`` makes an access key for this
deployment alone, scoped to the bucket (a new bucket when ``ref`` is
left out or ``new``, within the service's bucket limit and the plan's
storage); ``smtp`` makes an SMTP credential on the relay; ``dns``
publishes a CNAME to the platform name and the verification record
for each custom domain in the owner's zones; ``shield`` puts the
floating IPs attached to a template deployment's servers under the
profile. ``egress_ip`` answers 409 ``egress_unavailable`` with what
is missing. Two bindings that would set one variable answer 409
``variable_conflict``; give one an ``env_prefix``.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

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

#### Request body

`application/json` (required)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `kind` | string | yes |  |
| `ref` | string or null | no | object_storage: a bucket id or name, or new (the default); database: the database deployment's uuid; smtp: a sending domain (the first ready one when left out); shield: a Shield profile id |
| `env_prefix` | string or null | no | Joined to each variable with _, so two bindings of one kind can coexist |
| `target` | string | no | both: builds read the variables too |
| `service_id` | integer or null | no | Which Object Storage or SMTP Relay service, when there are several |
| `mode` | string | no | object_storage: what the key may do |
| `hostnames` | array of string or null | no | dns: only these custom domains |

#### Responses

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

### Binding options {#op-get-api-v1-client-deployments-deployment-uuid-bindings-options}

`GET /api/v1/client/deployments/{deployment_uuid}/bindings/options`

For each kind, whether the deployment can take it (``available``,
with ``reason`` and ``error`` when not) and the owner's resources a
binding could name: Object Storage services and their buckets,
template deployments, SMTP Relays and their sending domains, the
records DNS would publish, Shield profiles.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

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

#### Responses

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

### Remove binding {#op-delete-api-v1-client-deployments-deployment-uuid-bindings-binding-id}

`DELETE /api/v1/client/deployments/{deployment_uuid}/bindings/{binding_id}`

Remove a binding and revoke what it made: the access key or the
SMTP credential is deleted (the bucket, the relay and its domains
stay), the records it created are deleted, and each address goes
back under the Shield profile it had. ``kept`` says what stays. The
next release no longer reads its variables.

Authentication: an access token, sent as `Authorization: Bearer <token>`.

#### Parameters

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

#### Responses

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