Skip to content

API cleanup (Batch 1): mirror gateway billing/account route renames in SDK/CLI/MCP #430

@MajorTal

Description

@MajorTal

API cleanup (Batch 1): mirror gateway billing/account route renames in SDK/CLI/MCP

Part of a pre-launch API-consistency cleanup happening in run402-private. Several gateway billing/account routes are being renamed for consistency. Because these are admin routes they're excluded from openapi.json/llms-full.txt, but they are baked into the published @run402/sdk, run402-mcp, the CLI, and the sync.test.ts cross-surface contract here — so this repo must mirror the renames in lockstep, and republish.

⚠️ Coordination: the gateway-side change for item 1 is implemented on branch api-cleanup-batch-1 in run402-private (not yet merged/deployed). Do not deploy the gateway rename until this repo's SDK/CLI/MCP changes are merged + published, otherwise published clients calling the old path will 404.

1. Shipping now (gateway side done): lease-perpetual fold-in

POST /billing-accounts/v1/admin/:id/lease-perpetualPOST /billing/v1/admin/accounts/:account_id/lease-perpetual
(The one-route /billing-accounts/v1/* namespace is retired; the toggle joins the /billing/v1/admin/accounts/* family next to credit/debit/set-tier.)

Files to update here:

  • sdk/src/namespaces/admin.tssetLeasePerpetual() path (~L435/442)
  • sdk/src/namespaces/admin.test.ts — URL assertions (~L214/229/256)
  • src/index.ts — MCP tool admin_set_lease_perpetual description "Calls POST …" (~L690)
  • CLI command admin:lease-perpetual — URL builder
  • cli-e2e.test.mjs — mock URL match (~L1883/1908)
  • sync.test.ts — endpoint registry entry (~L374)
  • Republish @run402/sdk + run402-mcp; coordinate timing with the gateway deploy

2. Planned next (gateway shapes pending final design in run402-private)

These are the remaining Batch 1 consolidations. Listed so this repo has the full picture; exact target paths will be confirmed before the gateway change lands, then this issue (or a follow-up) will get the precise mapping.

  • Admin account routes keyed by :account_id instead of :wallet (credit, debit, set-tier) → /billing/v1/admin/accounts/:account_id/{credit,debit,set-tier}
  • Public account addressing: /billing/v1/accounts/:id unified to :account_id (UUID) + ?wallet=/?email= lookup (today :id means wallet or email on GET but a UUID on link-wallet)
  • Tier mutation consolidated (today 3 write paths across 2 namespaces: /tiers/v1/:tier, /billing/v1/tiers/:tier/checkout, /billing/v1/admin/accounts/:wallet/set-tier)
  • Checkout consolidated (today 3 shapes: /billing/v1/checkouts, /billing/v1/tiers/:tier/checkout, /billing/v1/email-packs/checkout)

Naming convention adopted (for reference)

  • "admin" = platform staff (us); "operator" = the human customer who owns a billing account. Platform-admin actions stay under /<resource>/v1/admin/*.
  • Path params: resource-qualified snake_case (:account_id), not bare :id.

cc: tracking the gateway side in run402-private branch api-cleanup-batch-1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions