# routers — NCM API

The core device object: one record per Cradlepoint router, carrying its name, state, model, group, firmware version and IP address. Read, update and delete, since routers are added by activation rather than created through the API. Most other endpoints filter by a router ID taken from here.

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

### GET /routers/

Get information about routers

<p>This method gives device information with associated id.</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> |
| account | query | in: int<br />out: url | no | Account that owns the routers record object |
| account__in | query | in: int<br />out: url | no | Filter for account contains - a comma-separated list of account IDs |
| group | query | in: int<br />out: url | no | Optional group this device belongs to |
| group__in | query | in: int<br />out: url | no | Filter for group contains - a comma-separated list of group IDs |
| id | query | integer | no | Routers record object ID |
| id__in | query | integer | no | Filter for ID contains - a comma-separated list of IDs |
| id__gt | query | integer | no | Filter results to items with ID greater than specified value (cursor pagination) |
| id__gte | query | integer | no | Filter results to items with ID greater than or equal to specified value |
| id__lt | query | integer | no | Filter results to items with ID less than specified value |
| id__lte | query | integer | no | Filter results to items with ID less than or equal to specified value |
| ipv4_address | query | string | no | Device's IPv4 address |
| ipv4_address__in | query | string | no | Filter for IPV4 address contains - a comma-separated list of IP addresses |
| mac | query | string | no | Device's MAC address |
| mac__in | query | string | no | Filter for MAC address contains - a comma-separated list of MAC addresses |
| name | query | string | no | Device's name (synched with device) |
| name__in | query | string | no | Filter for device name contains - a comma-separated list of device names |
| state | query | string | no | Device's state: initialized, online or offline |
| state__in | query | string | no | Filter for state contains - a comma-separated list of states |
| state_updated_at__lt | query | timestamp | no | Filter for state_updated_at is less than |
| state_updated_at__gt | query | timestamp | no | Filter for state_updated_at is greater than |
| updated_at__lt | query | timestamp | no | Filter for updated_at is less than |
| updated_at__gt | query | timestamp | no | Filter for updated_at is greater than |
| expand | query | string (account | group | last_known_location) | 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/routers/" \
  -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/<account number>/",
      "actual_firmware": "https://www.cradlepointecm.com/api/v2/firmwares/877/",
      "asset_id": null,
      "config_status": "synched",
      "configuration_manager": "https://www.cradlepointecm.com/api/v2/routers/861605/configuration_manager/",
      "created_at": "2018-04-24T21:53:32.315171+00:00",
      "custom1": null,
      "custom2": null,
      "description": "My AP Twenty Two",
      "device_type": "access_point",
      "full_product_name": "AP22",
      "group": "https://www.cradlepointecm.com/api/v2/groups/85136/",
      "id": "861605",
      "ipv4_address": "65.153.116.34",
      "last_known_location": null,
      "locality": "US/Mountain",
      "mac": "00:30:44:24:61:54",
      "name": "AP22-154",
      "product": "https://www.cradlepointecm.com/api/v2/products/48/",
      "reboot_required": false,
      "resource_url": "https://www.cradlepointecm.com/api/v2/routers/861605/",
      "serial_number": "WA1801AA001172",
      "state": "online",
      "state_updated_at": "2021-02-04T17:29:05.075116+00:00",
      "target_firmware": "https://www.cradlepointecm.com/api/v2/firmwares/877/",
      "updated_at": "2021-01-19T22:04:42.650617+00:00",
      "upgrade_pending": false
    }
  ],
  "meta": {
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null
  }
}
```

### PUT /routers/{id}/

Update an routers record

Use the PUT method on this endpoint to update an routers record. Include the fields/values to update in the 'Content' field as a JSON object.

| 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 router to update |

**Request body**

**Example request**

```bash
curl -X PUT "https://www.cradlepointecm.com/api/v2/routers/{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>/",
  "actual_firmware": "https://www.cradlepointecm.com/api/v2/firmwares/877/",
  "asset_id": null,
  "config_status": "synched",
  "configuration_manager": "https://www.cradlepointecm.com/api/v2/routers/861605/configuration_manager/",
  "created_at": "2018-04-24T21:53:32.315171+00:00",
  "custom1": null,
  "custom2": null,
  "description": "My AP Twenty Two",
  "device_type": "access_point",
  "full_product_name": "AP22",
  "group": "https://www.cradlepointecm.com/api/v2/groups/85136/",
  "id": "861605",
  "ipv4_address": "65.153.116.34",
  "last_known_location": null,
  "locality": "US/Mountain",
  "mac": "00:30:44:24:61:54",
  "name": "My AP-22",
  "product": "https://www.cradlepointecm.com/api/v2/products/48/",
  "reboot_required": false,
  "resource_url": "https://www.cradlepointecm.com/api/v2/routers/861605/",
  "serial_number": "WA1801AA001172",
  "state": "online",
  "state_updated_at": "2021-02-04T17:29:05.075116+00:00",
  "target_firmware": "https://www.cradlepointecm.com/api/v2/firmwares/877/",
  "updated_at": "2021-02-08T20:20:33.338472+00:00",
  "upgrade_pending": false
}
```

### DELETE /routers/{id}/

Delete a routers record

<p>This method deletes device information with associated id</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 router record to delete |

**Example request**

```bash
curl -X DELETE "https://www.cradlepointecm.com/api/v2/routers/{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
