获取 AI 聚合平台 API 详情

通过 API ID 获取单个 API 端点的完整信息——比列表接口多出 definition(OpenAPI 3.0 Schema)、service(所属服务详情)和 products(关联产品)字段。

适用于自动生成 SDK、给 LLM Agent 喂工具描述、文档站点动态渲染等场景。

ℹ️ 本接口属于 AI 聚合平台管理 API,统一前缀 https://yxai-tech.platform.acedata.cloud/api/v1/。完整接口索引见获取 AI 聚合平台文档列表。

接口概览

项 内容
方法 GET
URL https://yxai-tech.platform.acedata.cloud/api/v1/apis/{api_id}
鉴权 ❌ 公开

/apis/{id} 与 /apis/{id}/ 当前都可用;示例统一使用无尾斜杠形式。

鉴权说明

本接口完全公开,无需账户令牌或登录态。

路径参数

参数 类型 必填 说明
api_id UUID ✅ API ID(UUID 格式,不支持别名)

请求示例

cURL

curl 'https://yxai-tech.platform.acedata.cloud/api/v1/apis/afc7917f-d89f-4dc9-95c2-863936b02cad' \
  -H 'accept: application/json'

Python

import requests

api_id = "afc7917f-d89f-4dc9-95c2-863936b02cad"
resp = requests.get(
    f"https://yxai-tech.platform.acedata.cloud/api/v1/apis/{api_id}",
    headers={"accept": "application/json"},
    timeout=10,
)
api = resp.json()
print(f"API: {api['title']}")
print(f"路径: {api['path']}")
print(f"所属服务: {api['service']['title']} ({api['service']['alias']})")
print(f"OpenAPI 路径数: {len(api.get('definition', {}).get('paths', {}))}")

Node.js

const apiId = 'afc7917f-d89f-4dc9-95c2-863936b02cad'
const r = await fetch(`https://yxai-tech.platform.acedata.cloud/api/v1/apis/${apiId}`)
const api = await r.json()
console.log(api.title, api.path, api.service.title)

响应示例(HTTP 200)

{
  "id": "afc7917f-d89f-4dc9-95c2-863936b02cad",
  "document_id": "e31b3e50-d91d-4a4f-8d32-8dd8c9e2f512",
  "service_id": "5d732942-4d44-48be-958e-dd8474d8aa8d",
  "name": "ChatDoc Documents API",
  "title": "ChatDoc Documents API",
  "path": "/chatdoc/documents",
  "path2": null,
  "introduction": "在创建知识存储库之后,可以使用该API在知识存储库中添加、查询、修改或删除文档。",
  "cost": [
    { "conditions": { "==": [1, 1] }, "consumption": 0.057 }
  ],
  "stage": "Beta",
  "rank": 10,
  "tags": [],
  "metadata": null,
  "created_at": "2023-09-03T17:55:48.179195Z",
  "updated_at": "2026-04-26T16:16:35.579082Z",
  "service": {
    "id": "5d732942-4d44-48be-958e-dd8474d8aa8d",
    "title": "ChatDoc 问答",
    "type": "Api",
    "alias": "chatdoc"
  },
  "products": [],
  "definition": {
    "openapi": "3.0.0",
    "info": { "title": "ChatDoc Documents API", "version": "0.1" },
    "paths": {
      "/chatdoc/documents": {
        "post": { "...": "..." }
      }
    },
    "components": { "schemas": { "...": "..." } }
  }
}

响应字段说明

详情接口在列表接口字段之上额外包含:

字段 类型 说明
service object 所属服务的核心信息:id、title、type、alias
products array 关联产品列表(通常为空,给运营侧使用)
definition object 完整的 OpenAPI 3.0 规范定义,包含 paths、components、info 等,可直接喂给 openapi-generator 生成客户端代码

错误处理

HTTP code 含义
400 invalid api_id 不是合法 UUID
404 not_found API 不存在或已下线

实用提示

  • definition 字段非常大:单个 API 的 OpenAPI Schema 可能有数百行 JSON。如果只是要做服务索引、不需要 Schema,应该用列表接口代替。

  • 生成 SDK 的常见用法:

    # 拿到 OpenAPI 文件
    curl -s 'https://yxai-tech.platform.acedata.cloud/api/v1/apis/<api_id>' | jq '.definition' > openapi.json
    
    # 用 openapi-generator-cli 生成 Python 客户端
    openapi-generator-cli generate -i openapi.json -g python -o ./client
    
  • 跟踪 API 变更:updated_at 字段是 schema 上次变更的时间。订阅这个字段可在 OpenAPI 改动时自动重新生成 SDK。

相关接口