Skip to main content
POST
/
workspaces
/
{workspaceId}
/
billing-accounts
/
{billingAccountId}
/
subscriptions
Create a subscription
curl --request POST \
  --url https://api.altostrat.io/workspaces/{workspaceId}/billing-accounts/{billingAccountId}/subscriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "product_quantities": {
    "locations": 5,
    "users": 25
  },
  "metadata": {
    "project_id": "proj_abc123"
  }
}'
{
  "id": "sub_a1b2c3d4e5f6g7h8",
  "billing_account_id": "cus_a1b2c3d4e5f6g7h8",
  "status": "active",
  "currency": "usd",
  "product_quantities": {
    "locations": {
      "price_id": "price_123abc",
      "quantity": 10,
      "interval": "month"
    },
    "users": {
      "price_id": "price_456def",
      "quantity": 50,
      "interval": "month"
    }
  },
  "metadata": {
    "order_id": "6735"
  },
  "current_period_start": "2025-10-15T00:00:00Z",
  "current_period_end": "2025-11-15T00:00:00Z",
  "created_at": "2025-10-15T12:30:00Z",
  "updated_at": "2025-10-20T09:00:00Z"
}

Authorizations

Authorization
string
header
required

Enter your JWT in the format: Bearer {token}

Path Parameters

workspaceId
string
required

The ID of the workspace.

Example:

"ws_a1b2c3d4e5f6g7h8"

billingAccountId
string
required

The ID of the billing account, which corresponds to a Stripe Customer ID (cus_...).

Example:

"cus_a1b2c3d4e5f6g7h8"

Body

application/json
product_quantities
object
required

A map of meterable product types (locations, users, sso) to the desired quantity. At least one product is required.

Example:
{ "locations": 5, "users": 25 }
metadata
object

A set of up to 10 key-value pairs to store with the subscription.

Example:
{ "project_id": "proj_abc123" }

Response

The subscription was created successfully.

id
string

Unique identifier for the subscription (Stripe Subscription ID), prefixed with sub_.

Example:

"sub_a1b2c3d4e5f6g7h8"

billing_account_id
string

The ID of the billing account this subscription belongs to.

Example:

"cus_a1b2c3d4e5f6g7h8"

status
enum<string>

The status of the subscription.

Available options:
active,
past_due,
unpaid,
canceled,
incomplete,
incomplete_expired,
trialing,
paused
Example:

"active"

currency
enum<string>

The three-letter ISO currency code for the subscription.

Available options:
usd,
zar,
eur,
gbp,
aud
Example:

"usd"

product_quantities
object

A map of meterable product types to their subscribed quantities and pricing details.

Example:
{
"locations": {
"price_id": "price_123abc",
"quantity": 10,
"interval": "month"
},
"users": {
"price_id": "price_456def",
"quantity": 50,
"interval": "month"
}
}
metadata
object

A set of key-value pairs that you can attach to an object.

Example:
{ "order_id": "6735" }
current_period_start
string<date-time> | null

The start of the current billing period.

Example:

"2025-10-15T00:00:00Z"

current_period_end
string<date-time> | null

The end of the current billing period.

Example:

"2025-11-15T00:00:00Z"

created_at
string<date-time> | null

The timestamp when the subscription was created.

Example:

"2025-10-15T12:30:00Z"

updated_at
string<date-time> | null

The timestamp when the subscription was last updated in our system.

Example:

"2025-10-20T09:00:00Z"