# Delete Device (DELETE)

Hapus perangkat dari akun Anda. Tindakan ini tidak dapat dibatalkan.

## Endpoint

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

## Autentikasi

> **Info: Wajib**
>
> Sertakan salah satu header berikut dalam permintaan Anda:
> - `Token: <your-api-key>` — Dapatkan dari [Kunci API](https://pocketalert.app/account/apikeys)
> - `Authorization: Bearer <jwt-token>` — Dari [Masuk](https://info.pocketalert.app/api/user/login.md)

## Permintaan

### Path Parameters

| Parameter | Type | Required | Description |
|-----------|------|:--------:|-------------|
| `tid` | string | ✅ | Pengenal unik perangkat |

### Headers

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

### Contoh Permintaan

**cURL**

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

**JavaScript**

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

**Python**

```python
import requests

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

**PHP**

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

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

## Respons

### Respons Sukses

> **Tip: 200 OK**
>
> Perangkat berhasil dihapus

```json
{
  "data": "success"
}
```

### Respons Error

| Status | Description |
|:------:|-------------|
| `401` | Unauthorized — Token tidak valid atau tidak ada |
| `404` | Not Found — Perangkat tidak ditemukan |

> **Warning: Catatan**
>
> Setelah menghapus perangkat, perangkat tersebut perlu didaftarkan ulang melalui aplikasi seluler agar dapat menerima notifikasi kembali.
