正在启动平台

血型遗传查询 API 接入文档blood-type

根据父母血型查询子女可能/不可能的血型。基于 ABO 显性遗传规律,覆盖全部 16 种父母组合,毫秒级返回。常用于科普教育、亲子问答场景。

1. 基本信息

接口地址https://v1.apizero.cn/api/blood-type
请求方法GET
分类life
提供方极数本源
计费模式免费试用
单次消耗0 积分
起步价
QPS 限制20 req/s
每日免费额度20000 次(已认证用户)
匿名每日额度10000 次(无 API Key)
VIP 免费
调用次数

2. 认证

匿名免登录可调,每日 100 次;登录用户每日 200 次。

获取 API Key:登录 https://apizero.cn/account/keys

3. 请求参数

参数名类型必填说明示例
fatherstring父亲血型,A / B / O / AB(大小写不敏感)A
motherstring母亲血型,A / B / O / ABB

5. 请求示例

以下 5 种语言示例都是可直接运行的,只需把 YOUR_API_KEY 替换为实际 Key。

cURL

curl "https://v1.apizero.cn/api/blood-type?father=A&mother=B&key=YOUR_API_KEY"

Python

import requests

resp = requests.get(
    "https://v1.apizero.cn/api/blood-type",
    params={
    "father": "A",
    "mother": "B",
    "key": "YOUR_API_KEY",
},
    timeout=15,
)
resp.raise_for_status()
print(resp.json())

JavaScript (Node.js)

// Node.js 18+ / 浏览器原生 fetch
const params = new URLSearchParams({
  "father": "A",
  "mother": "B",
  "key": "YOUR_API_KEY",
});

const res = await fetch(`https://v1.apizero.cn/api/blood-type?${params}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();
console.log(data);

Go

package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://v1.apizero.cn/api/blood-type", nil)
	q := req.URL.Query()
	q.Set("father", "A")
	q.Set("mother", "B")
	q.Set("key", "YOUR_API_KEY")
	req.URL.RawQuery = q.Encode()

	resp, err := http.DefaultClient.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}

PHP

<?php
$url = "https://v1.apizero.cn/api/blood-type?" . http_build_query([
    "father" => "A",
    "mother" => "B",
    "key" => "YOUR_API_KEY",
]);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$body = curl_exec($ch);
curl_close($ch);

$data = json_decode($body, true);
print_r($data);

6. 响应字段

字段类型说明示例
fatherstring回显父亲血型
motherstring回显母亲血型
possiblearray子女可能的血型列表
impossiblearray子女不可能的血型列表
summarystring人类可读的中文摘要

7. 响应示例

{
    "code": 0,
    "msg": "成功",
    "data": {
        "father": "A",
        "mother": "B",
        "possible": [
            "A",
            "B",
            "AB",
            "O"
        ],
        "impossible": [],
        "summary": "子女可能为 A、B、AB、O 型血;无不可能的血型"
    },
    "request_id": "abc123"
}

8. 错误码

codestatus说明
4000缺少 father / mother 参数,或血型值不在 A/B/O/AB 范围

9. 变更日志

  • 1.0.0(2026-05-07)
    • 首次上线 · 10 条 ABO 遗传规则全覆盖

常见问题

血型遗传查询 接口怎么免费使用?

未登录用户每个 IP 每天 10000 次免费。登录用户创建 API Key 后每天 20000 次免费,超额部分按点数计费(0 点/次)。

血型遗传查询 支持哪些调用方式?

接口使用 GET 请求。文档提供 cURL、Python、JavaScript (Node.js)、Go、PHP 五种语言的可运行示例。也可以下载 /openapi.json 导入 Postman / Insomnia / Apifox 反向生成 SDK。

调用不限额么? QPS 是多少?

本接口 QPS 限制 20 req/s,每个 API Key 每日免费 20000 次。需要更高额度可升级 VIP 套餐或联系售后提高 QPS。

这个接口跟自己直连上游有什么区别?

极数本源 作为中间层提供:统一鉴权(一个 Key 调所有接口)、统一计费(点数制)、统一限流、统一错误码、多上游自动切换。免去逐个对接上游、维护 Key、统计调用量的运维成本。