> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hyperline.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a quote from a template with AI

> AI skill for creating a Hyperline quote from a template while preserving terms, attachments, contract documents, and optional draft subscription updates.

Use this skill when an AI assistant needs to create a quote from an existing quote template through the public API.

The quote template provides the quote defaults, terms, attachments, contract documents, and subscription configuration. You can optionally update the draft subscription created from the template after the quote has been created.

## Skill

````md theme={null}
---
name: create-quote-from-template
description: Create a Hyperline quote from a quote template through the public API while preserving template terms, attachments, and contract documents. Use when an agent needs to draft or execute a quote from template workflow, optionally updating subscription custom properties, dates, products, phases, coupons, discounts, prices, or seats on the draft subscription after creation.
---

# Create Quote From Template

Use the public API endpoint `POST /v1/quotes`.

## Inputs

Collect these values before calling the API:

- `customer_id`: Hyperline customer ID.
- `template_id`: quote template ID.
- Optional `custom_properties`: key/value map using custom property slugs as keys.
- Optional subscription overrides such as contract dates, products, phases, coupons, discounts, prices, or seats.
- Optional quote-level overrides such as `owner_email`, `expires_at`, `status`, display fields, or collection requirements.

If the user gives custom property names instead of slugs, resolve or ask for the slug first. Do not guess.

## Payload

Use one call only when the quote should stay exactly on the template subscription configuration, with at most subscription custom properties or trial values.

Minimal quote from template:

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

Quote from template with subscription custom properties:

```json
{
  "customer_id": "cus_xxx",
  "template_id": "quot_xxx",
  "subscription": {
    "custom_properties": {
      "sales_segment": "enterprise",
      "requires_procurement": true,
      "renewal_owner": "finance",
      "tags": ["strategic"],
      "legacy_ref": null
    }
  }
}
```

Call shape:

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

## Subscription overrides

If the user needs subscription overrides such as contract dates, products, phases, coupons, discounts, prices, or seats, use two calls:

1. Create the quote from the template with `POST /v1/quotes`.

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

2. Read `id` and `subscription_id` from the quote response, then update the draft quote subscription with `PATCH /v1/quotes/{id}`.

```json
{
  "subscription": {
    "custom_properties": {
      "sales_segment": "enterprise"
    },
    "contract_start": "2026-07-08T00:00:00Z",
    "phases": [
      {
        "activation_strategy": "start_date",
        "starts_at": "2026-07-08T00:00:00Z",
        "end_strategy": "duration",
        "duration": {
          "period": "months",
          "count": 6
        },
        "billing_date_setting": "phase_start",
        "products": [],
        "coupons": []
      }
    ]
  }
}
```

Do not send `terms`, `comments`, or `contract_clause_ids` in the update unless the user explicitly wants to override template content.

## Behavior

- `template_id` makes Hyperline create the quote from the quote template.
- The quote template supplies the subscription configuration from its linked subscription template or plan.
- `subscription.custom_properties` applies values to the draft subscription created from the template.
- Provided custom property slugs are updated. Omitted custom properties are left as-is. `null` clears that specific custom property.
- Custom property values belong to the subscription, not the quote.
- Updating the draft quote with a subscription payload replaces the draft subscription configuration while keeping the quote-level template content created in the first call.

## Do not accidentally replace the template subscription

Keep `subscription` limited to `custom_properties` and, if needed, `trial`.

Never send `subscription.products` or `subscription.phases` together with `template_id` in the initial `POST /v1/quotes` call. Those fields switch the request into custom subscription mode instead of taking the subscription configuration from the template, which can skip template terms, contract clauses, or contract documents.

Other subscription fields are not reliable overrides in pure template mode. If the user needs purchase order, contract dates, products, phases, coupons, discounts, prices, or seats changed, create from the template first, then update the draft quote subscription with `PATCH /v1/quotes/{id}`.

## Quote custom property collection

Do not confuse these fields:

- `subscription.custom_properties`: values to set on the created subscription.
- `collect_custom_property_ids`: quote signature flow asks the customer to fill customer custom properties by ID.

Use `collect_custom_property_ids` only when the user wants the signer to provide customer custom properties during signature.

## Verify

After creation:

1. Read `id`, `subscription_id`, `terms`, and `attachments` from the quote response.
2. If subscription values were provided or changed, fetch `GET /v2/subscriptions/{subscription_id}`.
3. Confirm `custom_properties` contains the provided slug/value pairs when provided.
4. Confirm the quote still has the expected template terms and attachments before finalizing or sending.
````

## Related documentation

<CardGroup cols={2}>
  <Card title="Create quote API" icon="code" href="/api-reference/endpoints/quotes/create-quote">
    See the public API endpoint for creating quotes.
  </Card>

  <Card title="Quote templates" icon="signature" href="/docs/quotes/templates">
    Learn how quote templates work in Hyperline.
  </Card>
</CardGroup>
