Skip to main content
Use this skill when an AI assistant needs to create a subscription from an existing subscription template through the public API.

Skill

---
name: create-subscription-from-template
description: Create a Hyperline subscription from a subscription template through the public API. Use when an agent needs to draft or execute a POST /v2/subscriptions payload with customer_id and template_id while preserving the template configuration.
---

# Create Subscription From Template

Use the public API endpoint `POST /v2/subscriptions`.

## Inputs

Collect these values before calling the API:

- `customer_id`: Hyperline customer ID.
- `template_id`: subscription template ID.
- Optional `template_configuration_id`: use only when the user knows the exact template configuration to apply.
- Optional `checkout_session`: use only when the user wants to send a checkout session.

If the user gives customer or template names instead of IDs, resolve them first. Do not guess.

## Payload

Minimal subscription from template:

```json
{
  "customer_id": "cus_xxx",
  "template_id": "subt_xxx"
}
```

With an explicit template configuration:

```json
{
  "customer_id": "cus_xxx",
  "template_id": "subt_xxx",
  "template_configuration_id": "stc_xxx"
}
```

Call shape:

```bash
curl -X POST "https://api.hyperline.co/v2/subscriptions" \
  -H "Authorization: Bearer <API key>" \
  -H "Content-Type: application/json" \
  -d '<payload>'
```

## Behavior

- `template_id` without `products` or `phases` creates the subscription from the template.
- If `template_configuration_id` is omitted, Hyperline resolves the applicable configuration from the customer details.
- The created subscription inherits the template's products, phases, billing rules, and pricing.

## Do not accidentally create a custom subscription

Do not send `products` or `phases` unless the user explicitly wants a custom subscription configuration. Those fields create a custom subscription and only reference the template for reporting.

If the user wants to change prices, products, phases, coupons, or billing cadence, confirm whether they want to update the template first or create a custom subscription payload.

## Verify

After creation:

1. Read `id`, `status`, `customer_id`, and `template_id` from the response.
2. Fetch `GET /v2/subscriptions/{id}` if you need to confirm products or phases.
3. Confirm the subscription belongs to the intended customer.

Create subscription API

See the public API endpoint for creating subscriptions.

Subscription templates

Learn how subscription templates work in Hyperline.