> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.thepennyinc.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.thepennyinc.com/_mcp/server.

# Create a linked account

POST https://sandbox.api.thepennyinc.com/accounts/linked/
Content-Type: application/json

Register an external bank account you send funds from; incoming funds are routed to your Capital Account.

Required permissions: `account:create`.

Reference: https://docs.thepennyinc.com/banking/api-reference/accounts/linked/create

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://sandbox.api.thepennyinc.com` (Sandbox — safe for testing, no real money movement., default)
- `https://live.api.thepennyinc.com` (Live — real businesses, real money movement.)

## Request

### Headers

- `X-Penny-As-Business` (string, optional, nullable) — Act on behalf of another business that has granted you access. Requires the `business:act_as` permission.

### Body (application/json)

This endpoint expects a CreateLinkedAccountRequest.

- `country` (enum, required) — ISO-3166-1 alpha-2 country code the external bank account is held in.
  - Allowed values: `US`
- `currency` (enum, required) — Currency the external bank account holds (`USD`).
  - Allowed values: `USD`
- `account_details` (CreateLinkedAccountRequestAccountDetails, required) — The external bank account's details (a US account or an IBAN).

## Response

### 201

The newly created linked account.

- `account_id` (string, required) — Unique identifier for the account.
- `version` (integer, required) — The current version of the account record.
- `version_time` (datetime, required) — ISO-8601 timestamp of the most recent account update.
- `status` (enum, required) — The current status of the linked account.
  - Allowed values: `created`, `pending_approval`, `approved`, `rejected`, `deleted`, `suspended`
- `currency` (enum, required) — ISO-4217 currency code for the account.
  - Allowed values: `USD`
- `country` (enum, required) — ISO-3166-1 alpha-2 country code for the account.
  - Allowed values: `US`
- `account_details` (LinkedAccountAccountDetails, required) — The bank account details, including routing or IBAN information.
- `alias` (string, optional, nullable) — An optional label for the account.
- `description` (string, optional, nullable) — An optional description of the account's purpose.
- `type` (enum, optional, default: linked) — Account types exposed to client-facing API responses.
  - Allowed values: `capital`, `control`, `linked`

## Errors

### 400 Bad Request Error

The request was malformed: a required field is missing or a value has the wrong type or format.

- `type` (string, required) — The name of the exception that was raised.
- `message` (string, required) — A human-readable description of the error.
- `details` (map from string to any, optional, nullable) — Structured context about the error, if any.
- `trace_id` (string, optional, nullable) — Identifier for correlating this error with server-side logs.
- `errors` (list of map from string to any, optional, nullable) — Sub-errors that contributed to this failure, if any.

### 401 Unauthorized Error

Authentication failed.

- `type` (string, required) — The name of the exception that was raised.
- `message` (string, required) — A human-readable description of the error.
- `details` (map from string to any, optional, nullable) — Structured context about the error, if any.
- `trace_id` (string, optional, nullable) — Identifier for correlating this error with server-side logs.
- `errors` (list of map from string to any, optional, nullable) — Sub-errors that contributed to this failure, if any.

### 403 Forbidden Error

The caller does not have permission to perform this action.

- `type` (string, required) — The name of the exception that was raised.
- `message` (string, required) — A human-readable description of the error.
- `details` (map from string to any, optional, nullable) — Structured context about the error, if any.
- `trace_id` (string, optional, nullable) — Identifier for correlating this error with server-side logs.
- `errors` (list of map from string to any, optional, nullable) — Sub-errors that contributed to this failure, if any.

### 404 Not Found Error

The business entity was not found.

- `type` (string, required) — The name of the exception that was raised.
- `message` (string, required) — A human-readable description of the error.
- `details` (map from string to any, optional, nullable) — Structured context about the error, if any.
- `trace_id` (string, optional, nullable) — Identifier for correlating this error with server-side logs.
- `errors` (list of map from string to any, optional, nullable) — Sub-errors that contributed to this failure, if any.

### 422 Unprocessable Entity Error

The request was well-formed but could not be processed because it breaks a business rule.

- `type` (string, required) — The name of the exception that was raised.
- `message` (string, required) — A human-readable description of the error.
- `details` (map from string to any, optional, nullable) — Structured context about the error, if any.
- `trace_id` (string, optional, nullable) — Identifier for correlating this error with server-side logs.
- `errors` (list of map from string to any, optional, nullable) — Sub-errors that contributed to this failure, if any.

### 429 Too Many Requests Error

Too many requests; retry after the Retry-After header.

- `type` (string, required) — The name of the exception that was raised.
- `message` (string, required) — A human-readable description of the error.
- `details` (map from string to any, optional, nullable) — Structured context about the error, if any.
- `trace_id` (string, optional, nullable) — Identifier for correlating this error with server-side logs.
- `errors` (list of map from string to any, optional, nullable) — Sub-errors that contributed to this failure, if any.

### 500 Internal Server Error

An unexpected error occurred.

