---
title: "Link"
method: POST
path: "/api/v1/integrations/{provider}/link"
tags: ["integrations"]
---

# Link

`POST /api/v1/integrations/{provider}/link`

## Request

- Base URL: `https://api.aws.cognee.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.aws.cognee.ai/api/v1/integrations/{provider}/link`
- Auth: API key in header `X-Api-Key`

Bind one of a ``choose_installation`` outcome's ids to this tenant.

Idempotent: linking an id that is already this tenant's active
connection just re-confirms it, through the exact same write path
(:func:`flow.store_installation`) an ordinary reconnect of a live row
already uses, so selection and resource_health survive and nothing is
reset. Linking a *revoked* row's own installation id takes the other
branch of that same function instead: fresh selection, fresh
resource_health, because picking the previous org again (CLO-627)
must be a clean session, not a silent resurrection of a relationship
the tenant ended. Either way the dataset is the same one as before -
the connector's sticky metadata (GitHub's ``dataset_key``) carries
forward regardless of status; only a genuinely different installation
id gets a new one.

Same token/user/owner validation as ``GET /{provider}/link-choices``,
see that route's docstring for why failures here are ordinary HTTP
errors rather than ``/complete``'s outcome-slug shape.

## Path parameters

- `provider` string, required

## Request body

- LinkChoice: Body for ``POST /{provider}/link`` - one id from a ``choose_installation`` set. ``installation_id`` is bounded the same way ``ResourceSelection``'s ids are (512 chars): both are attacker-shaped strings on an authenticated route, checked against the token's own closed set of ids below rather than trusted for shape here.
  - `choice_token` string, required
  - `installation_id` string, required

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/cognee/apis/cognee-api.md) - [All operations](https://skmtc.dev/cognee/apis/cognee-api/llms.txt) - [OpenAPI document](https://skmtc.dev/cognee/apis/cognee-api/revisions/a7b6c6cb8212?raw)
