Update a product line

Operation ID: updateAccountingProductLine

Group: Accounting › Products › Product Lines

Open in the interactive reference

PATCH /accounting/products/{id}/product-lines/{productLineId}

Retry-safe: A write that accepts Idempotency-Key: repeating a request with the same key replays the stored answer instead of executing twice.

Updates a product line with the fields you send. A field you leave out keeps its current value, except productLineTaxes and name. Leaving out productLineTaxes removes every tax record, and leaving out name replaces the name with one generated from the lineType.

Use the product line's id, not its productLineNumber.

A productLineTaxes list you send replaces the whole list, so include every tax record you want to keep.

You can't change lineType or pricing with this endpoint. To change pricing, use the pricing endpoints under accounting/products/:id/product-lines/:productLineId/pricing. To change lineType, delete the product line and add a new one.

A paired 'usage' line is updated with its own id, like any other product line. Its priceModel ('rateCard'), unitOfMeasure, pricingTerm and invoiceFrequency are fixed: a different value fails with VALIDATION_FAILED.

Changing a 'recurring' line's priceModel to 'thresholdBased' also creates a paired 'usage' line without pricing. Add its pricing with the pricing endpoints under accounting/products/:id/product-lines/:productLineId/pricing, using the 'usage' line's id. To find it, use POST accounting/product-lines/search with filters.parentProductLineId set to the parent line's id.

The response is empty. Read the updated record with GET accounting/product-lines/:id.

Parameters

Name In Type Required Description
Api-Version header string · v1 yes The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version v1.
Idempotency-Key header string no An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with 400 IDEMPOTENCY_NOT_SUPPORTED rather than silently ignored.
id path string yes The unique identifier of the product the product line belongs to.
productLineId path string yes The unique identifier of the product line you want to update.

Request body

Required, application/json: updateAccountingProductLineInput.

Field Type Required Description
priceModel string no How the product line is priced. Accepted values: 'flat', 'perUnit', 'tiered', 'volume', 'stairstep', 'rateCard', 'thresholdBased'. Omit to leave it unchanged. A value different from the current one fails with VALIDATION_FAILED when the product line has pricing, or when it has a paired 'usage' line (a 'prepaid' line, or a 'recurring' line priced 'thresholdBased').
unitOfMeasure string no The unit the product line's quantities are measured in. Accepted values: 'instance', 'gigabyte', 'terabyte', 'user', 'seat', 'minute', 'hour', 'day', 'month', 'each', 'license', 'activeUser', 'megabyte', 'message', 'text', 'platform', 'employee', 'personnel', 'credit', 'currency', 'package', 'case', 'word', 'record'.
name string no The name of the product line. If you omit name, the current name is replaced with one generated from the product line's lineType.
pricingTerm string no The pricing term of the product line. Accepted values: 'monthly', 'biMonthly', 'once', 'quarterly', 'semiAnnually', 'annually'.
enforceListPrice boolean no Whether the list price of the product line is enforced. When true, the list price comes from the price book and can't be changed on a sales order, a quote, or a subscription change. An unset value counts as true.
invoiceFrequency string no How often the product line is invoiced. Accepted values: 'monthly', 'biMonthly', 'quarterly', 'semiAnnually', 'annually', 'once', 'custom', 'template', 'milestone', 'allAtOnce', 'termEnd'.
prepaidBalanceOverConsumptionBehavior string no What happens when usage exceeds the prepaid balance. Accepted values: 'allowNegative', 'overage'. 'allowNegative' lets the balance go negative and takes the shortfall from the new prepaid amount at renewal. 'overage' stops the balance at 0 and invoices further usage at the line's overage rate.
prepaidBalanceRolloverAtRenewal boolean no Whether the remaining prepaid balance rolls over at renewal.
crmProductId string no The product line's identifier in an external CRM system.
dataSource string no The source system or import job that produced the product line. Examples: 'Salesforce', 'NetSuite', 'Stripe'.
productLineTaxes array<object> no The full set of tax records for the product line. Sending productLineTaxes replaces the whole set, so pass every record that should stay. Send an empty array to remove every record. Omitting productLineTaxes also removes every record. Any update made while your tenant has no tax provider enabled removes every record too.
productLineTaxes[].taxCode string yes The tax code, as defined by the configured tax provider.
productLineTaxes[].entityId string yes The legal entity this tax record applies under. See id on GET base/entities.
productLineTaxes[].engine string yes The tax engine that computes this tax. Accepted values: 'avalara', 'anrok', 'everestTaxEngine', 'manualTax', 'none'.
productLineTaxes[].country string no The country the tax record applies in. Format ISO 3166-1, for example 'US'.
{
  "priceModel": "<priceModel>",
  "unitOfMeasure": "<unitOfMeasure>",
  "name": "<name>",
  "pricingTerm": "<pricingTerm>",
  "enforceListPrice": true,
  "invoiceFrequency": "<invoiceFrequency>",
  "prepaidBalanceOverConsumptionBehavior": "<prepaidBalanceOverConsumptionBehavior>",
  "prepaidBalanceRolloverAtRenewal": true,
  "crmProductId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "dataSource": "<dataSource>",
  "productLineTaxes": [
    {
      "taxCode": "<taxCode>",
      "entityId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "engine": "<engine>",
      "country": "<country>"
    }
  ]
}

Response

200 Success

{
  "data": {},
  "diagnostics": [
    {
      "code": "<code>",
      "message": "<message>",
      "severity": "error",
      "path": [
        "<path>"
      ],
      "details": "<details>"
    }
  ]
}

Response headers

Errors

Code Status
INVALID_ID 400
NOT_FOUND 400
UNKNOWN_TAX_ENTITY_IDS 400
VALIDATION_FAILED 400
IDEMPOTENCY_KEY_CONFLICT 409
IDEMPOTENCY_PAYLOAD_MISMATCH 422

Statuses