REST API
ESG Hub API提供简单的HTTP JSON端点来搜索和检索ESG内容。
入门
API完全开放,无需任何认证。
基础URLAll API requests should be made to:
https://esg-hub.ascent.partners/api/v1快速开始
- Choose an endpoint below (e.g.,
/api/v1/pagesfor articles) - Make a request using cURL, JavaScript, or Python
- Parse the JSON response for the data you need
代码示例
curl -s "https://esg-hub.ascent.partners/api/v1/pages?limit=3" | jq .认证
无需认证API完全开放,无需任何认证。
端点
GET
/api/v1/metaGet metadata about the ESG Hub knowledge base, including article counts, section statistics, and database timestamps.
请求示例
curlbash
curl -s "https://esg-hub.ascent.partners/api/v1/meta"响应
json
{
"total_pages": 351,
"total_resources": 244,
"sections": [
{ "name": "environmental", "count": 23 },
{ "name": "governance", "count": 65 }
],
"updated_at": "2026-02-24T12:00:00Z"
}GET
/api/v1/pagesList all ESG articles with optional filtering. Supports filtering by section, pillar, and full-text search.
参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| section | string | 可选 | Filter by section (e.g., 'environmental', 'governance') |
| pillar | string | 可选 | Filter by pillar: 'Environmental', 'Social', or 'Governance' |
| q | string | 可选 | Full-text search in title and description |
| limit | number | 可选 | Results per page (default: 20, max: 100) |
| offset | number | 可选 | Pagination offset |
请求示例
curlbash
# List all pages
curl -s "https://esg-hub.ascent.partners/api/v1/pages?limit=5"
# Filter by section
curl -s "https://esg-hub.ascent.partners/api/v1/pages?section=environmental&limit=10"
# Search for climate
curl -s "https://esg-hub.ascent.partners/api/v1/pages?q=climate&limit=5"响应
json
{
"data": [
{
"id": "page:abc123",
"title": "Climate Change",
"description": "Understanding climate risks...",
"section": "environmental",
"pillar": "Environmental",
"permalink": "/environmental/climate-change/"
}
],
"pagination": {
"total": 351,
"limit": 5,
"offset": 0,
"has_more": true
}
}GET
/api/v1/pages/:idGet a single page by its ID. Returns full content including markdown and metadata.
请求示例
curlbash
curl -s "https://esg-hub.ascent.partners/api/v1/pages/page:abc123"响应
json
{
"id": "page:abc123",
"title": "Climate Change",
"content": "# Climate Change\n\nClimate change refers to...",
"keywords": "climate, carbon, emissions",
"created_at": "2024-01-15T10:30:00Z"
}GET
/api/v1/resourcesList curated external ESG resources. These are links to external articles, reports, and tools.
参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| type | string | 可选 | Filter by type: 'article', 'report', 'tool', 'dataset' |
| q | string | 可选 | Search in title and description |
| limit | number | 可选 | Results per page (default: 20) |
请求示例
curlbash
# List all resources
curl -s "https://esg-hub.ascent.partners/api/v1/resources?limit=5"
# Filter by type
curl -s "https://esg-hub.ascent.partners/api/v1/resources?type=report&limit=10"响应
json
{
"data": [
{
"id": "resource:xyz789",
"title": "TCFD Recommendations",
"url": "https://assets.bbhub.io/...",
"type": "report",
"source": "TCFD"
}
],
"pagination": { "total": 244, "limit": 5, "offset": 0 }
}GET
/api/v1/searchFull-text keyword search across all pages and resources. Use this for simple search queries.
参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| q | string | 必填 | Search query (required) |
| limit | number | 可选 | Results to return (default: 10) |
| source | string | 可选 | Filter: 'all', 'pages', or 'resources' |
请求示例
curlbash
curl -s "https://esg-hub.ascent.partners/api/v1/search?q=carbon+emissions&limit=5"响应
json
{
"query": "carbon emissions",
"mode": "keyword",
"data": [
{ "title": "Carbon Emissions", "permalink": "/environmental/carbon-emissions/", "score": 0.95 }
],
"total": 12
}POST
/api/v1/searchSemantic vector search using pre-computed embeddings. Send a 384-dimensional embedding vector to find conceptually related content.
参数
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
| embedding | number[384] | 必填 | 384-dimensional embedding vector |
| k | number | 可选 | Number of results (default: 10, max: 50) |
| source | string | 可选 | Filter: 'all', 'pages', or 'resources' |
请求示例
curlbash
curl -X POST "https://esg-hub.ascent.partners/api/v1/search" \
-H "Content-Type: application/json" \
-d '{"embedding": [0.012, -0.034, 0.056, ...], "k": 5}'响应
json
{
"query": "[vector]",
"mode": "semantic",
"data": [
{
"title": "Climate Risk Assessment",
"permalink": "/environmental/climate-risk/",
"similarity": 0.748
}
],
"total": 5
}错误处理
API返回标准HTTP状态码和错误消息。
Error Responsejson
{
"error": "Missing required parameter: q"
}| 状态 | 含义 |
|---|---|
| 400 | 400 错误请求 |
| 404 | 404 未找到 |
| 500 | 500 服务器错误 |
速率限制
无严格速率限制请尊重他人并尽可能缓存响应。