错误
错误对象
无论原因如何,每个失败都是同一种结构:
403
{
"error": {
"code": "scope_required",
"message": "This key is not allowed to perform that action.",
"details": {
"scope": "keywords:write"
}
},
"request_id": "req_d3428e686099bb0e"
}code
| 状态 | code | 含义 |
|---|---|---|
| 401 | missing_api_key | 未发送密钥 |
| 401 | invalid_api_key | 没有这个密钥;请检查拼写 |
| 401 | key_revoked | 密钥曾存在但已吊销;请联系发放密钥的人 |
| 402 | plan_limit | 达到了套餐上限。details.resource 为 targets 或 keywords,附 limit 和 current |
| 403 | scope_required | 密钥缺少某个 scope;details.scope 指明是哪个 |
| 404 | not_subscribed | 你没有监控该账号;解析失败时会附加 details.state: "failed"、details.reason 和 details.failed_at |
| 404 | user_not_found | X 上没有这个账号:从未注册、已删除或已停用 |
| 404 | user_suspended | 该账号已被 X 封禁 |
| 404 | user_protected | 该账号的帖子受保护(仅对批准的关注者可见),因此无法监控 |
| 404 | tweet_not_found | 没有这条帖子,或它已被删除 |
| 404 | not_found | 没有这个资源 |
| 409 | idempotency_key_reuse | 同一个 Idempotency-Key 已用于不同的请求 |
| 409 | conflict | 资源所处的状态不允许此更改;details.reason 说明原因 |
| 422 | invalid_request | 请求体或查询未通过校验。作为 422 时,details.fields 指出每个有问题的字段;作为 400 时,是我们能解析但不能接受的值 |
| 429 | rate_limited | 你的每分钟请求预算已用完;Retry-After 说明何时恢复 |
| 429 | quota_exhausted | 该读取触到了上游限制;Retry-After 说明何时恢复 |
| 502 | upstream | X 未按预期响应。通常是暂时的;请重试 |
| 500 | internal | 我们的问题。把 request_id 发给我们 |