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

# Create paykeys from raw bank account details

> Use the Straddle Bridge API to create paykeys directly from raw routing and account numbers without an open banking provider, with built-in verification.

This guide provides a detailed walkthrough on using Straddle's Bridge API to create paykeys directly from bank account information.

## Implementation Steps

<AccordionGroup>
  <Accordion title="1. Securely collect bank account information from the user" icon="user-round-x">
    Ensure that bank account details such as the account number, routing number, and account holder's name are collected securely through your frontend. Utilize encryption or tokenization to protect sensitive data.
  </Accordion>

  <Accordion title="2. Send the bank account details to your server" icon="server">
    Once the bank account details are collected, send the information to your backend server over a secure connection (e.g., HTTPS). Your server should handle the data safely and securely for further processing.
  </Accordion>

  <Accordion title="3. Use the Straddle Bridge API to create a paykey" icon="file-signature">
    On your backend, send a request to the Straddle Bridge API with the bank account details to create a paykey. Straddle will return a paykey that can be used for future transactions without needing to store sensitive bank information.
  </Accordion>

  <Accordion title="4. Store and use the paykey for future transactions" icon="database">
    Store the `paykey` securely in your system. You can use this `paykey` to create charges, initiate payments, or perform other transactions via Straddle's API in the future, without handling sensitive bank data again.
  </Accordion>
</AccordionGroup>

## Using Bridge with 'Raw' Bank Account Details

To create a paykey using bank account details, make a POST request to the Straddle Bridge API. Here's the HTTP request details:

```bash Bridge a Bank Account theme={null}
curl -X POST https://api.straddle.com/v1/bridge/bank_account \
  -H "Authorization: Bearer YOUR_STRADDLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "0191ef41-8de5-716c-bfa4-41cd79e85705",
  "routing_number": "011000138",
  "account_number": "123456789",
  "account_type": "checking",
  "metadata": {
    "user_reference": "user_12345"
  }
}
```

Replace `YOUR_STRADDLE_API_KEY` with your actual Straddle API key, and fill in the appropriate values for `customer_id`, `routing_number`, `account_number`, and `account_type`.

## Handling the API Response

Upon successful creation of a paykey, the Straddle API will respond with a JSON object. Here's an example of what you might receive:

```json theme={null}
{
  "data": {
    "paykey": "05f5d55cb14f7e8a0ec2e5689376e3b4665efc34834d30995babbd5010b39913",
    "bank_data": {
      "routing_number": "011000138",
      "account_number": "******6789",
      "account_type": "checking"
    },
    "id": "0191ef49-892c-7460-99d1-f5589d7d9989",
    "customer_id": "0191ef41-8de5-716c-bfa4-41cd79e85705",
    "label": "BANK OF AMERICA, N.A. - *6789",
    "source": "bank_account",
    "institution_name": "BANK OF AMERICA, N.A.",
    "status": "active",
    "created_at": "2024-09-14T06:47:39.5648743Z",
    "updated_at": "2024-09-14T06:47:39.5648746Z"
  },
  "meta": {
    "api_request_id": "243431dd-7deb-4445-820d-55a942ace70f"
  },
  "response_type": "object"
}
```
