---
title: "Attach Cluster to App"
method: POST
path: "/postgres/{postgres_cluster_id}/attachments"
tags: ["Postgres Clusters"]
---

# Attach Cluster to App

`POST /postgres/{postgres_cluster_id}/attachments`

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

## Path parameters

- `postgres_cluster_id` string, required

## Request body

- CreatePostgresAttachmentRequest
  - `app_name` string, required — Name of the Fly app to attach.

## Response `200`

Cluster was already attached

- CreatePostgresAttachmentResponse
  - `data` PostgresAttachment
    - `app_name` string — Attached Fly app name.
    - `attached_at` string — RFC 3339 timestamp when the attachment was created.
    - `postgres_cluster_id` string — Cluster ID the app is attached to.

## Other responses

- `201` — Attachment created
- `404` — 'Cluster not found' for the cluster; 'App not found' for the app
- `410` — 'This cluster has been deleted' or 'This cluster is being deleted'

---

[API](https://skmtc.net/machines/apis/machines-api.md) · [All operations](https://skmtc.net/machines/apis/machines-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/machines/machines-api/versions/633ddedda749/schema)
