> For the complete documentation index, see [llms.txt](https://relationlabs.gitbook.io/relation-one-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://relationlabs.gitbook.io/relation-one-api/api-zh/api/auth.md).

# 登录认证

## <mark style="color:green;">POST</mark> /api/v1/auth

* 说明： 通过"addressAuthToken" 换取 “unifiedAuthToken"，unifiedAuthToken的有效期为7天。
* Header

| Field           | Type   | Remarks                                                            |
| --------------- | ------ | ------------------------------------------------------------------ |
| ApiKey          | String | 从管理员获取的[ApiKey](/relation-one-api/api-zh/guide/glossary.md#apikey) |
| I-Authorization | String | Bearer ${addressAuthToken},其中addressAuthToken通过JS-SDK请求签名认证获取      |

* Request Parameters

| Field      | Type   | Remarks            |
| ---------- | ------ | ------------------ |
| inviteCode | String | 邀请码或邀请人的relationId |

* Request Example

```shell
POST /api/v1/auth
curl  POST 'https://api.relationlabs.ai/api/v1/auth' \
--header 'I-Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJleHAiOjE2NzA4ODk0NDEsImlhdCI6MTY2MDgwOTQ0MSwiaXNzIjoicmVsYXRpb25sYWJzLmFpIiwic3ViIjoiMHgxZTU2MmFhYzRiZWFjNDUwYWI5OGQzNzlhYjBkMWQxYjQ0YzMyNWIzIi1id2FsbGV0TmFtZSI6Im1ldGFtYXNrIiwiY2hhaW5OYW1lIjoiZXRoIn0.2wFJmR2D3inHMItBugoaVE3MOSLnG1ylJEyU38WU0GgLIqajhzvcYYHC5ah3r7-FFBhbWGk9WW3KxN_h5K1zZA' \
--header 'ApiKey: <ApiKey>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "inviteCode":"d4swz-zaaaa-aaaaj-at5fa-cai"
}'
```

* Response Parameters

| Field | Type   | Remarks |
| ----- | ------ | ------- |
| code  | String | 返回码     |
| desc  | String | 返回信息    |
| data  | T      | 数据      |

The Data field consists of the following subfields:

| Field | Type   | Remarks                                                          |
| ----- | ------ | ---------------------------------------------------------------- |
| token | String | unifiedAuthToken, 其他接口的Authorization= Bearer ${unifiedAuthToken} |

* Response Example

```json
{
  "code": "0",
  "desc": "success",
  "data": {
    "token": "eyJhbGciOiJFUzI1NiJ9.eyJqdGkiOiJiOTE5N1Y1OGJmYTY0NDRlYmU2ODA1OTc2MmViNzdlZSIsImlzcyI6InJlbGF0aW9ubGFicy5haSIsImlhdCI6MTY2MDgyNDM0MSwic3ViIjoiYmFmMzQta2lhYWEtYWFhYWstYWNnamEtY2FpIiwiZXhwIjoxNjYxNDI5MTQxfQ.Y_1NR0N3NgQCzaR1owS6Ga4AbOIfvH7ucZJJ9-HUK_FrXBtG_WjTa3XNDfmHZIwCFDOzAjSHNcRdDaR0NZGUIw"
  }
}
```

* Return Code

| code | desc    | Remarks |
| ---- | ------- | ------- |
| 0    | success | 接口调用成功  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://relationlabs.gitbook.io/relation-one-api/api-zh/api/auth.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
