https://karsenal-api.netlify.app/.netlify/functions/health
{
"status": "ok",
"timestamp": "2026-09-25T11:30:00.000Z",
"uptime": 12.34
}
curl https://karsenal-api.netlify.app/.netlify/functions/health
https://karsenal-api.netlify.app/.netlify/functions/generate
| 参数Item | 类型Type | 默认值Default | 描述Description |
|---|---|---|---|
deckCode | string | - | 必填,KARDS 卡组代码Required, KARDS deck code |
cols | number | 10 | 每行卡牌数量Number of cards per row |
scale | number | 50 | 缩放比例(25–100)Image scale (25–100) |
lang | string | zh-Hans | 语言代码Language code |
bgColor | string | transparent | 背景颜色(十六进制颜色码)Background color (hex) |
| 参数Item | 类型Type | 默认值Default | 描述Description |
|---|---|---|---|
foldEnabled | boolean | false | 折叠重复卡牌Fold same cards |
addStatsCard | boolean | true | 统计卡Statistical card |
statsTitle | string | 卡组统计 | 统计卡标题Statistical card title |
qrEnabled | boolean | false | 二维码卡QR code card |
qrTitle | string | 卡组二维码 | 二维码卡标题QR code card title |
hq | string | - | 总部 cardId(如 moscow)HQ cardId (e.g. moscow) |
statsChartToggle | boolean | false | 额外统计图Additional statistical chart |
| 参数Item | 类型Type | 默认值Default | 描述Description |
|---|---|---|---|
version | string | DEFAULT_VERSION | 卡牌版本Card version |
spacingX | number | 0 | 水平间距Horizontal spacing |
spacingY | number | 0 | 垂直间距Vertical spacing |
emptySlots | array | [] | 空位索引数组Vacancy index array |
cardOverrides | object | {} | 单卡覆盖配置Single-card override settings |
cardOverrides 格式Format{
"cardId": {
"version": "v52",
"cost": 3,
"star": true
}
}
| 代码Code | 语言Language |
|---|---|
zh-Hans | 简体中文 |
zh-Hant | 繁體中文 |
en-EN | English |
fr-FR | Français |
de-DE | Deutsch |
pl-PL | Polski |
pt-BR | Português |
ru-RU | Pусский |
it-IT | Italiano |
es-ES | Español |
ko-KR | 한국어 |
ja-JP | 日本語 |
{
"mainImage": "data:image/png;base64,...",
"statsChart": "data:image/png;base64,..."
}
| 字段Field | 描述Description |
|---|---|
mainImage | 卡组图片(Base64)Deck image (Base64) |
statsChart | 额外统计图(仅当 statsChartToggle: true 时返回)Additional statistical chart (returned only if statsChartToggle: true) |
{
"error": "错误描述 Error Description"
}
curl -X POST https://karsenal-api.netlify.app/.netlify/functions/generate \
-H "Content-Type: application/json" \
-d '{
"deckCode": "%%5a|jvpy;j3xAyc;czydj1bPmI;ggbKpEy6",
"cols": 8,
"lang": "zh-Hans"
}'
import fs from 'fs';
const response = await fetch('https://karsenal-api.netlify.app/.netlify/functions/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
deckCode: '%%5a|jvpy;j3xAyc;czydj1bPmI;ggbKpEy6',
cols: 8,
lang: 'zh-Hans'
})
});
const data = await response.json();
const base64Data = data.mainImage.replace(/^data:image\/png;base64,/, '');
fs.writeFileSync('deck.png', Buffer.from(base64Data, 'base64'));
import requests
import base64
response = requests.post('https://karsenal-api.netlify.app/.netlify/functions/generate', json={
'deckCode': '%%5a|jvpy;j3xAyc;czydj1bPmI;ggbKpEy6',
'cols': 8,
'lang': 'zh-Hans'
})
data = response.json()
base64_data = data['mainImage'].split(',')[1]
with open('deck.png', 'wb') as f:
f.write(base64.b64decode(base64_data))
https://karsenal-api.netlify.app/.netlify/functions/deck-json
| 参数Item | 类型Type | 默认值Default | 描述Description |
|---|---|---|---|
deckCode | string | - | KARDS 卡组代码KARDS deck code |
{
"mainFaction": "usa",
"allyFaction": "anzac",
"mainFactionName": "美国",
"allyFactionName": "澳新军团",
"totalCards": 39,
"uniqueCards": 14,
"cards": [
{
"count": 4,
"card": {
"id": 93750,
"cardId": "the_war_machine",
"importId": "bK",
"titleZh": "战争机器",
"titleEn": "THE WAR MACHINE",
"text_zh": "额外获得 1 个指挥点槽。",
"textMap": { "zh-Hans": "额外获得 1 个指挥点槽。", … },
"titleMap": { "zh-Hans": "战争机器", … },
"faction": "usa",
"type": "order",
"rarity": "Standard",
"cost": 2,
"attributes": [],
"setName": "Base",
"image": "the_war_machine.avif",
"reserved": false,
"isSpawn": false,
"isVeteranSet": false,
"canCreate": [],
"exile": "",
"permanentPool": true
}
},
…
]
}
curl -X POST https://karsenal-api.netlify.app/.netlify/functions/deck-json \
-H "Content-Type: application/json" \
-d '{"deckCode":"%%5a|jvpy;j3xAyc;czydj1bPmI;ggbKpEy6"}'