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

# Account Endpoints

Manage accounts and associate clients with them using the following endpoints.

## Full Endpoint URL

```
https://secure.heysaturn.com/api/external/v1/account/
```

### `POST /account/`

This endpoint allows you to create or update accounts in Saturn and associate clients with them.

### Mandatory Fields

| Field          | Type   | Description                                                                    |
| -------------- | ------ | ------------------------------------------------------------------------------ |
| `crm`          | string | The CRM source. Must be a valid CRM (`curo`, `xplan`, `plannr`, `intelliflo`). |
| `account_id`   | string | Unique account UUID from the CRM source.                                       |
| `account_name` | string | The name of the account.                                                       |
| `clients`      | array  | List of clients to associate with the account.                                 |
| `clients[].id` | string | Unique client UUID from the CRM source.                                        |

### Request Payload Example

```json theme={null}
{
    "crm": "curo",
    "account_id": "sample-account-uuid-curo",
    "account_name": "Mr & Mrs Saturns' Joint Account",
    "clients": [
        {
            "first_name": "Sarah",
            "last_name": "Saturn",
            "email": "sarah.saturn@example.com",
            "phone_number": "+447762000000",
            "id": "sample-curo-client-uuid-1"
        },
        {
            "first_name": "Michael",
            "last_name": "Saturn",
            "email": "michael.saturn@example.com",
            "phone_number": "+4479221100",
            "id": "sample-curo-client-uuid-2"
        }
    ]
}
```

### Response Example

```json theme={null}
{
    "created_accounts": [
        {
            "account_id": "sample-account-uuid-curo",
            "account_name": "Mr & Mrs Saturns' Joint Account",
            "clients": {
                "created": [
                    {
                        "first_name": "Sarah",
                        "last_name": "Saturn",
                        "email": "sarah.saturn@example.com",
                        "phone_number": "+447762000000",
                        "type": "Individual",
                        "id": 2406
                    },
                    {
                        "first_name": "Michael",
                        "last_name": "Saturn",
                        "email": "michael.saturn@example.com",
                        "phone_number": "+4479221100",
                        "type": "Individual",
                        "id": 2407
                    }
                ],
                "existing": []
            }
        }
    ],
    "existing_accounts": [],
    "messages": [
        "Account 'sample-account-uuid-curo' created successfully."
    ]
}
```
