Skip to main content

Admin API Endpoints

Overview

The Admin API provides administrative operations for managing customers, subscriptions, and payments. These endpoints are typically used by the internal admin panel.

Base Path

All admin endpoints are prefixed with /api/v1/admin


Subscription Management

List All Subscriptions

Endpoint: GET /v1/admin/subscriptions

Returns all subscriptions with associated customer information.

Response:

{
subscriptions: Array<{
id: string;
customerId: string;
status: "active" | "past_due" | "canceled" | "expired";
currentPeriodStart: string;
currentPeriodEnd: string;
plan: string;
customer: Customer | null;
}>;
}

Code Reference: services/api/admin/controller.ts - createAdminSubscriptionsController()


Get Subscription Details

Endpoint: GET /v1/admin/subscriptions/:id

Returns detailed subscription information including customer data.

Response: Subscription object with customer property


Customer Management

List All Customers

Endpoint: GET /v1/admin/customers

Returns all registered customers.

Response:

{
customers: Customer[];
}

Code Reference: services/api/admin/controller.ts - createAdminCustomersController()


Get Customer Details

Endpoint: GET /v1/admin/customers/:id

Returns specific customer by ID.

Response: Customer object or 404 Not Found


Regenerate License

Endpoint: POST /v1/admin/customers/:customerId/regenerate-license

Generates a new license key for the specified customer. Useful when a customer loses their license key or needs a reset.

Response:

{
license: {
id: string;
key: string; // New license key
customerId: string;
isActive: boolean;
createdAt: string;
updatedAt: string;
};
}

Code Reference: services/api/admin/controller.ts - createAdminLicensesController()


Payment History

List All Payments

Endpoint: GET /v1/admin/payments

Returns all payments with associated customer information.

Response:

{
payments: Array<{
id: string;
customerId: string;
amount: number;
currency: string;
status: "pending" | "completed" | "failed" | "refunded";
paymentType: "one_time" | "subscription_renewal";
createdAt: string;
customer: Customer | null;
}>;
}

Code Reference: services/api/admin/controller.ts - createAdminPaymentsController()


Get Payment Details

Endpoint: GET /v1/admin/payments/:id

Returns detailed payment information including customer.

Response: Payment object with customer property


Code Reference

  • Controller: services/api/admin/controller.ts
  • Contains four sub-controllers:
    • createAdminSubscriptionsController()
    • createAdminLicensesController()
    • createAdminCustomersController()
    • createAdminPaymentsController()

Admin Operations Summary

ResourceList AllGet OneCreateUpdateDelete
CustomersGET /customersGET /customers/:id---
SubscriptionsGET /subscriptionsGET /subscriptions/:id---
PaymentsGET /paymentsGET /payments/:id--Refund via payments API
Licenses---POST /regenerate-license-

Note on Write Operations

The admin API is primarily read-focused. Write operations like subscription cancellation/resumption are handled through the customer-facing subscription endpoints (POST /v1/subscriptions/:id/cancel, POST /v1/subscriptions/:id/resume) which are accessible to customers directly.