Skip to main content
POST
/
v1
/
subscriptions
/
customers
/
{customer_id}
/
billing_portal
JavaScript
import Hercules from '@usehercules/sdk';

const client = new Hercules({
  apiVersion: '2025-12-09',
  apiKey: process.env['HERCULES_API_KEY'], // This is the default and can be omitted
});

const response = await client.beta.subscriptions.customers.billingPortal('customer_id');

console.log(response.url);
{
  "url": "<string>"
}

Authorizations

Authorization
string
header
required

API key authentication. Include your API key in the Authorization header as: Bearer

Path Parameters

customer_id
string
required

The unique identifier of the customer

Body

application/json

Request to create a billing portal session for a customer

return_url
string<uri>

URL to redirect the customer to after they exit the billing portal

Response

200 - application/json

The billing portal session containing the redirect URL

Response containing the billing portal URL

url
string
required

URL to redirect the customer to for the billing portal