---
title: "Turn what Link handed back into a connection"
method: POST
path: "/api/v1/banking/plaid/exchange"
tags: ["Money"]
---

# Turn what Link handed back into a connection

`POST /api/v1/banking/plaid/exchange`

## Request

- Base URL: `http://localhost:5180`
- URL: `http://localhost:5180/api/v1/banking/plaid/exchange`
- Auth: API key in cookie `better-auth.session_token`

Exchanges the one-use public token for the credential this reads with, seals it, and writes the connection. The answer lists every account the owner chose to share, each with the portfolio account it looks like or already feeds, so the next step is pairing. Sending the same public token twice is refused by Plaid rather than making a second connection. Nothing is read and nothing is billed by calling this. Owners only.

## Request body

- object
  - `publicToken` string, required
  - `bankAccountId` string: The account in the portfolio the owner started from, where they started from one.
  - `institutionId` string
  - `institutionName` string

## Response `200`

The connection, and what it shares.

- object
  - `ok` unknown, required
  - `data` object, required
    - `connectionId` string, required: Stable record id, e.g. `lse_012`.
    - `institution` string
    - `accounts` object[], required
      - `id` string, required
      - `name` string
      - `mask` string
      - `iban` string
      - `currency` string
      - `balance` number
      - `suggestedBankAccountId` string: Stable record id, e.g. `lse_012`.
      - `linkedBankAccountId` string: Stable record id, e.g. `lse_012`.
    - `startedFrom` string: Stable record id, e.g. `lse_012`.
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `400`: Plaid refused the token.
- `409`: Plaid is switched off here, or this deployment holds no Plaid credentials.

---

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