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

# 快速入门 - 从 API 密钥到下单

> 通过五次调用完成：检查密钥、读取投注单、预览订单、下单并读回订单。

请将 `apx_live_…` 替换为您的密钥。在测试环境中，请使用为您提供的基础 URL 和密钥。

## 1. 获取密钥

您的代理会在您的账户上启用 API 访问权限。然后，您在仪表板的 **Preferences → API** 下创建密钥。密钥只显示一次：请将其保存在密钥管理器中。参见[认证](https://docs.apexiumbet.com/zh/api-reference/authentication.md)。

## 2. 检查密钥

```bash theme={null}
curl https://api.apexiumbet.com/v1/me \
  -H "x-api-key: apx_live_…"
```

响应会给出账户、其状态、当前使用的密钥，以及您可以下单的博彩公司。

## 3. 读取投注单

投注单给出应用您账户规则之后您可以下单的价格，以及您的投注额限额。请查询一个选项：

```bash theme={null}
curl "https://api.apexiumbet.com/v1/betslip?fixtureId=id1000001761300868&outcomeId=101" \
  -H "x-api-key: apx_live_…"
```

每家博彩公司都会返回 `active`、其价格及其投注额限额。赛事和选项的标识符来自[行情数据](https://docs.apexiumbet.com/zh/api-reference/overview.md#行情数据)端点。其中的赔率可能与投注单价格不同：参见[行情赔率与投注单](https://docs.apexiumbet.com/zh/guides/feed-odds-and-betslip.md)。

## 4. 预览订单

预览会应用所有规则和限额，然后告诉您现在将下达的内容。它不会存储任何数据。

```bash theme={null}
curl https://api.apexiumbet.com/v1/orders \
  -H "x-api-key: apx_live_…" \
  -H "content-type: application/json" \
  -d '{
    "mode": "preview",
    "clientOrderId": "my-order-0001",
    "fixtureId": "id1000001761300868",
    "outcomeId": 101,
    "side": "back",
    "stake": { "amount": "50.00", "currency": "USD" },
    "minPrice": "1.90",
    "acceptBetterOdds": true,
    "acceptPartialStake": true
  }'
```

响应中 `status: "PREVIEW"`，且投注额将分配到的每家博彩公司在 `bets` 中各有一条记录。

## 5. 下单

使用 `"mode": "place"` 发送相同的请求体。新订单返回 `201 Created`：

```json theme={null}
{
  "id": "4f0c2b1e-8d4a-4f7e-9a51-2c1f0b7e9d10",
  "clientOrderId": "my-order-0001",
  "status": "FILLED",
  "requestedStake": { "amount": "50.00", "amountCents": 5000, "currency": "USD" },
  "filledStake": { "amount": "50.00", "amountCents": 5000, "currency": "USD" },
  "averageFilledPrice": "1.92",
  "bets": [ { "bookmaker": "sharpbet", "status": "PLACED", "filledPrice": "1.92" } ],
  "version": 2
}
```

示例已作简化。如果在您读取响应之前连接中断，请再次发送相同的请求：`clientOrderId` 会使其返回同一个订单，而不是下第二个订单。参见[幂等性](https://docs.apexiumbet.com/zh/guides/idempotency.md)。

## 6. 读回订单

```bash theme={null}
curl https://api.apexiumbet.com/v1/orders/by-client-id/my-order-0001 \
  -H "x-api-key: apx_live_…"
```

订单或其任一注单每发生一次变更，`version` 就加一：通过比较它即可知道是否有变化。参见[订单与注单生命周期](https://docs.apexiumbet.com/zh/guides/order-lifecycle.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.