- `type` (string, required) — The name of the exception that was raised.
- `message` (string, required) — A human-readable description of the error.
- `details` (map from string to any, optional, nullable) — Structured context about the error, if any.
- `trace_id` (string, optional, nullable) — Identifier for correlating this error with server-side logs.
- `errors` (list of map from string to any, optional, nullable) — Sub-errors that contributed to this failure, if any.

## Types

### CreateLinkedAccountRequestAccountDetails

The external bank account's details (a US account or an IBAN).

- `type`: `iban` (IbanAccountDetailsRequest)
  - `iban` (string, required) — The international bank account number (ISO-13616).
- `type`: `us_account` (USAccountDetailsRequest)
  - `account_number` (string, required) — The unique account number identifying the U.S. bank account.
  - `routing_number` (string, required) — The nine-digit ABA routing number of the bank.
  - `us_account_type` (enum, required) — The type of U.S. bank account.
    - Allowed values: `checking`, `savings`

### LinkedAccountAccountDetails

The bank account details, including routing or IBAN information.

- IbanAccountDetailsResponse: IbanAccountDetailsResponse
- USAccountDetailsResponse: USAccountDetailsResponse

### IbanAccountDetailsResponse

- `iban` (string, required) — The International Bank Account Number (IBAN) for this account.
- `type` (enum, optional, default: iban) — The format of a linked bank account's details: an IBAN or a U.S. account and routing number.
  - Allowed values: `iban`, `us_account`

### USAccountDetailsResponse

- `account_number` (string, required) — The U.S. bank account number.
- `routing_number` (string, required) — The nine-digit ABA routing number for the financial institution.
- `account_type` (enum, required) — The type of U.S. bank account.
  - Allowed values: `checking`, `savings`
- `type` (enum, optional, default: us_account) — The format of a linked bank account's details: an IBAN or a U.S. account and routing number.
  - Allowed values: `iban`, `us_account`

## Examples

**Request**

```json
{
  "country": "US",
  "currency": "USD",
  "account_details": {
    "iban": "GB29NWBK60161331926819"
  }
}
```

**Response**

```json
{
  "account_id": "account_019372e3-b8dc-7de2-80b6-b8dcde20b6c9",
  "version": 1,
  "version_time": "2024-01-15T10:30:00Z",
  "status": "approved",
  "currency": "USD",
  "country": "US",
  "account_details": {
    "iban": "GB29NWBK60161331926819",
    "type": "iban"
  },
  "alias": "operations-account",
  "description": "Primary operating account for day-to-day spend.",
  "type": "linked"
}
```

**SDK Code**

```python
import requests

url = "https://sandbox.api.thepennyinc.com/accounts/linked/"

payload = {
    "country": "US",
    "currency": "USD",
    "account_details": { "iban": "GB29NWBK60161331926819" }
}
headers = {
    "X-Penny-As-Business": "business_01a083e2-82ed-7a5c-9d1e-3b6f0c2a4d71",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://sandbox.api.thepennyinc.com/accounts/linked/';
const options = {
  method: 'POST',
  headers: {
    'X-Penny-As-Business': 'business_01a083e2-82ed-7a5c-9d1e-3b6f0c2a4d71',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"country":"US","currency":"USD","account_details":{"iban":"GB29NWBK60161331926819"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://sandbox.api.thepennyinc.com/accounts/linked/"

	payload := strings.NewReader("{\n  \"country\": \"US\",\n  \"currency\": \"USD\",\n  \"account_details\": {\n    \"iban\": \"GB29NWBK60161331926819\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Penny-As-Business", "business_01a083e2-82ed-7a5c-9d1e-3b6f0c2a4d71")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://sandbox.api.thepennyinc.com/accounts/linked/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Penny-As-Business"] = 'business_01a083e2-82ed-7a5c-9d1e-3b6f0c2a4d71'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"country\": \"US\",\n  \"currency\": \"USD\",\n  \"account_details\": {\n    \"iban\": \"GB29NWBK60161331926819\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://sandbox.api.thepennyinc.com/accounts/linked/")
  .header("X-Penny-As-Business", "business_01a083e2-82ed-7a5c-9d1e-3b6f0c2a4d71")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"country\": \"US\",\n  \"currency\": \"USD\",\n  \"account_details\": {\n    \"iban\": \"GB29NWBK60161331926819\"\n  }\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://sandbox.api.thepennyinc.com/accounts/linked/', [
  'body' => '{
  "country": "US",
  "currency": "USD",
  "account_details": {
    "iban": "GB29NWBK60161331926819"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-Penny-As-Business' => 'business_01a083e2-82ed-7a5c-9d1e-3b6f0c2a4d71',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://sandbox.api.thepennyinc.com/accounts/linked/");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Penny-As-Business", "business_01a083e2-82ed-7a5c-9d1e-3b6f0c2a4d71");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"country\": \"US\",\n  \"currency\": \"USD\",\n  \"account_details\": {\n    \"iban\": \"GB29NWBK60161331926819\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Penny-As-Business": "business_01a083e2-82ed-7a5c-9d1e-3b6f0c2a4d71",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "country": "US",
  "currency": "USD",
  "account_details": ["iban": "GB29NWBK60161331926819"]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox.api.thepennyinc.com/accounts/linked/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```