# Gerät abrufen (GET)

Ruft die Details eines bestimmten Geräts anhand seiner eindeutigen Kennung ab.

## Endpunkt

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

## Authentifizierung

> **Info: Erforderlich**
>
> Füge einen dieser Header in deine Anfrage ein:
> - `Token: <your-api-key>` — Hol ihn dir unter [API-Schlüssel](https://pocketalert.app/account/apikeys)
> - `Authorization: Bearer <jwt-token>` — Aus [Anmeldung](https://info.pocketalert.app/api/user/login.md)

## Anfrage

### Pfadparameter

| Parameter | Typ | Erforderlich | Beschreibung |
|-----------|-----|:------------:|--------------|
| `tid` | string | ✅ | Eindeutige Kennung des Geräts |

### Header

| Header | Erforderlich | Beschreibung |
|--------|:------------:|--------------|
| `Token` | ✅ | Dein API-Schlüssel |
| `Authorization` | ✅ | `Bearer <jwt-token>` |

### Beispielanfrage

**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();
```

## Antwort

### Erfolgreiche Antwort

> **Tip: 200 OK**
>
> Gibt das Geräteobjekt zurück

| Feld | Typ | Beschreibung |
|------|-----|--------------|
| `tid` | string | Eindeutige Kennung des Geräts |
| `name` | string | Gerätename |
| `serial_number` | string | Seriennummer des Geräts |
| `is_active` | boolean | Ob das Gerät aktiv ist |
| `created_at` | string | Zeitstempel der Registrierung |

```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"
}
```

### Fehlerantworten

| Status | Beschreibung |
|:------:|--------------|
| `401` | Nicht autorisiert — Ungültiger oder fehlender Token |
| `404` | Nicht gefunden — Gerät existiert nicht |
