# 애플리케이션 생성 (POST)

메시지를 정리하고 분류하기 위해 새 애플리케이션을 만들어요.

## 엔드포인트

```
POST https://api.pocketalert.app/v1/applications
```

## 인증

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

## 요청

### 헤더

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

### 본문 파라미터

| 파라미터 | 타입 | 필수 | 설명 |
|-----------|------|:--------:|-------------|
| `name` | string | ✅ | 애플리케이션 이름 |
| `color` | string | ❌ | 애플리케이션 색상 (16진수) |

### 요청 예시

**cURL**

```bash
curl -X POST "https://api.pocketalert.app/v1/applications" \
  -H "Token: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Monitoring",
    "color": "#FF0000"
  }'
```

**JavaScript**

```javascript
const response = await fetch('https://api.pocketalert.app/v1/applications', {
  method: 'POST',
  headers: {
    'Token': 'your-api-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Production Monitoring',
    color: '#FF0000'
  })
});

const application = await response.json();
console.log(application);
```

**Python**

```python
import requests

response = requests.post(
    'https://api.pocketalert.app/v1/applications',
    headers={
        'Token': 'your-api-key',
        'Content-Type': 'application/json'
    },
    json={'name': 'Production Monitoring', 'color': '#FF0000'}
)

print(response.json())
```

**PHP**

```php
$response = Http::withHeaders([
    'Token' => 'your-api-key',
])->post('https://api.pocketalert.app/v1/applications', [
    'name' => 'Production Monitoring',
    'color' => '#FF0000',
]);

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

## 응답

### 성공 응답

> **Tip: 201 Created**
>
> 애플리케이션이 성공적으로 생성됐어요

| 필드 | 타입 | 설명 |
|-------|------|-------------|
| `tid` | string | 애플리케이션 고유 식별자 |
| `name` | string | 애플리케이션 이름 |
| `color` | string | 애플리케이션 색상 |
| `is_active` | boolean | 애플리케이션 활성화 여부 |
| `created_at` | string | 생성 시각 |

```json
{
  "tid": "iemkz2tlbakj4lgns961ohx0o",
  "name": "Production Monitoring",
  "color": "#FF0000",
  "is_active": true,
  "created_at": "18.01.2026 15:29:02"
}
```

### 오류 응답

| 상태 | 설명 |
|:------:|-------------|
| `401` | 인증되지 않음 — 토큰이 잘못되었거나 없음 |
| `400` | 잘못된 요청 — 요청 본문이 올바르지 않음 |
