# Attach Cluster to App (/postgres-clusters/Postgres_attachments_create)

Attach a specific cluster to a Fly app. The attachment is created if it does not already exist.

`POST /v1/postgres/{postgres_cluster_id}/attachments`

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `postgres_cluster_id` | path | `string` | Yes | Managed Postgres Cluster ID |

## Request Body

Type: `createPostgresAttachmentRequest`

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `app_name` | `string` | Yes | Name of the Fly app to attach. |

## Responses

| Status | Description | Schema |
| --- | --- | --- |
| `200` | Cluster was already attached | `createPostgresAttachmentResponse` |
| `201` | Attachment created | `createPostgresAttachmentResponse` |
| `404` | 'Cluster not found' for the cluster; 'App not found' for the app | `PostgresErrorResponse` |
| `410` | 'This cluster has been deleted' or 'This cluster is being deleted' | `PostgresErrorResponse` |

The full machine-readable OpenAPI spec is available at /openapi.json.