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

# 创建访问令牌

> 生成 API 访问令牌以验证您对 UniUni 平台 API 的请求

要使用 UniUni 平台 API，您需要一个**访问令牌**。您可以从仪表板同时生成最多 **5 个有效令牌**。

<Warning>
  请像对待密码一样对待访问令牌。删除访问令牌将立即撤销其访问权限。
</Warning>

## 操作步骤

<Steps>
  <Step title="创建 UniUni 平台账户">
    创建您的免费 UniUni 平台账户。

    | 环境   | URL                                                                                      |
    | ---- | ---------------------------------------------------------------------------------------- |
    | 生产环境 | [ship.uniuni.com/integrations/rest-api](https://ship.uniuni.com/integrations/rest-api)   |
    | 沙盒环境 | [sandbox.unigo.ca/integrations/rest-api](https://sandbox.unigo.ca/integrations/rest-api) |
  </Step>

  <Step title="前往 REST API 集成页面">
    在 UniUni 平台网站上，前往**新建货件 > 从集成导入 > REST API**，或使用以下直接链接：
  </Step>

  <Step title="生成新令牌">
    点击**生成新令牌**。系统将显示一个令牌 ID 和一个访问令牌 — 请复制该访问令牌。
  </Step>

  <Step title="安全存储令牌">
    将令牌保存在安全的位置（例如环境变量、密钥管理器）。您可以随时返回“Rest API 集成”页面查看您的有效密钥。
  </Step>
</Steps>

<video autoPlay muted loop controls>
  <source src="https://mintcdn.com/uniexpressinc/ZRFyMCQRxIXQTdkY/videos/create-api-token.mp4?fit=max&auto=format&n=ZRFyMCQRxIXQTdkY&q=85&s=583603a16ac01a84a72954f1d8ccbf07" type="video/mp4" data-path="videos/create-api-token.mp4" />
</video>

## 使用您的令牌

在每个 API 请求的 `Authorization` 头中包含令牌：

```
Authorization: Bearer <您的访问令牌>
```

## 管理令牌

* 您最多可以同时拥有 **5 个有效令牌**。
* 要撤销令牌，请返回 REST API 集成页面并**删除**该令牌。访问权限将立即被撤销。
* 删除令牌不可撤消 — 任何使用该令牌的应用程序将失去访问权限。

<Warning>
  请像对待密码一样对待访问令牌。切勿在公共代码库、客户端代码或未加密的通信中分享令牌。
</Warning>
