场景
适用场景
这个接口适合用在什么地方?下面的场景可以帮你判断它是不是你要找的那个。
- 下载某一天的完整担当数据做离线分析。
- 把 CSV 直接交给数据库导入工具:使用 binary=true 会拿到干净的文件内容。
问答
常见问题
接入时最常遇到的疑问,先看看这里能不能解答。
为什么导出格式只有 CSV?
v2 的日导出统一为 CSV,不再提供 JSONL 选项。需要结构化数据时,可以先用索引接口确定日期,再解析 CSV 内容。
total 和 content 分别是什么?
total 是当天导出文件里的记录条数,content 是 CSV 文本本身。JSON 包装模式下两者都会返回。
扣费
扣费规则
每次请求按固定额度扣费,不随返回条数变化。
固定 200 点额度/次
实际扣费以响应头 x-api-cost 为准。
请求说明
参数
路径参数
datestring 必填
要读取的日期,格式为 YYYYMMDD,例如 20260814 表示 2026 年 8 月 14 日。
示例:20260814
查询参数
binarytrue | false
是否直接返回原始 CSV 文件。传 true 时响应体就是 CSV 文本,并带有下载响应头;不传或传 false 时返回 JSON 包装结构。
示例:false
响应说明
状态码与响应格式
200
单日导出内容:JSON 包装结构或原始 CSV 文本。
响应头
x-api-remainx-api-costRetry-After
application/jsonobject
响应结构
{
"type": "object",
"required": [
"meta",
"data"
],
"properties": {
"meta": {
"type": "object",
"required": true,
"shape": {
"type": "object",
"required": [
"remain",
"cost"
],
"properties": {
"remain": {
"type": "integer",
"required": true
},
"cost": {
"type": "integer",
"required": true
},
"retryAfter": {
"type": "integer"
}
}
}
},
"data": {
"type": "object",
"required": true,
"shape": {
"type": "object",
"required": [
"serviceDay",
"total",
"content"
],
"properties": {
"serviceDay": {
"type": "integer",
"required": true
},
"total": {
"type": "integer",
"required": true
},
"content": {
"type": "string",
"required": true
}
}
}
}
}
}示例响应
{
"meta": {
"remain": 149,
"cost": 400
},
"data": {
"serviceDay": 20679,
"total": 2,
"content": "trainCode,emuCode,startStation,endStation,startAt,endAt\nG1,CR400AF-2149,北京南,上海虹桥,1786665600,1786680000\nG2,CR400BF-5028,北京南,上海虹桥,1786665600,1786680000"
}
}text/csvstring
响应结构
{
"type": "string"
}示例响应
trainCode,emuCode,startStation,endStation,startAt,endAt
G1,CR400AF-2149,北京南,上海虹桥,1786665600,1786680000
G2,CR400BF-5028,北京南,上海虹桥,1786665600,1786680000400
路径参数或查询参数不合法。
响应头
x-api-remainx-api-costRetry-After
application/jsonobject
响应结构
{
"type": "object",
"required": [
"ok",
"data",
"error"
],
"properties": {
"ok": {
"type": "boolean",
"required": true
},
"data": {
"type": "string",
"required": true
},
"error": {
"type": "string",
"required": true
}
}
}示例响应
{
"ok": false,
"data": "date 必须使用 YYYYMMDD 格式。",
"error": "invalid_param"
}401
请求未携带有效的认证信息,或提供的 API Key 已失效。
响应头
x-api-remainx-api-costRetry-After
application/jsonobject
响应结构
{
"type": "object",
"required": [
"ok",
"data",
"error"
],
"properties": {
"ok": {
"type": "boolean",
"required": true
},
"data": {
"type": "string",
"required": true
},
"error": {
"type": "string",
"required": true
}
}
}示例响应
{
"ok": false,
"data": "API Key 无效或已过期。",
"error": "invalid_api_key"
}403
当前凭证缺少调用该接口所需的 scope。
响应头
x-api-remainx-api-costRetry-After
application/jsonobject
响应结构
{
"type": "object",
"required": [
"ok",
"data",
"error"
],
"properties": {
"ok": {
"type": "boolean",
"required": true
},
"data": {
"type": "string",
"required": true
},
"error": {
"type": "string",
"required": true
}
}
}示例响应
{
"ok": false,
"data": "缺少调用该接口所需的权限。",
"error": "forbidden"
}404
目标导出文件暂不可用。
响应头
x-api-remainx-api-costRetry-After
application/jsonobject
响应结构
{
"type": "object",
"required": [
"ok",
"data",
"error"
],
"properties": {
"ok": {
"type": "boolean",
"required": true
},
"data": {
"type": "string",
"required": true
},
"error": {
"type": "string",
"required": true
}
}
}示例响应
{
"ok": false,
"data": "20260814.csv 尚未生成。",
"error": "not_found"
}429
额度不足或请求过于频繁。
响应头
x-api-remainx-api-costRetry-After
application/jsonobject
响应结构
{
"type": "object",
"required": [
"ok",
"data",
"error"
],
"properties": {
"ok": {
"type": "boolean",
"required": true
},
"data": {
"type": "string",
"required": true
},
"error": {
"type": "string",
"required": true
}
}
}示例响应
{
"ok": false,
"data": "额度不足,请稍后再试。",
"error": "rate_limited"
}