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

# 身份认证

> 在开始使用 Relyt AI 前，需要获取 API Key 用于身份认证

Relyt AI Open API 使用 API 密钥进行身份验证。每个 API 请求都必须包含您的 API Key。该 API Key 用于请求认证与使用配额跟踪。

Relyt AI 提供两种类型的 API Key：

* **项目 API Key**：提供访问特定项目的权限。项目 API Key 只能用于访问该项目中的资源。

* **全局 API Key**：提供管理项目的权限，例如创建一个项目。只有团队管理员才能管理项目。

  <Tip>
    与项目相关的 API 接口仍在开发中，暂时无法通过全局 API Key 进行项目管理操作。团队管理员可直接在 Relyt AI 控制台上完成相关操作。
  </Tip>

请注意，**您的 API Key 是非常重要的机密信息**。请勿与他人共享，也不要在浏览器、应用程序或其他客户端代码中暴露。

所有 API 请求必须在 `x-pd-api-key` HTTP 头中包含您的 API Key，例如：

```shell theme={null}
x-pd-api-key: API_KEY
```

***

## 发起请求

您可以将以下命令复制并粘贴到终端中，执行您的第一个 API 请求。执行请求前，请将 `$PROJECT_API_KEY` 替换为您的 API 密钥，将 `$USER_ID` 替换为您的实际用户 ID。

<CodeGroup>
  ```curl cURL theme={null}
  curl --request POST \
    --url https://app.ai.relyt.cn/app/api/v2/team/sessions \
    --header 'Content-Type: application/json' \
    --header 'x-pd-api-key: $PROJECT_API_KEY' \
    --data '{
    "name": "My session",
    "output_language": "FR",
    "job_mode": "AUTO",
    "max_contextual_job_history": 10,
    "agent_id": "DATA_ANALYSIS_AGENT",
    "user_id": "$USER_ID"
  }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://app.ai.relyt.cn/app/api/v2/team/sessions"

  payload = {
      "name": "My session",
      "output_language": "FR",
      "job_mode": "AUTO",
      "max_contextual_job_history": 10,
      "agent_id": "DATA_ANALYSIS_AGENT",
      "user_id": "tmm-dafasdfasdfasdf"
  }
  headers = {
      "x-pd-api-key": "$PROJECT_API_KEY",
      "Content-Type": "application/json"
  }

  response = requests.request("POST", url, json=payload, headers=headers)

  print(response.text)
  ```
</CodeGroup>
