DEVELOPER DOCS / API V1

国家、运营商与币种目录

以冻结的 v1 契约接入通信数据。示例均为合成结构,实际结果以当前数据集与账户权限为准。

通用查询与分页

这些目录接口均为 GET。支持 q,country,operator,calling_code,cursor,limit,不相关条件按接口语义使用。分页返回 {items,total,next_cursor};不要解析或改写游标。

接口用途 / 返回记录边界
/v1/countriesCountry:iso2,iso3,name_cn,name_en,calling_codes,currencies,mobile_portability_supported共享国家码可对应多个地区。地区携转支持不是单号携转状态。
/v1/operatorsOperator:id,name,short_name,country_iso2,gsma_country_code(可选),network_ids,source;AAA/AAM/AAQ/AAZ 的 country_iso2 为空字符串,K00 映射为 XK;ANT 保留历史地区标识,country_iso2 为空,不推断现代国家。网络多对多关联不折叠,完整字段由服务端鉴权。
/v1/currenciesCurrency:code,name_cn,name_en,symbol,country_iso2s,sourceISO 币种代码与货币符号分别保留;一种币种可关联多个地区。

筛选与导出示例

cURL
curl 'https://YOUR_CELRYN_HOST/api/v1/countries?calling_code=1&limit=20' \
  -H "X-API-Key: $CELRYN_API_KEY"

curl 'https://YOUR_CELRYN_HOST/api/v1/operators?country=CN&limit=20' \
  -H "X-API-Key: $CELRYN_API_KEY"

curl 'https://YOUR_CELRYN_HOST/api/v1/currencies?q=HKD&format=xlsx' \
  -H "X-API-Key: $CELRYN_API_KEY" -o currencies.xlsx

币种支持format=json|csv|xlsx。导出沿用相同筛选条件并包含来源。CSV 中标识为字符串;用电子表格打开时注意避免自动数值转换。

JSON 成功响应结构示例

JSON
{
  "code": 0,
  "data": {
    "items": [],
    "total": 0,
    "next_cursor": null
  },
  "meta": {
    "request_id": "example-request-id",
    "dataset_version": "example-v1",
    "source_mode": "demo",
    "source_published_at": null,
    "ingested_at": "2026-09-08T00:00:00Z"
  }
}

响应、鉴权与错误

数据接口支持X-API-Key 或同源 Cookie 会话。匿名访问为受限公共投影,完整字段权限由 API 服务执行。JSON 成功响应统一为{code:0,data,meta};文件导出直接返回文件。

字段说明
meta.request_id本次请求标识,用于排查错误,不包含密钥。
meta.dataset_version / source_mode当前数据版本与 demo / ir21 / reference / mixed 来源模式。
meta.source_published_at源发布时间;未知为 null。
meta.ingested_at平台导入时间,ISO 格式 UTC。

400 表示参数不符,401 表示需要有效凭证,403 表示权限不足,429 表示调用限制,503 表示服务或数据源暂不可用。请读取错误响应的 codemessagerequest_id,详见错误与重试

ERROR / 示意结构
{
  "code": "EXAMPLE_ERROR_CODE",
  "message": "具体错误原因由服务端返回",
  "request_id": "example-request-id"
}