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