Skip to main content
POST
/
v1
/
line_items
/
upsell
Upsell
curl --request POST \
  --url https://{defaultHost}/v1/line_items/upsell \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "line_item": {
    "price": "aa992aa6-ae1f-4938-872f-2e2761c45c64",
    "checkout": "10ede241-c96d-4a8d-b972-b9c7a6b5c0f2",
    "upsell": "fc28854d-b65a-4aa4-9404-76189e2357a9"
  }
}
'
import requests

url = "https://{defaultHost}/v1/line_items/upsell"

payload = { "line_item": {
"price": "aa992aa6-ae1f-4938-872f-2e2761c45c64",
"checkout": "10ede241-c96d-4a8d-b972-b9c7a6b5c0f2",
"upsell": "fc28854d-b65a-4aa4-9404-76189e2357a9"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
line_item: {
price: 'aa992aa6-ae1f-4938-872f-2e2761c45c64',
checkout: '10ede241-c96d-4a8d-b972-b9c7a6b5c0f2',
upsell: 'fc28854d-b65a-4aa4-9404-76189e2357a9'
}
})
};

fetch('https://{defaultHost}/v1/line_items/upsell', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{defaultHost}/v1/line_items/upsell",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'line_item' => [
'price' => 'aa992aa6-ae1f-4938-872f-2e2761c45c64',
'checkout' => '10ede241-c96d-4a8d-b972-b9c7a6b5c0f2',
'upsell' => 'fc28854d-b65a-4aa4-9404-76189e2357a9'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{defaultHost}/v1/line_items/upsell"

payload := strings.NewReader("{\n \"line_item\": {\n \"price\": \"aa992aa6-ae1f-4938-872f-2e2761c45c64\",\n \"checkout\": \"10ede241-c96d-4a8d-b972-b9c7a6b5c0f2\",\n \"upsell\": \"fc28854d-b65a-4aa4-9404-76189e2357a9\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://{defaultHost}/v1/line_items/upsell")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"line_item\": {\n \"price\": \"aa992aa6-ae1f-4938-872f-2e2761c45c64\",\n \"checkout\": \"10ede241-c96d-4a8d-b972-b9c7a6b5c0f2\",\n \"upsell\": \"fc28854d-b65a-4aa4-9404-76189e2357a9\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{defaultHost}/v1/line_items/upsell")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"line_item\": {\n \"price\": \"aa992aa6-ae1f-4938-872f-2e2761c45c64\",\n \"checkout\": \"10ede241-c96d-4a8d-b972-b9c7a6b5c0f2\",\n \"upsell\": \"fc28854d-b65a-4aa4-9404-76189e2357a9\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "id": "a9b8f781-f951-42d0-8bf6-6cc40f7cf150",
  "object": "line_item",
  "ad_hoc_amount": null,
  "discount_amount": 0,
  "fees_amount": -500,
  "full_amount": 2400,
  "fulfilled_quantity": 0,
  "locked": false,
  "note": null,
  "purchasable_status": "purchasable",
  "quantity": 1,
  "g_weight": 0,
  "scratch_amount": 2900,
  "stock_held": true,
  "subtotal_amount": 2900,
  "tax_amount": 0,
  "tax_rate": 0,
  "total_amount": 2400,
  "total_savings_amount": -500,
  "trial": false,
  "trial_amount": 0,
  "unit_dimensions_cm": null,
  "unit_g_weight": 0,
  "variant_options": null,
  "variant_option_names": null,
  "bump": null,
  "checkout": "10ede241-c96d-4a8d-b972-b9c7a6b5c0f2",
  "price": "aa992aa6-ae1f-4938-872f-2e2761c45c64",
  "upsell": "fc28854d-b65a-4aa4-9404-76189e2357a9",
  "variant": null,
  "swap": null,
  "component_line_item": false,
  "bundle_component_variants": {},
  "bundle_line_item": null,
  "created_at": 1782485847,
  "updated_at": 1782485847
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

preview
boolean

Whether or not the endpoint should return a preview of the result. If true, no modifications to the resource will be saved.

Body

application/json
line_item
object

Response

200 - application/json

Success

id
string | null

The UUID of the specific object.

object
string

A string describing the object type returned.

ad_hoc_amount
integer | null

The amount to use for this line item when the associated price is ad_hoc=true.

bundle_component_variants
object

A hash mapping bundle component product UUIDs (keys) to the selected variant UUIDs (values) for each component.

quantity
integer

The quantity of products being purchased.

note
string | null

A custom note for this line item. Useful for adding context or special instructions related to the product or purchase.

bump

Expandable – The associated bump ID.

bundle_line_item

Expandable – The associated bundle line item ID.

checkout

Expandable – The associated checkout ID.

checkout_fees_amount
integer

The total amount of checkout fees applied to this line item.

component_line_item
boolean

Whether or not this line item is a component of a bundle.

position
integer | null

The position of this line item. For bundle component line items, this mirrors the source bundle item's position so components render in a stable order across cart, checkout, and order payloads.

discount_amount
integer

Total discount amount applied to this line item.

fees

Expandable – Property not returned unless expanded.

fees_amount
integer

The total amount of fees applied to this line item.

full_amount
integer

The full amount to be charged across all periods.

fulfilled_quantity
integer

The quantity of products that have been fulfilled.

g_weight
number

Total weight of all items (quantity * unit_g_weight) in grams.

locked
boolean

Whether or not this line item is locked. If locked, it cannot be edited or deleted. Line items are locked when an invoice is opened.

price

Expandable – The associated price ID.

purchasable_status
string

The status indicating if this line item can be purchased (finalized with) or not and why. Possible values are price_gone, price_old_version, variant_mising, variant_gone, variant_old_version, out_of_stock, exceeds_purchase_limit, or purchasable.

scratch_amount
integer

The amount in cents that should be shown as the original amount before any price reductions, also known as the pre-sale price.

stock_held
boolean

Whether or not stock is being held for this line item. (This only applies to the quantity that has not been fulfilled.)

subtotal_amount
integer

Total before any discounts or taxes are applied.

swap

Expandable – The associated swap ID.

tax_amount
integer

Total tax amount.

tax_rate
number

The tax rate for this line item.

total_amount
integer

Total after discounts and taxes are applied.

total_savings_amount
integer

The total amount in cents that was saved on this line item taking into account all negative fees, discounts, and all price scratch_amount values.

trial
boolean

Set to true if this line item is for a price that has a trial.

trial_amount
integer

The total amount in cents that is removed from this line item due to a trial period.

unit_dimensions_cm
object | null

The physical dimensions of this line item's product/variant in centimeters.

unit_g_weight
number

The weight per unit of product in grams.

upsell

Expandable – The associated upsell ID.

variant

Expandable – The associated variant ID.

variant_options
array | null

An array of the associated variant's options.

variant_option_names
array | null

An array of the associated product's variant option names.

created_at
integer | null

Time at which the object was created. Measured in seconds since the Unix epoch.

updated_at
integer | null

Time at which the object was last updated. Measured in seconds since the Unix epoch.