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

# 权限验证

> 介绍 Reportify API 的权限校验方法

## 基础信息

Reportify API 基于 REST 原则构建。我们在每个请求中强制执行 HTTPS，以提高数据安全性、完整性和隐私性。

<Info>
  **API 基础 URL**

  ```
  https://api.reportify.cn
  ```

  该 API 不支持 HTTP，所有请求必须使用 HTTPS
</Info>

## 快速开始

<Steps>
  <Step title="获取 API Key">
    登录 [Reportify 开发者中心](https://reportify.cn/developer) 获取您的 API Key

    <Warning>
      请妥善保管您的 API Key，不要在公开场所泄露或提交到代码仓库
    </Warning>
  </Step>

  <Step title="配置认证">
    在所有 API 请求的 Header 中加入 `Authorization` 头信息

    ```
    Authorization: Bearer YOUR_API_KEY
    ```

    <Note>
      将 `YOUR_API_KEY` 替换为您在步骤 1 中获取的实际 API Key
    </Note>
  </Step>

  <Step title="发起请求">
    使用您喜欢的 HTTP 客户端发起 API 请求

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST "https://api.reportify.cn/v1/search" \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "query": "NVIDIA 财报",
          "num": 10
        }'
      ```

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

      url = "https://api.reportify.cn/v1/search"
      headers = {
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json"
      }
      data = {
          "query": "NVIDIA 财报",
          "num": 10
      }

      response = requests.post(url, headers=headers, json=data)
      result = response.json()
      ```

      ```javascript JavaScript theme={null}
      const url = 'https://api.reportify.cn/v1/search';
      const headers = {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      };
      const body = JSON.stringify({
        query: 'NVIDIA 财报',
        num: 10
      });

      const response = await fetch(url, {
        method: 'POST',
        headers: headers,
        body: body
      });
      const result = await response.json();
      ```

      ```typescript TypeScript theme={null}
      interface SearchRequest {
        query: string;
        num?: number;
      }

      const url = 'https://api.reportify.cn/v1/search';
      const headers = {
        'Authorization': 'Bearer YOUR_API_KEY',
        'Content-Type': 'application/json'
      };
      const body: SearchRequest = {
        query: 'NVIDIA 财报',
        num: 10
      };

      const response = await fetch(url, {
        method: 'POST',
        headers: headers,
        body: JSON.stringify(body)
      });
      const result = await response.json();
      ```
    </CodeGroup>
  </Step>
</Steps>

## 认证说明

<Tip>
  **Bearer Token 格式**

  * Token 类型为 `Bearer`（注意大小写）
  * `Bearer` 和 API Key 之间有一个空格
  * 完整格式：`Authorization: Bearer YOUR_API_KEY`
</Tip>
