Skip to main content

API 认证

每个 API 请求都需要使用 API 密钥在 HTTP 头中进行认证。

获取您的 API 密钥

要获取您的 API 密钥,请联系我们[email protected]

使用您的 API 密钥

要使用您的 API 密钥,您需要将Authorization头设置为您的 API 密钥的值。
Authorization: Bearer YOUR_API_KEY
示例请求:

Curl

curl -X GET "https://api.hellokaton.com/v1/users" \
  -H "Authorization: Bearer YOUR_API_KEY"

Python

import requests

url = 'https://api.hellokaton.com/v1/users'
headers = {'Authorization': 'Bearer YOUR_API_KEY'}
response = requests.get(url, headers=headers)
print(response.json())

JavaScript

const response = await fetch("https://api.hellokaton.com/v1/users", {
  headers: {
    Authorization: "Bearer YOUR_API_KEY",
  },
});

Java

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
    .url("https://api.hellokaton.com/v1/users")
    .addHeader("Authorization", "Bearer YOUR_API_KEY")
    .build();

try (Response response = client.newCall(request).execute()) {
    System.out.println(response.body().string());
} catch (Exception e) {
    e.printStackTrace();
}