> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.medper.in/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.medper.in/_mcp/server.

# device - list

POST https://ext-api/v1/devices/list

Reference: https://docs.medper.in/external-v-1/device-list

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Headers

- `x-key-id` (string, optional)

## Response

### 200

OK

- `total` (integer, required)
- `devices` (list of ExtApiV1DevicesListPostResponsesContentApplicationJsonSchemaDevicesItems, required)
- `successMessage` (string, required)

## Types

### ExtApiV1DevicesListPostResponsesContentApplicationJsonSchemaDevicesItems

- `id` (string, required)
- `sync` (ExtApiV1DevicesListPostResponsesContentApplicationJsonSchemaDevicesItemsSync, required)
- `isOffline` (boolean, required)
- `patientId` (string, required)
- `hasWrongPills` (boolean, required)
- `hasMissedPills` (boolean, required)
- `lowPillQuantity` (boolean, required)
- `nextPillAt` (any, optional)
- `caregiverId` (any, optional)

### ExtApiV1DevicesListPostResponsesContentApplicationJsonSchemaDevicesItemsSync

- `status` (boolean, required)
- `syncedTime` (datetime, required)
- `updatedTime` (datetime, required)

## Examples

**Response**

```json
{
  "total": 2,
  "devices": [
    {
      "id": "100000",
      "sync": {
        "status": false,
        "syncedTime": "2025-03-16T08:08:53.632Z",
        "updatedTime": "2025-04-27T08:08:35.969Z"
      },
      "isOffline": false,
      "patientId": "PAT001",
      "hasWrongPills": false,
      "hasMissedPills": false,
      "lowPillQuantity": false
    },
    {
      "id": "100001",
      "sync": {
        "status": true,
        "syncedTime": "2024-01-15T09:30:00Z",
        "updatedTime": "2024-01-15T09:30:00Z"
      },
      "isOffline": false,
      "patientId": "PAT002",
      "hasWrongPills": false,
      "hasMissedPills": false,
      "lowPillQuantity": false
    }
  ],
  "successMessage": "Fetched device list."
}
```

**SDK Code**

```python device - list_example
import requests

url = "https://https/ext-api/v1/devices/list"

headers = {
    "x-key-id": "{{ext_key_id}}",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript device - list_example
const url = 'https://https/ext-api/v1/devices/list';
const options = {
  method: 'POST',
  headers: {'x-key-id': '{{ext_key_id}}', Authorization: 'Bearer <token>'}
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go device - list_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://https/ext-api/v1/devices/list"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("x-key-id", "{{ext_key_id}}")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby device - list_example
require 'uri'
require 'net/http'

url = URI("https://https/ext-api/v1/devices/list")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-key-id"] = '{{ext_key_id}}'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java device - list_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://https/ext-api/v1/devices/list")
  .header("x-key-id", "{{ext_key_id}}")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php device - list_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/ext-api/v1/devices/list', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'x-key-id' => '{{ext_key_id}}',
  ],
]);

echo $response->getBody();
```

```csharp device - list_example
using RestSharp;

var client = new RestClient("https://https/ext-api/v1/devices/list");
var request = new RestRequest(Method.POST);
request.AddHeader("x-key-id", "{{ext_key_id}}");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift device - list_example
import Foundation

let headers = [
  "x-key-id": "{{ext_key_id}}",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://https/ext-api/v1/devices/list")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```