API简介

智优引擎GEO API提供RESTful接口,支持内容分析、优化建议、数据查询等功能。

基础URL:https://api.zhiyou-engine.com/api/v1

数据格式:JSON

字符编码:UTF-8

认证方式

使用API Key进行认证,在请求头中添加:

Authorization: Bearer YOUR_API_KEY

主要端点

1. 内容分析

POST /analyze
{
  "content": "文章内容...",
  "target_ai": ["chatgpt", "claude"]
}

2. 品牌监控

GET /monitor/{brand_name}
// 返回品牌在AI引擎中的表现数据

3. 批量优化

POST /optimize
{
  "articles": [...],
  "options": {...}
}

代码示例

Python

import requests

headers = {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
}

data = {
    'content': '您的文章内容...',
    'target_ai': ['chatgpt']
}

response = requests.post(
    'https://api.zhiyou-engine.com/api/v1/analyze',
    headers=headers,
    json=data
)

print(response.json())

JavaScript

fetch('https://api.zhiyou-engine.com/api/v1/analyze', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    content: '您的文章内容...',
    target_ai: ['chatgpt']
  })
})
.then(response => response.json())
.then(data => console.log(data));

错误码

错误码 说明
400 请求参数错误
401 认证失败
429 超过速率限制
500 服务器内部错误