BASE URL接口地址与鉴权
https://esfine.cn/jiema/api/v1
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Idempotency-Key: your-unique-order-id
也支持 X-API-Key。先在钱包页面兑换 CDK,提交任务时按账号数自动扣除钱包次数,不再需要每次传 CDK。每个密钥只能访问所属用户的数据。所有响应都含 request_id 与 server_time。
下载 OpenAPI 3.0 JSON →
POST /jobs提交单个或批量任务
{
"format": "codex",
"external_ref": "ORDER-2026-0001",
"accounts": [{
"email": "name@example.com",
"password": "password",
"twofa": "TOTP_SECRET"
}]
}单账号也可使用 account 对象;每次最多 100 个。format 支持 codex、cpa、sub2、both、all。建议每个外部订单使用唯一 Idempotency-Key:网络超时后用相同值重试不会重复创建任务。
QUERY查询和筛选
GET /me:当前密钥对应用户及钱包摘要GET /wallet:可用次数和最近流水GET /stats:任务总数、成功、失败和进行中统计GET /jobs?limit=20&status=ok:按状态查询GET /jobs?external_ref=ORDER-2026-0001:按外部订单号查询GET /jobs?cursor=NEXT_CURSOR:稳定翻页,使用响应里的 pagination.next_cursorGET /jobs/{id}:任务详情、进度、耗时和结果链接
OPERATIONS日志、结果与重试
GET /jobs/{id}/logs?cursor=0:增量日志;下一次传回响应的 cursorGET /jobs/{id}/result?format=codex:下载结果,格式支持 codex、cpa、sub2POST /jobs/{id}/retry:重新执行失败任务POST /jobs/{id}/email-code:提交邮箱验证码,JSON 为 {"code":"123456"}GET /health:免鉴权健康检查
CURL最小接入示例
curl -X POST "https://esfine.cn/jiema/api/v1/jobs" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: ORDER-2026-0001" \
-d '{"format":"codex","external_ref":"ORDER-2026-0001","account":{"email":"name@example.com","password":"password","twofa":"TOTP_SECRET"}}'
JAVASCRIPTJavaScript 调用示例
const base = "https://esfine.cn/jiema/api/v1";
const headers = {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
"Idempotency-Key": orderId
};
const submitted = await fetch(`${base}/jobs`, {
method: "POST",
headers,
body: JSON.stringify({
format: "codex",
external_ref: orderId,
account: { email, password, twofa }
})
}).then(r => r.json());
const jobId = submitted.jobs[0].id;
const job = await fetch(`${base}/jobs/${jobId}`, { headers })
.then(r => r.json());
ERRORSHTTP 状态与错误处理
200:成功或幂等重放202:任务已接受400:参数或 JSON 格式错误401:API Key 无效403:钱包次数不足404:任务或结果不存在409:任务当前状态不允许操作413:请求体超过 2 MB
{
"ok": false,
"error": "invalid_format",
"message": "format must be codex, cpa, sub2, both or all",
"request_id": "req_xxx",
"server_time": 1791216000
}