# 모든 메시지 조회 (GET)

계정의 모든 메시지 목록을 조회합니다.

## 엔드포인트

```
GET https://api.pocketalert.app/v1/messages
```

## 인증

> **Info: 필수**
>
> 요청에 다음 헤더 중 하나를 포함하세요:
> - `Token: <your-api-key>` — [API 키](https://pocketalert.app/account/apikeys)에서 발급받으세요
> - `Authorization: Bearer <jwt-token>` — [로그인](https://info.pocketalert.app/api/user/login.md)으로 발급받으세요

## 요청

### 헤더

| 헤더 | 필수 | 설명 |
|--------|:--------:|-------------|
| `Token` | ✅ | API 키 |
| `Authorization` | ✅ | `Bearer <jwt-token>` |

### 쿼리 파라미터

| 파라미터 | 타입 | 기본값 | 설명 |
|-----------|------|:-------:|-------------|
| `sort` | string | `desc` | 생성 시간 기준 정렬 순서 (`asc` 또는 `desc`) |
| `limit` | integer | `50` | 반환할 메시지의 최대 개수 |

### 요청 예시

**cURL**

```bash
curl -X GET "https://api.pocketalert.app/v1/messages?sort=desc&limit=10" \
  -H "Token: your-api-key"
```

**JavaScript**

```javascript
const response = await fetch('https://api.pocketalert.app/v1/messages?sort=desc&limit=10', {
  headers: { 'Token': 'your-api-key' }
});
const messages = await response.json();
```

**Python**

```python
import requests

response = requests.get(
    'https://api.pocketalert.app/v1/messages',
    headers={'Token': 'your-api-key'},
    params={'sort': 'desc', 'limit': 10}
)
print(response.json())
```

**PHP**

```php
$response = Http::withHeaders([
    'Token' => 'your-api-key',
])->get('https://api.pocketalert.app/v1/messages', [
    'sort' => 'desc',
    'limit' => 10,
]);

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

## 응답

### 성공 응답

> **Tip: 200 OK**
>
> 메시지 객체의 배열을 반환합니다

| 필드 | 타입 | 설명 |
|-------|------|-------------|
| `tid` | string | 메시지의 고유 식별자 |
| `title` | string | 메시지 제목 |
| `message` | string | 메시지 본문 |
| `application` | string | 애플리케이션 이름 |
| `device` | string | 대상 기기 |
| `is_read` | boolean | 메시지 읽음 여부 |
| `created_at` | string | 생성 시각 |

```json
[
  {
    "tid": "jb4xw9elz24c5",
    "title": "Server Alert",
    "message": "CPU usage exceeded 90%",
    "application": "Monitoring",
    "device": "iPhone",
    "is_read": true,
    "created_at": "18.09.2023 17:35:35"
  },
  {
    "tid": "d4u21qej1hld",
    "title": "Deploy Complete",
    "message": "Version 2.1.0 deployed",
    "application": "CI/CD",
    "device": "iPhone",
    "is_read": false,
    "created_at": "18.09.2023 17:35:23"
  }
]
```

### 오류 응답

| 상태 | 설명 |
|:------:|-------------|
| `401` | 인증 실패 — 토큰이 잘못되었거나 누락됨 |
