API 参考激活码

购买激活码

POSThttps://api.astrum.shop/v1/keys
权限范围 keys:write

从余额中扣除价格,并在响应中返回激活码——同时附带可直接交给客户的链接。每次最多购买同一套餐的 100 个激活码。

价格为您的专属价格:取批发阶梯价与个人价中较低者。阶梯计入本次购买。

未收到响应时,请使用相同的 ref 重试:会返回同样的激活码,且不会重复扣款。

请求体

application/json
product_id
string · 必填

套餐,取自 GET /v1/catalog。

delivery_method
string | null

交付方式——仅当套餐有多种方式时需要:activation 或 card_payment。

kind
string | null

订阅类型——仅当套餐有多种类型时需要:

app_store
App Store 激活
web
网页激活
web_payment
网页激活(我方银行卡)
subscription_days
integer | null

期限——仅当有多个期限时需要。未指定时取最短期限。

quantity
integer

激活码数量:1 到 100。

ref
string | null

您那边的订单号。使用相同的 ref 重试会返回同样的激活码,不会重复扣款。

响应

ref
string | null

您那边的订单号——与请求中一致。

keys
array

已购买的激活码。

↳key_id
string

激活码在我们这里的编号——用于 GET /v1/keys/{key_id}。

↳code
string | null

交给客户的激活码:XXXX-XXXX-XXXX-XXXX。

↳link
string | null

开通页面链接——激活码会自动填入。

↳status
string

激活码状态:

available
未使用——可以交给客户
activating
客户已提交信息,正在开通
activated
订阅已开通
expired
已作废——未在有效期内激活
refunded
价格已退回余额
↳product_id
string
↳title
string

套餐名称。

↳delivery_method
string
↳kind
string | null
↳subscription_days
integer | null
↳price_usdt
string

激活码的价格——为它扣除的金额。

↳ref
string | null

购买时传入的您那边的订单号。

↳created_at
string
↳expires_at
string

未激活时的作废时间:购买后 45 天。

↳activated_at
string | null
↳warranty_until
string | null

质保截止时间(自激活起 7 天)。

↳last_attempt_failed_at
string | null

最近一次开通未成功的时间——此后激活码重新变为未使用。

↳last_attempt_reason
string | null

最近一次尝试未成功的原因:

verification_declined
客户拒绝了身份验证
not_activated
未能开通订阅,尝试已关闭

null — 没有失败的尝试。

price_usdt
string

单个激活码的价格(已计入批发)。

charged_usdt
string

本次购买从余额中扣除的总额。

balance_usdt
string

购买后的余额。

所有接口通用的错误,详见「错误码」章节:

10001 invalid_key10002 key_scope_missing10003 ip_not_allowed10004 browser_not_allowed10005 account_suspended20001 too_many_requests90002 api_disabled90001 internal_error
测试 USDT,
密钥 ask_test_…
curl https://api.astrum.shop/v1/keys -X POST \
  -H "Authorization: Bearer $ASTRUM_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "3f6c0e7e-2b1d-4c1a-9a57-4d0f1b8e2c11",
    "quantity": 1,
    "ref": "order-58213"
  }'
响应
{
  "ref": "order-58213",
  "keys": [
    {
      "key_id": "9b2f6c1e-4d7a-4b0e-8f3c-1a5d2e7c9b40",
      "code": "7K2M-9QXH-4RWD-P8NY",
      "link": "https://activate.astrum.shop/#k=7K2M-9QXH-4RWD-P8NY",
      "status": "available",
      "product_id": "3f6c0e7e-2b1d-4c1a-9a57-4d0f1b8e2c11",
      "title": "ChatGPT Plus",
      "delivery_method": "activation",
      "kind": "web",
      "subscription_days": 30,
      "price_usdt": "20.00",
      "ref": "order-58213",
      "created_at": "2026-10-14T10:14:03Z",
      "expires_at": "2026-11-28T10:14:03Z",
      "activated_at": null,
      "warranty_until": null,
      "last_attempt_failed_at": null,
      "last_attempt_reason": null
    }
  ],
  "price_usdt": "20.00",
  "charged_usdt": "20.00",
  "balance_usdt": "80.00"
}