---
title: "错误"
description: "错误响应体、每个状态和代码及其消息，以及哪些失败应当重试。"
canonical: https://dino.markets/zh/docs/errors/
---

> Index of every dino.markets page and doc for AI readers: [llms.txt](https://dino.markets/llms.txt)

# 错误

错误响应体、每个状态和代码及其消息，以及哪些失败应当重试。

## 错误响应体

每个错误都有同样的三个字段。

```
curl -s -G "https://api.dino.markets/v2/odds" \
  -d league=nba -d limit=0 \
  -H "Authorization: Bearer $DINO_API_KEY"
```

400 Bad Request

```
{
  "error": "invalid_request",
  "message": "limit must be an integer from 1 to 100; the default is 25.",
  "request_id": "req_d2fc23deaa31bd58aff76f3c"
}
```

`error`是用于分支处理的稳定代码。`message`是给人看的，可能会变。`request_id`也在`X-Request-Id`响应头中；联系客服时请附上它。错误不扣积分。

## 错误代码

| 状态 | `error` | 触发情况 | 是否重试 |
| --- | --- | --- | --- |
| 400 | `invalid_request` | 参数缺失、未知或超出范围 | 否，请修正请求 |
| 401 | `unauthorized` | 密钥缺失、错误或已停用 | 否 |
| 404 | `not_found` | 没有这个接口，或没有这个id的比赛 | 否 |
| 405 | `method_not_allowed` | 方法不是`GET` | 否 |
| 429 | `rate_limited` | 请求过多 | 是，在`Retry-After`之后 |
| 429 | `quota_exceeded` | 密钥剩余积分少于本次调用费用 | 积分续期或套餐变更之后 |
| 500 | `internal_error` | 我们这边的故障 | 是 |
| 503 | `unavailable` | 服务正在启动，账户功能短暂不可用，或同时在处理的大请求太多 | 是，在`Retry-After`之后 |

检查按以下顺序进行：服务是否就绪、方法、接口、密钥、参数、比赛，最后是积分。

## 参数错误

| `message`开头 | 原因 |
| --- | --- |
| `league is required unless event_ids is given.` | 两者都没有发送 |
| `Unknown league value "xx".` | 消息后面会列出有效的联赛 |
| `Unknown markets value "foo".`或`markets is empty.` | 后面列出有效的盘口 |
| `Unknown period value "h3".` | 后面列出有效的时段 |
| `alternates is not valid: "yes".` | 请发送`true`或`false` |
| `Unknown books value "zz".` | 后面列出有效的博彩公司 |
| `Unknown region value "zz".` | 后面列出有效的地区 |
| `Unknown status value "done".` | 后面列出有效的状态：`scheduled`、`live`、`finished`、`all` |
| `start_after is not valid: "...".`或`start_before is not valid: "...".` | 该值不是RFC 3339时间。请发送`2026-11-30T00:00:00Z`这样的值，`+`偏移要写成`%2B`。 |
| `limit must be an integer from 1 to 100` | `limit`超出范围 |
| `cursor is not valid.` | 请原样发送`next_cursor` |
| `Event id "abc" is not valid; ids are 32 characters.` | `event_ids`中有错误的值 |
| `Event id must be 32 characters.` | 单场比赛接口收到错误的id |
| `event_ids takes at most 100 ids.` | id过多 |

## 密钥缺失或错误

```
curl -s "https://api.dino.markets/v2/odds?league=nba"
```

401 Unauthorized

```
 or in the x-api-key header; the apiKey query parameter is not accepted on /v2.",
  "request_id": "req_d3d432806099cab5a336380e"
}">{
  "error": "unauthorized",
  "message": "API key is missing. Send it as Authorization: Bearer <key> or in the x-api-key header; the apiKey query parameter is not accepted on /v2.",
  "request_id": "req_d3d432806099cab5a336380e"
}
```

| `message` | 原因 |
| --- | --- |
| `API key is missing. Send it as ...` | 没有密钥，或密钥放在了URL中 |
| `API key is invalid or not tied to a subscription.` | 密钥错误 |
| `API key has been deactivated.` | 密钥已撤销 |

## 未找到

未知接口：

```
curl -s "https://api.dino.markets/v2/nothing" \
  -H "Authorization: Bearer $DINO_API_KEY"
```

404 Not Found

```
{
  "error": "not_found",
  "message": "No such route.",
  "request_id": "req_1b9452db27085ca9a02a0977"
}
```

开赛已超过72小时的已结束比赛，或我们从未有过的id：

```
curl -s "https://api.dino.markets/v2/events/00000000000000000000000000000000/odds" \
  -H "Authorization: Bearer $DINO_API_KEY"
```

404 Not Found

```
{
  "error": "not_found",
  "message": "Event not found. It may have concluded; get current ids from /v2/events.",
  "request_id": "req_50075f7ad136112fd6ed700e"
}
```

## 方法错误

只支持`GET`。`Allow`响应头会说明这一点。

```
curl -s -D - -X POST "https://api.dino.markets/v2/leagues" \
  -H "Authorization: Bearer $DINO_API_KEY"
```

405 Method Not Allowed

```
allow: GET
cache-control: no-store
content-type: application/json; charset=utf-8
x-request-id: req_c04acfc031018c7809b5593d

{
  "error": "method_not_allowed",
  "message": "Only GET is supported.",
  "request_id": "req_c04acfc031018c7809b5593d"
}
```

## 限制和服务器故障

| 状态 | `message` | 响应头 |
| --- | --- | --- |
| 429 | `Rate limited. Space requests out over several seconds and try again.` | `Retry-After: 1` |
| 429 | `This call costs 1 credit and the key has 0 left. ...` |  |
| 429 | `Usage quota has been reached. Upgrade the plan or wait for the quota to reset.` |  |
| 500 | `Something went wrong on our side. Try again in a moment.` |  |
| 503 | `The service is starting up. Try again in a few seconds.` | `Retry-After: 10` |
| 503 | `Accounts are unavailable. Try again in a few seconds.` | `Retry-After: 5` |
| 503 | `Too many large requests are being answered right now. Try again in a few seconds, or ask for less: fewer markets, no alternates, one period.` | `Retry-After: 2` |

最后一个503出现在`/v2/odds`的调用请求了`alternates=true`、`game`以外的`period`或球员盘口时。每台服务器同时只构建三个这样的请求，同一时刻的第四个会被拒绝，且不扣积分。等待之后重试，或者少请求一些盘口、只请求一个时段。

## 重试

对`429 rate_limited`、`500`和`503`重试时，使用逐步增长、带随机抖动的等待时间，并限制尝试次数；如果返回了`Retry-After`，至少等待那么久。`400`、`401`、`404`和`405`要先修正问题。不要重试`quota_exceeded`。重试成功会再次扣积分；如果响应丢失，第一次调用可能已经计费。
