# `Weavr.LinkedAccounts`
[🔗](https://github.com/iamkanishka/weavr/blob/main/lib/weavr/resources/linked_accounts.ex#L1)

Linked Accounts — external bank accounts connected to a Weavr identity.

Confirmed from `weavr-multi-api.redoc.ly/3.55.0/tag/Linked-Accounts/` and
Weavr's published documentation.

A Linked Account represents an external bank account or PSP account that
the identity has verified they own and control. This enables self-to-self
fund transfers between external accounts and Weavr Managed Accounts.

In UK Cards-Focused programmes, **End Customers are required to have at
least one active Linked Account** before they can fund their Managed
Accounts via wire transfer.

## Confirmed endpoints

  * `GET  /linked_accounts` — list linked accounts for the identity
  * `POST /linked_accounts` — add a new linked account
  * `GET  /linked_accounts/{id}` — get a linked account
  * `DELETE /linked_accounts/{id}` — remove a linked account

## Notes

  * Linking an account typically involves a verification step (e.g. a small
    trial deposit) — the exact flow depends on your programme configuration.
  * Confirmed presence of a `"state"` field on linked accounts indicating
    verification status.

# `create`

```elixir
@spec create(Weavr.Config.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}
```

Adds a new linked account for the identity.

`POST /linked_accounts`

The required fields in `attrs` depend on the account type and your programme
configuration. At minimum, include the external account's bank details
(e.g. IBAN, sort code + account number, or BIC/SWIFT).

# `get`

```elixir
@spec get(Weavr.Config.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}
```

Fetches a linked account by id. `GET /linked_accounts/{id}`.

# `list`

```elixir
@spec list(
  Weavr.Config.t(),
  keyword()
) :: {:ok, map()} | {:error, Weavr.Error.t()}
```

Lists all linked accounts for the authenticated identity.

`GET /linked_accounts` — supports `opts[:filters]` as query params.

# `remove`

```elixir
@spec remove(Weavr.Config.t(), String.t(), keyword()) ::
  :ok | {:error, Weavr.Error.t()}
```

Removes a linked account. `DELETE /linked_accounts/{id}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
