# accounts — NCM API

An account is a collection of sub-accounts that can hold devices, groups, users and further sub-accounts, which is how multi-tenant hierarchies are built. Full lifecycle: list, create, update and delete accounts. Most other endpoints scope their results to an account, so this is where the hierarchy is defined.

Base URL: https://www.cradlepointecm.com/api/v2

### GET /accounts/

Get information about accounts

<p>Make GET requests to return a list of your accounts and information about them.</p><p>This endpoint can be called without parameters to retrieve all of your accounts/subaccounts, or filtered by a specific account number, ID, or name. These filters also support lists of account numbers, record IDs, or names using the __in filter. When using the __in filter, supply a list of comma-separated values to return only the products with attributes matching those values.</p><p>Example URL</p><pre> https://www.cradlepointecm.com/api/v2/accounts/?id=1127&name=cradlepoint</pre>

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| X-ECM-API-ID | header | string | yes | <strong>ECM API app Id</strong> |
| X-ECM-API-KEY | header | string | yes | <strong>ECM API app key</strong> |
| X-CP-API-ID | header | string | yes | <strong>Cradlepoint API app Id</strong> |
| X-CP-API-KEY | header | string | yes | <strong>Cradlepoint API access key</strong> |
| account | query | in: int<br />out: url | no | Parent account of an account/subaccount |
| account__in | query | in: int<br />out: url | no | Filter for account contains - a comma-separated list of account IDs |
| id | query | integer | no | Object ID of an accounts record |
| id__in | query | integer | no | Filter for ID contains - a comma-separated list of account record IDs |
| name | query | string | no | Name of the account |
| name__in | query | string | no | Filter for name contains - a comma-separated list of account names. |
| expand | query | string (account) | no | Specifies that the returned value for the passed in attribute be expanded in the response body. |
| limit | query | integer | no | Restricts the number of records returned in a recordset to this value. Max value is 500. |
| offset | query | integer | no | Specifies where (an index) in a recordset to begin returning records. |

**Example request**

```bash
curl "https://www.cradlepointecm.com/api/v2/accounts/" \
  -H "X-CP-API-ID: <cp-api-id>" \
  -H "X-CP-API-KEY: <cp-api-key>" \
  -H "X-ECM-API-ID: <ecm-api-id>" \
  -H "X-ECM-API-KEY: <ecm-api-key>"
```

**Response 200** — Example response.

```json
{
  "data": [
    {
      "account": "https://www.cradlepointecm.com/api/v2/accounts/308/",
      "id": "241",
      "is_disabled": false,
      "name": "cradlepoint",
      "resource_url": "https://www.cradlepointecm.com/api/v2/accounts/241/"
    },
    {
      "account": "https://www.cradlepointecm.com/api/v2/accounts/123/",
      "id": "308",
      "is_disabled": false,
      "name": "root",
      "resource_url": "https://www.cradlepointecm.com/api/v2/accounts/308/"
    },
    {}
  ],
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null
  }
}
```

### POST /accounts/

Create an accounts record

POST operations to the accounts endpoint creates new sub-accounts.

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| X-ECM-API-ID | header | string | yes | <strong>ECM API app Id</strong> |
| X-ECM-API-KEY | header | string | yes | <strong>ECM API app key</strong> |
| X-CP-API-ID | header | string | yes | <strong>Cradlepoint API app Id</strong> |
| X-CP-API-KEY | header | string | yes | <strong>Cradlepoint API access key</strong> |

**Request body**

**Example request**

```bash
curl -X POST "https://www.cradlepointecm.com/api/v2/accounts/" \
  -H "X-CP-API-ID: <cp-api-id>" \
  -H "X-CP-API-KEY: <cp-api-key>" \
  -H "X-ECM-API-ID: <ecm-api-id>" \
  -H "X-ECM-API-KEY: <ecm-api-key>" \
  -H "Content-Type: application/json" \
  -d '{ ... }'
```

**Response 200** — Example response.

```json
{
  "account": "https://www.cradlepointecm.com/api/v2/accounts/308/",
  "is_disabled": false,
  "name": "Nested_Subaccount",
  "id": "84954",
  "resource_url": "https://www.cradlepointecm.com/api/v2/accounts/"
}
```

### PUT /accounts/{id}/

Update an accounts record

<p>This operation updates an account.</p>

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| X-ECM-API-ID | header | string | yes | <strong>ECM API app Id</strong> |
| X-ECM-API-KEY | header | string | yes | <strong>ECM API app key</strong> |
| X-CP-API-ID | header | string | yes | <strong>Cradlepoint API app Id</strong> |
| X-CP-API-KEY | header | string | yes | <strong>Cradlepoint API access key</strong> |
| id | path | integer | yes | The ID of the account to PUT |

**Request body**

**Example request**

```bash
curl -X PUT "https://www.cradlepointecm.com/api/v2/accounts/{id}/" \
  -H "X-CP-API-ID: <cp-api-id>" \
  -H "X-CP-API-KEY: <cp-api-key>" \
  -H "X-ECM-API-ID: <ecm-api-id>" \
  -H "X-ECM-API-KEY: <ecm-api-key>" \
  -H "Content-Type: application/json" \
  -d '{ ... }'
```

**Response 200** — Example response.

```json
{
  "account": "https://www.cradlepointecm.com/api/v2/accounts/<account number>/",
  "id": "<id>",
  "is_disabled": false,
  "name": "New Subaccount Name",
  "resource_url": "https://www.cradlepointecm.com/api/v2/accounts/<id>/"
}
```

### DELETE /accounts/{id}/

Delete an accounts record

<p>This operation deletes an account.</p>

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| X-ECM-API-ID | header | string | yes | <strong>ECM API app Id</strong> |
| X-ECM-API-KEY | header | string | yes | <strong>ECM API app key</strong> |
| X-CP-API-ID | header | string | yes | <strong>Cradlepoint API app Id</strong> |
| X-CP-API-KEY | header | string | yes | <strong>Cradlepoint API access key</strong> |
| id | path | integer | yes | ID of the accounts record to delete |

**Example request**

```bash
curl -X DELETE "https://www.cradlepointecm.com/api/v2/accounts/{id}/" \
  -H "X-CP-API-ID: <cp-api-id>" \
  -H "X-CP-API-KEY: <cp-api-key>" \
  -H "X-ECM-API-ID: <ecm-api-id>" \
  -H "X-ECM-API-KEY: <ecm-api-key>"
```

**Response 200** — No response was specified
