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

# POST /v1/banks/:bankId/accounts — Create Bank Account

> Open a new bank account for a character within a specific bank. Each character may hold only one account per bank. New accounts start with a zero balance.

Use this endpoint to open a new bank account for a character within a specific bank. Each character can only hold one account per bank — attempting to create a second account for the same character returns a `409 Conflict`. New accounts always start with a balance of zero.

<Note>
  Any authenticated user with the `USER` permission can open an account for a character, as long as the character exists in the system.
</Note>

## Endpoint

```text theme={null}
POST https://api.cacolombia.com/v1/banks/:bankId/accounts
```

## Path Parameters

<ParamField path="bankId" type="string" required>
  The Snowflake ID of the bank in which you want to create the account.
</ParamField>

## Request Body

<ParamField body="characterId" type="string" required>
  The Snowflake ID of the character for whom you are opening the account.
</ParamField>

## Response

A successful `201 Created` response returns the newly created account object:

<ResponseField name="accountId" type="string">
  The unique Snowflake ID for the new bank account.
</ResponseField>

<ResponseField name="bankId" type="string">
  The Snowflake ID of the bank this account belongs to.
</ResponseField>

<ResponseField name="characterId" type="string">
  The `characterId` of the character who owns this account.
</ResponseField>

<ResponseField name="balance" type="number">
  The account's initial balance. Always `0` for a newly created account.
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of when the account was opened.
</ResponseField>

<ResponseField name="updatedAt" type="string">
  ISO 8601 timestamp of when the account was last modified.
</ResponseField>

## Example Request

```bash theme={null}
curl -X POST "https://api.cacolombia.com/v1/banks/112233445566778800/accounts" \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{"characterId": "998877665544332211"}'
```

## Example Response

```json theme={null}
{
  "accountId": "223344556677889900",
  "bankId": "112233445566778800",
  "characterId": "998877665544332211",
  "balance": 0,
  "createdAt": "2024-06-08T07:30:00.000Z",
  "updatedAt": "2024-06-08T07:30:00.000Z"
}
```

## Error Responses

| Status | Description                                                                                              |
| ------ | -------------------------------------------------------------------------------------------------------- |
| `400`  | The request body is missing `characterId` or contains a value of the wrong type.                         |
| `401`  | You are not authenticated. Provide a valid authorization token with your request.                        |
| `404`  | No bank was found for the given `bankId`.                                                                |
| `404`  | No character was found for the given `characterId`.                                                      |
| `409`  | The character already has an account in this bank. Each character may hold at most one account per bank. |
