Status Codes
Just Serp API 同时使用 HTTP 状态码和 JSON 响应中的业务逻辑 code 来表示 API 请求的结果。
状态码表
| Scenario | HTTP Status | Business Code | Credits Charged |
|---|---|---|---|
| Success | 200 | 200 | ✅ Yes |
| Invalid Parameters | 200 | 400 | ❌ No |
| Invalid API Key | 401 | 401 | ❌ No |
| Insufficient Credits | 200 | 402 | ❌ No |
| Resource Not Found | 200 | 404 | ❌ No |
| Rate Limit Exceeded | 200 | 429 | ❌ No |
| Internal Server Error | 500 | 500 | ❌ No |
错误处理
当发生错误时,API 会返回一个包含业务 code 和 message 的 JSON 对象,帮助您诊断问题。
错误响应示例
json
{
"code": 401,
"message": "X-API-Key is missing. Please set X-API-Key header."
}我们建议对 500 错误实现带有指数退避的重试逻辑。
