sub2api-admin

Manage Sub2API admin accounts, redeem codes, groups, and proxies through a Node.js CLI.

40.1k|8.3k|Updated Dec 18, 2025
One-click install
npx skills add https://github.com/Wei-Shaw/sub2api --skill sub2api-admin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sub2api-admin
Source: https://github.com/Wei-Shaw/sub2api/tree/main/skills/sub2api-admin
Command: npx skills add https://github.com/Wei-Shaw/sub2api --skill sub2api-admin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Operating a Sub2API backend through raw admin API calls is error-prone and tedious, especially for bulk account imports, redeem code generation, and error recovery. This Skill wraps the admin API in a single CLI with consistent authentication, idempotency support, and safe read-before-write workflows.

Core Features & Use Cases

  • Account Lifecycle Management: List, inspect, create, update, delete, refresh, and clear errors on upstream accounts, including bulk updates, batch credential updates, and CRS sync.
  • Redeem Code Operations: Generate balance, concurrency, subscription, and invitation codes, create-and-redeem in one step with idempotency keys, and export codes to CSV.
  • Backend Configuration: Manage error passthrough rules, TLS fingerprint profiles, groups, and proxies, plus a raw api passthrough for any admin endpoint.
  • Use Case: An operator needs to recharge a user after a payment callback. They run redeem-codes create-and-redeem with a stable idempotency key, then verify the result with redeem-codes list.

Quick Start

Set SUB2API_BASE_URL and SUB2API_ADMIN_API_KEY in the environment, then ask the assistant to list Sub2API accounts or generate a balance redeem code using the sub2api-admin skill.

Frequently Asked Questions about sub2api-admin

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage Sub2API accounts from the command line?

Set SUB2API_BASE_URL and SUB2API_ADMIN_API_KEY, then run node scripts/sub2api-admin.js with commands like accounts list, accounts get, accounts update, or accounts bulk-update. The CLI handles authentication and JSON payloads for all admin endpoints.

How do I generate and redeem Sub2API recharge codes?

Use redeem-codes generate for batch code creation or redeem-codes create-and-redeem to create a code and apply it to a user in one step. Always pass a stable --idempotency-key for payment or recharge workflows to prevent duplicate credits.

Can I use Sub2API admin API without an admin API key?

Yes, the CLI falls back to JWT authentication via SUB2API_JWT when no admin API key is set. Obtain the token by logging in through POST /api/v1/auth/login with an admin email and password, then copy the access_token from the response.

Why does the Sub2API admin API return INVALID_ADMIN_KEY?

INVALID_ADMIN_KEY means the configured admin API key is missing, revoked, or incorrect. Regenerate the admin API key in the backend settings and update SUB2API_ADMIN_API_KEY, or switch to JWT authentication with a valid admin access token.

How do I safely bulk update or delete Sub2API accounts?

Run read-only commands first, such as accounts list or accounts get, to confirm target names and IDs. Then execute accounts bulk-update with --ids and a JSON patch, and verify the result with a follow-up read command.

Does Sub2API account export expose credentials?

Yes, accounts export includes account credentials and tokens in the output. Use the --file flag to write exports directly to disk instead of printing them in chat or logs, and restrict access to the exported file.