> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fluz.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Answer an information request with a bank link

> Answer a bank-statement or proof-of-address RFI question by linking a bank account with Plaid, using completeRfiPlaidLink.

## Overview

Two question types can be answered by linking a bank account instead of uploading a document:

| Question type | A bank link answers it when |
| - | - |
| `BANK_LINK_OR_STATEMENT` | The bank is linked successfully |
| `ADDRESS_VERIFICATION_OR_DOCUMENT` | The bank is linked **and** confirms the customer's address |

The **completeRfiPlaidLink** mutation exchanges the public token from Plaid Link, links the bank to the customer's Fluz account, and saves the link as the question's answer.

It does not submit the RFI. Call [submitRfi](https://docs.fluz.app/submit-rfi) afterwards to send it for review.

## Required scopes

| Property | Value |
| - | - |
| Endpoint | GraphQL API |
| Authentication | OAuth Bearer Token. Basic auth is not accepted |
| Required Scopes | `MANAGE_RFI` and `MANAGE_PAYMENT` |

`MANAGE_PAYMENT` is required because the bank is also added to the customer's account as a funding source. `createPlaidLinkToken` needs it too.

## Flow

**1. Create a Link token**

Call `createPlaidLinkToken` with the customer's token. See [Linking a bank account via Plaid](https://docs.fluz.app/features/link-via-plaid.md).

**2. Open Plaid Link**

Open Plaid Link with that token. When the customer finishes, Plaid returns a `public_token`.

**3. Call completeRfiPlaidLink**

Pass the `rfiId`, the `questionId` and the `public_token`. The bank is linked and the answer is saved.

**4. Submit the RFI**

Call [submitRfi](https://docs.fluz.app/submit-rfi). Leave the linked question out of `answers` — the saved link already answers it.

## Basic mutation structure

```graphql theme={null}
mutation CompleteRfiPlaidLink($input: CompleteRfiPlaidLinkInput!) {
  completeRfiPlaidLink(input: $input) {
    rfiId
    status
    requiresAddress
    bankAccountId
    bankInstitutionAuthId
    newlyLinkedBankInstitutionAuthId
    bankInstitutionName
    platformItemId
    bankAccounts {
      bankInstitutionAuthId
      bankAccountId
      bankName
      lastFour
      type
      subtype
    }
  }
}
```

## Parameters

### CompleteRfiPlaidLinkInput

| Field | Type | Required | Description |
| - | - | - | - |
| `rfiId` | `UUID!` | Yes | The RFI to answer |
| `questionId` | `String!` | Yes | A `BANK_LINK_OR_STATEMENT` or `ADDRESS_VERIFICATION_OR_DOCUMENT` question. 1–200 characters |
| `publicToken` | `String!` | Yes | The `public_token` Plaid Link returned. Starts with `public-`, up to 256 characters |

## cURL Example

```bash theme={null}
curl -X POST https://transactional-graph.staging.fluzapp.com/api/v1/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -d '{
    "query": "mutation CompleteRfiPlaidLink($input: CompleteRfiPlaidLinkInput!) { completeRfiPlaidLink(input: $input) { rfiId status bankInstitutionName bankAccounts { bankAccountId bankName lastFour type subtype } } }",
    "variables": {
      "input": {
        "rfiId": "7c1e2a90-4b3d-4f6e-9a18-3d5b2c7e8f01",
        "questionId": "q_address",
        "publicToken": "public-sandbox-5c224a01-8314-4491-a06f-39e193d5cddc"
      }
    }
  }'
```

## Response details

### CompleteRfiPlaidLinkResponse

| Field | Type | Description |
| - | - | - |
| `rfiId` | `UUID!` | The RFI from the input |
| `status` | `RfiStatus!` | Stays `PENDING_DOCUMENTS`. Send the RFI for review with `submitRfi` |
| `requiresAddress` | `Boolean!` | Same as `completePlaidLink`: when `true`, attach an address with `createPlaidLinkAddress`. See [Manage linked bank accounts](https://docs.fluz.app/features/link-external-bank-accounts.md) |
| `bankAccountId` | `UUID` | The linked bank account |
| `bankInstitutionAuthId` | `UUID` | The linked bank connection |
| `newlyLinkedBankInstitutionAuthId` | `UUID` | Set when this call created a new bank connection |
| `bankInstitutionName` | `String` | The bank's name |
| `platformItemId` | `String` | Plaid item reference, used to repair the connection later |
| `bankAccounts` | `[PlaidLinkedBankAccount!]!` | The accounts linked under this connection |

### PlaidLinkedBankAccount

| Field | Type | Description |
| - | - | - |
| `bankInstitutionAuthId` | `UUID` | The bank connection |
| `bankAccountId` | `UUID` | The account |
| `bankName` | `String` | Bank name |
| `lastFour` | `String` | Last four digits of the account number |
| `type` | `String` | Plaid account type, for example `depository` |
| `subtype` | `String` | Plaid account subtype, for example `checking` |

```json theme={null}
{
  "data": {
    "completeRfiPlaidLink": {
      "rfiId": "7c1e2a90-4b3d-4f6e-9a18-3d5b2c7e8f01",
      "status": "PENDING_DOCUMENTS",
      "bankInstitutionName": "Chase",
      "bankAccounts": [
        {
          "bankAccountId": "4a8d2f61-9c3e-4b7a-a215-6e0f8b9c1d32",
          "bankName": "Chase",
          "lastFour": "4417",
          "type": "depository",
          "subtype": "checking"
        }
      ]
    }
  }
}
```

After this call, the question reads back with `isSubmitted: true` and an `answer` of type `PLAID_BANK_LINK`.

## Address questions

For an `ADDRESS_VERIFICATION_OR_DOCUMENT` question, the bank must confirm the customer's address. If it does not:

* the call fails with `ADDRESS_NOT_VERIFIED` and no answer is saved,
* the bank **stays linked** to the customer's account, and
* the customer can link a different bank, or you can [upload](https://docs.fluz.app/upload-rfi-document) a proof-of-address document and answer the question in `submitRfi`.

## Replacing a link

Calling `completeRfiPlaidLink` again for the same question replaces the saved link, as long as the RFI is still `PENDING_DOCUMENTS`. A question already answered with documents cannot be switched to a bank link.

## Error Codes

Failures are returned in the top-level `errors` array. RFI errors carry `extensions.rfiErrorCode`.

| Code | `rfiErrorCode` | Description | How to resolve |
| - | - | - | - |
| `AUTH-0002` | — | Basic auth was used | Call with a Bearer user token |
| `AUTH-0008` | — | The Bearer token has no `userId` or `accountId` | Mint the token for a user and account |
| `AUTH-0031` | — | The token is missing `MANAGE_RFI` or `MANAGE_PAYMENT` | Add both scopes and re-mint the token |
| `G-0003` | `ACCESS_DENIED` | The RFI does not exist, or it is not addressed to the token's user and account | Use the token you read the RFI with |
| `ARG-0001` | `INVALID_INPUT` | `rfiId`, `questionId` or `publicToken` is malformed | Check the input |
| `ARG-0001` | `RFI_NOT_OPEN` | The RFI is not waiting for answers | Read the RFI to see its status |
| `ARG-0001` | `RFI_EXPIRED` | The RFI has expired | Direct the customer to support |
| `ARG-0001` | `UNKNOWN_QUESTION` | No answerable question with this `questionId` | Use a `questionId` from the RFI's current questions |
| `ARG-0001` | `NOT_A_LINK_QUESTION` | The question is not a bank-link or address question | Answer it in `submitRfi` |
| `ARG-0001` | `ALREADY_SUBMITTED` | The question already has documents saved | Nothing to do. The question is answered |
| `ARG-0001` | `ADDRESS_NOT_VERIFIED` | The bank did not confirm the customer's address. `extensions.identityMatchStatus` gives the result. The bank stays linked | Link a different bank, or upload proof of address |
| `ARG-0001` | `PLAID_LINK_FAILED` | The bank link could not be completed | Have the customer try Plaid Link again |
| `ARG-0001` or `G-0001` | — | Plaid could not exchange the public token | Start again with a new Link token |

## Related pages

> [card] [Submit an RFI](https://docs.fluz.app/submit-rfi)
>
> Send the RFI for review after linking.

> [card] [Linking a bank account via Plaid](https://docs.fluz.app/features/link-via-plaid.md)
>
> `createPlaidLinkToken` and the Plaid Link flow.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.