# PATCH /api/v2/subscription-type-items/{subscription_type_item}

Update a template line

- MCP id: subscription-type-items.update
- Scope: api:write:subscription_types
- Permission: subscription_types::update
- Needs the billing feature on your organisation
- Rate cost: 1 unit, write bucket. A write costs the same whatever `view` you ask for.
- Cache-Control: private, no-store

Partially updates one template line: absent keys are untouched, and an empty body is `422`.

Send `If-Match` with the `ETag` from your last read to detect a concurrent edit, which answers `412`. `subscription_type_id` and `sort_order` are not accepted: a line cannot be moved to another type, and there is no way to reorder template lines through the API. `subscribable_type` and `subscribable_id` stay all-or-nothing: send both to re-point the line at another subscription product, or both as `null` to clear it. Only `subscription_product` is accepted, so a line pointed at a domain or a server in plnnrly can be read but never re-pointed here. Nothing is recalculated on the subscription type, and the change does not reach customer subscriptions already created from this template: that copy is taken by value at pick time.

## Parameters
- subscription_type_item (integer, path): The SubscriptionTypeItem's numeric id. Accepts a soft-deleted record.
- view (string, optional): Which field set to render.
- trashed (string, optional): Whether soft-deleted rows are included.
- X-Request-Id (header, optional): A correlation id of your own. It is recorded in our logs next to the server's request id but never returned: the response header always carries the server's id. A value that does not match the pattern is discarded silently, never rejected.
- If-Match (header, optional): The ETag a write is conditional on. A stale validator is 412 precondition-failed.

## Request body
- name (string or null ≤ 255, optional): Optional label for the template line. plnnrly's form does not show it, so most existing lines carry `null`; it exists for programmatic naming and is what `?q=` searches.
- description (string or null, optional): Invoice-line text template, copied verbatim onto the customer subscription's line and resolved only when that line is invoiced. Placeholder tokens survive the copy unresolved: {{$domain}}, {{$period}}, {{$product}}, {{$customer}}, {{$site}}, {{$server}}, plus the Dutch aliases {{$domein}}, {{$periode}} and {{$klant}}.
- quantity (integer ≥ 1, optional): Number of units the template line carries. Whole units: this is an integer, not the fractional quantity an invoice row uses.
- default_purchase_price (decimal (2 dp) -99999999.99 to 99999999.99, optional): Purchase price per unit, excluding VAT, copied onto a new customer subscription's line. At least -99999999.99. At most 99999999.99.
- default_sales_price (decimal (2 dp) -99999999.99 to 99999999.99, optional): Sales price per unit, excluding VAT, copied onto a new customer subscription's line. This is what eventually bills. At least -99999999.99. At most 99999999.99.
- vat_rate (integer 0 to 100, optional): VAT percentage as a whole number: 21 means 21%.
- subscribable_type (string or null, optional): The record this template line sells, normally a subscription product. Null on a line that sells nothing in particular, and a bare {"id": N} reference with `subscribable_type` of `domain` or `server` on a line pointed at a hosting record, which only plnnrly itself can do. Expanding it with `?include=subscribable` additionally requires `subscription_products` read permission and a token scope covering that prefix. Required when subscribable_id is present.
- subscribable_id (integer or null → SubscriptionProduct.id, optional): The record this template line sells, normally a subscription product. Null on a line that sells nothing in particular, and a bare {"id": N} reference with `subscribable_type` of `domain` or `server` on a line pointed at a hosting record, which only plnnrly itself can do. Expanding it with `?include=subscribable` additionally requires `subscription_products` read permission and a token scope covering that prefix. Required when subscribable_type is present.

Unknown keys are refused with `422` validation-failed, naming the key.

## Response 200
- id (integer, required): Unique identifier.
- subscription_type_id (integer, required, server-assigned): The subscription type this template line belongs to. Taken from the path on create and never writable afterwards: a line cannot be moved to another type.
- subscription_type (Ref or SubscriptionTypeSummary, required): The subscription type this template line belongs to.
- subscribable_type (string or null, required): The kind of record `subscribable` points at; it says which branch of `subscribable` applies.
- subscribable_id (integer or null, required): The id of the record `subscribable` points at.
- subscribable (Ref or SubscriptionProductSummary or null, required): The record this template line sells, normally a subscription product. Null on a line that sells nothing in particular, and a bare {"id": N} reference with `subscribable_type` of `domain` or `server` on a line pointed at a hosting record, which only plnnrly itself can do. Expanding it with `?include=subscribable` additionally requires `subscription_products` read permission and a token scope covering that prefix.
- name (string or null ≤ 255, required): Optional label for the template line. plnnrly's form does not show it, so most existing lines carry `null`; it exists for programmatic naming and is what `?q=` searches.
- description (string or null, required, multiline): Invoice-line text template, copied verbatim onto the customer subscription's line and resolved only when that line is invoiced. Placeholder tokens survive the copy unresolved: {{$domain}}, {{$period}}, {{$product}}, {{$customer}}, {{$site}}, {{$server}}, plus the Dutch aliases {{$domein}}, {{$periode}} and {{$klant}}.
- quantity (integer, required): Number of units the template line carries. Whole units: this is an integer, not the fractional quantity an invoice row uses.
- default_purchase_price (decimal (2 dp), required): Purchase price per unit, excluding VAT, copied onto a new customer subscription's line.
- default_sales_price (decimal (2 dp), required): Sales price per unit, excluding VAT, copied onto a new customer subscription's line. This is what eventually bills.
- vat_rate (integer, required): VAT percentage as a whole number: 21 means 21%.
- sort_order (integer, required, server-assigned): Position of the line within its subscription type, and the default sort key. Assigned on create; there is no way to reorder template lines through the API.
- created_at (timestamp (YYYY-MM-DDThh:mm:ssZ), required): Creation timestamp.
- updated_at (timestamp (YYYY-MM-DDThh:mm:ssZ), required): Last-write timestamp; use for incremental sync.
- deleted_at (timestamp (YYYY-MM-DDThh:mm:ssZ) or null, required): Soft-delete timestamp, `null` while live.
- links (SubscriptionTypeItemLinks, required)
  - self (url, required): The canonical URI of this record.

## Errors
- 403 forbidden-by-policy | insufficient-permission | insufficient-token-scope: Forbidden.
- 412 precondition-failed: Precondition failed.
- 415 unsupported-media-type: Unsupported media type.
- 422 unprocessable-relationship | validation-failed: Unprocessable content.
- 400 idempotency-key-required | invalid-cursor | invalid-query-parameter | malformed-request | unsupported-parameter: Bad request.
- 401 token-expired | unauthenticated: Unauthenticated.
- 404 endpoint-not-found | resource-not-found: Not found.
- 406 not-acceptable: Not acceptable.
- 429 rate-limit-exceeded: Too many requests.
- 500 internal-error: Server error.
- 503 tenant-unavailable: Service unavailable.

## Example
```bash
curl -X PATCH \
  'https://<your-url>/api/v2/subscription-type-items/1' \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'If-Match: *' \
  -d '{
    "default_sales_price": "34.95"
  }'
```
