---
title: "Replace Deal Line Items"
method: PUT
path: "/deals/{deal_id}/line-items"
tags: ["Deals"]
---

# Replace Deal Line Items

`PUT /deals/{deal_id}/line-items`

## Request

- Base URL: `https://be.graph8.com/api/v1`
- URL: `https://be.graph8.com/api/v1/deals/{deal_id}/line-items`
- Auth: HTTP bearer

Replace a deal's line items. The FULL set, not a delta.

A non-empty set makes the deal amount the sum of the lines (audited in the
deal history). An empty set clears the lines and keeps the typed amount.

## Path parameters

- `deal_id` string, required: Deal id.

## Headers

- `Authorization` string, nullable
- `X-Target-Org-Id` string, nullable

## Request body

- DealLineItemsReplaceBody: The FULL desired set of line items. An empty list clears them.
  - `line_items` DealLineItemWrite[]
    - `stripe_product_id` string, nullable: Catalog product id, when catalog-backed.
    - `stripe_price_id` string, nullable: Catalog price id, when catalog-backed.
    - `manual_product_id` string, nullable: Id of a manually-defined product.
    - `product_name` string, required
    - `description` string, nullable
    - `quantity` integer
    - `unit_amount` integer, required: Unit price in cents.
    - `discount_pct` number
    - `billing_frequency` string, nullable
    - `sort_order` integer

## Response `200`

Successful Response

- ApiResponseDealLineItemsPayload
  - `data` DealLineItemsPayload, required: A deal's line items with its derived amount and quote-mismatch flag. `amount` and `linked_quote_total` are in DOLLARS (the deal's own unit); line-item money is in cents. `amount_mismatch` is true when the deal amount and its most authoritative linked quote disagree by more than half a cent.
    - `deal_id` string, required
    - `amount` number, nullable
    - `currency` string, nullable
    - `line_items` DealLineItemRecord[]
      - `id` string, required
      - `stripe_product_id` string, nullable
      - `stripe_price_id` string, nullable
      - `manual_product_id` string, nullable
      - `product_name` string, required
      - `description` string, nullable
      - `quantity` integer, required
      - `unit_amount` integer, required
      - `discount_pct` number, required
      - `line_total` integer, required
      - `billing_frequency` string, nullable
      - `sort_order` integer, required
    - `linked_quote_total` number, nullable
    - `amount_mismatch` boolean
  - `pagination` PaginationMeta
    - `page` integer, required: Current page number (1-indexed)
    - `limit` integer, required: Items per page
    - `total` integer, required: Total number of items
    - `has_next` boolean, required: Whether there are more pages
    - `next_cursor` string, nullable: Opaque cursor for the next page; null when there are no more items. Pass it back as the `cursor` query param to fetch the following page without computing page numbers.
    - `total_available` integer, nullable: Search endpoints only: how many records really match, when known. Can be larger than `total`, which is capped at the 10,000 results that can be paged. For company search this is a distinct-company estimate. Null when unknown; absent outside search.
    - `total_is_lower_bound` boolean, nullable: Search endpoints only: true when more records match than `total` shows (the result set is larger than the 10,000 results that can be paged). Absent outside search.
    - `notes` string[], nullable: Search endpoints only: plain-language notes about the result, e.g. that more records match than can be paged, or that a reversed `between` range was put in order.

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/graph8/apis/graph8-developer-api.md) · [All operations](https://skmtc.dev/graph8/apis/graph8-developer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/graph8/apis/graph8-developer-api/revisions/2e7cfa0ca921?raw)
