> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lovi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# エラーハンドリングとレスポンスコード

> API エラーとレスポンスコードを処理するための包括的なガイド

## 導入

このガイドでは、Lovi API と統合する際に処理するすべての可能なレスポンスコード、フォーマット、エラーのベストプラクティスを説明します。

## 📊 HTTP ステータスコード

### 成功レスポンス

#### 200 OK - リクエスト成功

**通知が処理されました：**

```json theme={null}
{
  "success": true,
  "message": "通知が正常にキューに登録されました",
  "notification_id": "uuid-notification-123",
  "scheduled_time": "2024-12-25T10:30:00Z"
}
```

**テンプレートが取得されました：**

```json theme={null}
{
  "templates": [
    {
      "id": "template_001",
      "name": "welcome_user",
      "status": "approved"
    }
  ],
  "total": 1
}
```

***

### クライアントエラーレスポンス (4xx)

#### 400 Bad Request - 無効なパラメータ

**必須フィールドが欠けています：**

```json theme={null}
{
  "error": "validation_failed",
  "message": "必須フィールドが欠けています",
  "details": {
    "field": "contact.number",
    "reason": "このフィールドは必須です"
  },
  "request_id": "req_123456789"
}
```

#### 401 Unauthorized - 認証失敗

**無効なアクセスキー：**

```json theme={null}
{
  "error": "unauthorized",
  "message": "無効または期限切れのアクセスキー",
  "details": {
    "reason": "提供された access_key が無効または取り消されています"
  },
  "request_id": "req_123456793"
}
```
