# Get Device (GET)

Retrieve details of a specific device by its unique identifier.

## Endpoint

```
GET https://api.pocketalert.app/v1/devices/{tid}
```

## Authentication

> **Info: Required**
>
> Include one of these headers in your request:
> - `Token: <your-api-key>` — Get it from [API Keys](https://pocketalert.app/account/apikeys)
> - `Authorization: Bearer <jwt-token>` — From [Login](https://info.pocketalert.app/api/user/login.md)

## Request

### Path Parameters

| Parameter | Type | Required | Description |
|-----------|------|:--------:|-------------|
| `tid` | string | ✅ | Device unique identifier |

### Headers

| Header | Required | Description |
|--------|:--------:|-------------|
| `Token` | ✅ | Your API key |
| `Authorization` | ✅ | `Bearer <jwt-token>` |

### Example Request

**cURL**

```bash
curl -X GET "https://api.pocketalert.app/v1/devices/9dc24hqldvv2bfx2nlc6r" \
  -H "Token: your-api-key"
```

**JavaScript**

```javascript
const tid = '9dc24hqldvv2bfx2nlc6r';
const response = await fetch(`https://api.pocketalert.app/v1/devices/${tid}`, {
  headers: { 'Token': 'your-api-key' }
});
const device = await response.json();
```

**Python**

```python
import requests

tid = '9dc24hqldvv2bfx2nlc6r'
response = requests.get(
    f'https://api.pocketalert.app/v1/devices/{tid}',
    headers={'Token': 'your-api-key'}
)
print(response.json())
```

**PHP**

```php
$tid = '9dc24hqldvv2bfx2nlc6r';
$response = Http::withHeaders([
    'Token' => 'your-api-key',
])->get('https://api.pocketalert.app/v1/devices/'.$tid);

return $response->json();
```

## Response

### Success Response

> **Tip: 200 OK**
>
> Returns the device object

| Field | Type | Description |
|-------|------|-------------|
| `tid` | string | Unique device identifier |
| `name` | string | Device name |
| `serial_number` | string | Device serial number |
| `is_active` | boolean | Whether the device is active |
| `created_at` | string | Registration timestamp |

```json
{
  "tid": "9dc24hqldvv2bfx2nlc6r",
  "name": "iPhone 15 Pro",
  "serial_number": "123456-OK91-KLAI-8K91-32A0AKSA28X2",
  "is_active": true,
  "created_at": "12.06.2023 02:48:49"
}
```

### Error Responses

| Status | Description |
|:------:|-------------|
| `401` | Unauthorized — Invalid or missing token |
| `404` | Not Found — Device does not exist |
