# Accounts

### **Accounts** <a href="#accounts" id="accounts"></a>

The Accounts API allows sub-account creation and management.

#### **Get Account** <a href="#get-account" id="get-account"></a>

This API is useful for getting profile information of a sub-account under the organization.

```
GET /es/v2/accounts/<account_id>
```

**Response:**

```
{
  "statusCode": 0,
  "statusMessage": "string",
  "response": {
    "connections": "string",
    "createdTime": 0,
    "enabled": true,
    "env": {
      "host": "string",
      "id": "string",
      "name": "string"
    },
    "id": "string",
    "name": "string",
    "updatedTime": 0,
    "userId": "string",
    "userEmail": "string",
    "volume": 0
  }
}
```

**Attributes:**

| Attribute   | Description                                     | Possible Values                            |
| ----------- | ----------------------------------------------- | ------------------------------------------ |
| connections | Number of connections the account has created   | Integer (e.g., 0, 1, 2, etc.)              |
| createdTime | Account creation time                           | Unix timestamp (seconds)                   |
| enabled     | Indicates whether the account is enabled or not | `true` or `false`                          |
| env         | Contains environment-related details            | Hostname, ID, name, etc.                   |
| id          | Unique identifier for the account               | UUID (16-character identifier)             |
| name        | Name of the account                             | String (e.g., account name)                |
| userEmail   | Account owner's email address                   | Email address (e.g., <example@domain.com>) |
| updatedTime | Account update time                             | Unix timestamp (seconds)                   |
| userId      | Identifier for the account owner                | UUID (16-character identifier)             |
| volume      | Volume used by the account                      | Integer (e.g., 0, 1000, etc.)              |

**Sample Curl:**

```
curl --location '<host>/es/v2/accounts/0e1ebe4f518d3211' \
--header 'Authorization: Bearer c076dc2e-d0c2-4d4d-ab13-e4e3dd555fc0'
```

#### **Get List of Accounts** <a href="#get-list-of-accounts" id="get-list-of-accounts"></a>

The API returns list of accounts under the organization account.

```
GET /es/v2/accounts/list
```

**Query params**

```
&q=keyword
&size=10
&offset=0
```

**Response:**

```
{
  "statusCode": 0,
  "statusMessage": "string",
  "response": [
    {
      "connections": "string",
      "createdTime": 0,
      "enabled": true,
      "env": {
        "host": "string",
        "id": "string",
        "name": "string"
      },
      "id": "string",
      "name": "string",
      "userEmail": "string",
      "updatedTime": 0,
      "userId": "string",
      "volume": 0
    }
  ]
}
```

**Attributes:**

| Attribute   | Description                                     | Possible Values                            |
| ----------- | ----------------------------------------------- | ------------------------------------------ |
| connections | Number of connections the account has created   | Integer (e.g., 0, 1, 2, etc.)              |
| createdTime | Account creation time                           | Unix timestamp (seconds)                   |
| enabled     | Indicates whether the account is enabled or not | `true` or `false`                          |
| env         | Contains environment-related details            | Hostname, ID, name, etc.                   |
| id          | Unique identifier for the account               | UUID (16-character identifier)             |
| name        | Name of the account                             | String (e.g., account name)                |
| userEmail   | Account owner's email address                   | Email address (e.g., <example@domain.com>) |
| updatedTime | Account update time                             | Unix timestamp (seconds)                   |
| userId      | Identifier for the account user                 | UUID (16-character identifier)             |
| volume      | Volume used by the account                      | Integer (e.g., 0, 1000, etc.)              |

**Sample Curl::**

```
curl --location '<host>/es/v2/accounts/list?q=&size=10&offset=0' \
--header 'Authorization: Bearer c076dc2e-d0c2-4d4d-ab13-e4e3dd555fc0'
```

#### **Add Account** <a href="#add-account" id="add-account"></a>

This API can be used to create a sub-account under the organization account.

```
POST /es/v2/accounts
```

**Request Body:**

```
{
  "enabled": true,
  "name": "string",
  "userEmail": "string"
}
```

**Response:**

```
{
  "statusCode": 0,
  "statusMessage": "string",
  "response": {}
}
```

**Attributes:**

| Attribute | Description                                     | Possible Values                            |
| --------- | ----------------------------------------------- | ------------------------------------------ |
| enabled   | Indicates whether the account is enabled or not | `true` or `false`                          |
| name      | Name of the account                             | String (e.g., account name)                |
| userEmail | Account owner's email address                   | Email address (e.g., <example@domain.com>) |

**Sample Curl::**

```
curl --location '<host>/es/v2/accounts' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer c076dc2e-d0c2-4d4d-ab13-e4e3dd555fc0' \
--data-raw '{
  "enabled": true,
  "name": "Test Account",
  "userEmail": "test@gmail.com"
}'
```

#### **Edit Account** <a href="#edit-account" id="edit-account"></a>

This API can be used to update sub-account details under the organization.

```
PUT /es/v2/accounts/<account_id>
```

**Request Body:**

```
{
  "enabled": true,
  "name": "string"
}
```

**Response:**

```
{
  "statusCode": 0,
  "statusMessage": "string",
  "response": {}
}
```

**Attributes:**

| Attribute | Description                                     | Possible Values             |
| --------- | ----------------------------------------------- | --------------------------- |
| enabled   | Indicates whether the account is enabled or not | `true` or `false`           |
| name      | Name of the account                             | String (e.g., account name) |

**Sample Curl::**

```
curl --location --request PUT '<host>/es/v2/accounts/0e1ebe4f518d3211' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer c076dc2e-d0c2-4d4d-ab13-e4e3dd555fc0' \
--data '{
  "enabled": true,
  "name": "Test Account Updated"
}'
```

#### **Delete Account** <a href="#delete-account" id="delete-account"></a>

This API can be used to delete a sub-account under the organization.

```
DELETE /es/v2/accounts/<account_id>
```

**Request Body:**

```
NA
```

**Response:**

```
{
  "statusCode": 0,
  "statusMessage": "string",
  "response": {}
}
```

**Sample Curl::**

```
curl --location --request DELETE '<host>/es/v2/accounts/0e1ebe4f518d3211' \
--header 'Authorization: Bearer c076dc2e-d0c2-4d4d-ab13-e4e3dd555fc0'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.madconnect.ai/deployment-options/madconnect-apis/accounts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
