Skip to main content
PUT
/
products
/
{id}
Update Product
curl --request PUT \
  --url https://api.loopreturns.com/api/v1/products/{id} \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: <api-key>' \
  --data '
{
  "sales_channel": "<string>",
  "name": "<string>",
  "source": "<string>",
  "external_id": "<string>",
  "sku": "<string>",
  "weight_grams": 123,
  "barcode": "<string>",
  "description": "<string>",
  "type": "<string>",
  "vendor": "<string>",
  "price": {
    "amount": 50000,
    "currency_code": "USD"
  },
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "options": [
    {
      "position": 123,
      "values": [
        "<string>"
      ],
      "name": "<string>"
    }
  ],
  "images": [
    "<string>"
  ],
  "tags": [
    "<string>"
  ],
  "is_gift_card": true
}
'
import requests

url = "https://api.loopreturns.com/api/v1/products/{id}"

payload = {
"sales_channel": "<string>",
"name": "<string>",
"source": "<string>",
"external_id": "<string>",
"sku": "<string>",
"weight_grams": 123,
"barcode": "<string>",
"description": "<string>",
"type": "<string>",
"vendor": "<string>",
"price": {
"amount": 50000,
"currency_code": "USD"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"options": [
{
"position": 123,
"values": ["<string>"],
"name": "<string>"
}
],
"images": ["<string>"],
"tags": ["<string>"],
"is_gift_card": True
}
headers = {
"X-Authorization": "<api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PUT',
headers: {'X-Authorization': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sales_channel: '<string>',
name: '<string>',
source: '<string>',
external_id: '<string>',
sku: '<string>',
weight_grams: 123,
barcode: '<string>',
description: '<string>',
type: '<string>',
vendor: '<string>',
price: {amount: 50000, currency_code: 'USD'},
created_at: '2023-11-07T05:31:56Z',
updated_at: '2023-11-07T05:31:56Z',
options: [{position: 123, values: ['<string>'], name: '<string>'}],
images: ['<string>'],
tags: ['<string>'],
is_gift_card: true
})
};

fetch('https://api.loopreturns.com/api/v1/products/{id}', 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://api.loopreturns.com/api/v1/products/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'sales_channel' => '<string>',
'name' => '<string>',
'source' => '<string>',
'external_id' => '<string>',
'sku' => '<string>',
'weight_grams' => 123,
'barcode' => '<string>',
'description' => '<string>',
'type' => '<string>',
'vendor' => '<string>',
'price' => [
'amount' => 50000,
'currency_code' => 'USD'
],
'created_at' => '2023-11-07T05:31:56Z',
'updated_at' => '2023-11-07T05:31:56Z',
'options' => [
[
'position' => 123,
'values' => [
'<string>'
],
'name' => '<string>'
]
],
'images' => [
'<string>'
],
'tags' => [
'<string>'
],
'is_gift_card' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Authorization: <api-key>"
],
]);

$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://api.loopreturns.com/api/v1/products/{id}"

payload := strings.NewReader("{\n \"sales_channel\": \"<string>\",\n \"name\": \"<string>\",\n \"source\": \"<string>\",\n \"external_id\": \"<string>\",\n \"sku\": \"<string>\",\n \"weight_grams\": 123,\n \"barcode\": \"<string>\",\n \"description\": \"<string>\",\n \"type\": \"<string>\",\n \"vendor\": \"<string>\",\n \"price\": {\n \"amount\": 50000,\n \"currency_code\": \"USD\"\n },\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"options\": [\n {\n \"position\": 123,\n \"values\": [\n \"<string>\"\n ],\n \"name\": \"<string>\"\n }\n ],\n \"images\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"is_gift_card\": true\n}")

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

req.Header.Add("X-Authorization", "<api-key>")
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.put("https://api.loopreturns.com/api/v1/products/{id}")
.header("X-Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"sales_channel\": \"<string>\",\n \"name\": \"<string>\",\n \"source\": \"<string>\",\n \"external_id\": \"<string>\",\n \"sku\": \"<string>\",\n \"weight_grams\": 123,\n \"barcode\": \"<string>\",\n \"description\": \"<string>\",\n \"type\": \"<string>\",\n \"vendor\": \"<string>\",\n \"price\": {\n \"amount\": 50000,\n \"currency_code\": \"USD\"\n },\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"options\": [\n {\n \"position\": 123,\n \"values\": [\n \"<string>\"\n ],\n \"name\": \"<string>\"\n }\n ],\n \"images\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"is_gift_card\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.loopreturns.com/api/v1/products/{id}")

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

request = Net::HTTP::Put.new(url)
request["X-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sales_channel\": \"<string>\",\n \"name\": \"<string>\",\n \"source\": \"<string>\",\n \"external_id\": \"<string>\",\n \"sku\": \"<string>\",\n \"weight_grams\": 123,\n \"barcode\": \"<string>\",\n \"description\": \"<string>\",\n \"type\": \"<string>\",\n \"vendor\": \"<string>\",\n \"price\": {\n \"amount\": 50000,\n \"currency_code\": \"USD\"\n },\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\",\n \"options\": [\n {\n \"position\": 123,\n \"values\": [\n \"<string>\"\n ],\n \"name\": \"<string>\"\n }\n ],\n \"images\": [\n \"<string>\"\n ],\n \"tags\": [\n \"<string>\"\n ],\n \"is_gift_card\": true\n}"

response = http.request(request)
puts response.read_body
{
  "product": {
    "id": 2,
    "external_id": "<string>",
    "sales_channel": "<string>",
    "sku": "<string>",
    "name": "<string>",
    "weight_grams": 123,
    "barcode": "<string>",
    "description": "<string>",
    "type": "<string>",
    "vendor": "<string>",
    "price": {
      "amount": 50000,
      "currency_code": "USD"
    },
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "collections": [
      {
        "id": 2,
        "external_id": "<string>",
        "name": "<string>"
      }
    ],
    "options": [
      {
        "position": 123,
        "values": [
          "<string>"
        ],
        "name": "<string>"
      }
    ],
    "images": [
      "<string>"
    ],
    "tags": [
      "<string>"
    ],
    "source": "<string>",
    "default_variant_id": 123
  }
}
{
"errors": "<string>"
}
{
"message": "<string>"
}

Authorizations

X-Authorization
string
header
required

API Scope: "Product (write)"

Path Parameters

id
integer
required

The product's unique identifier.

Body

application/json
sales_channel
string
required

If a channel with this name is not already associated with the shop, it will be used to create a new channel.

Maximum string length: 255
name
string
Maximum string length: 255
source
string | null
Maximum string length: 255
external_id
string | null

The provided external_id must be unique. If a non-unique external_id is provided, the API will respond with an error.

Maximum string length: 100
Example:

"564400c7-7a6b-4f29-b6a5-7bb580b2992c"

sku
string | null
Maximum string length: 255
Example:

"SHOES-US44-M-Brwn"

weight_grams
integer | null

The weight of the product in grams.

Example:

440

barcode
string | null

The barcode of the product.

Maximum string length: 255
Example:

712345000019

description
string | null
Maximum string length: 65000
type
string | null
Maximum string length: 255
vendor
string | null
Maximum string length: 255
price
object | null

The price of the product in minor units, such as cents, with its corresponding currency.

Example:
{ "amount": 50000, "currency_code": "USD" }
created_at
string<date-time> | null
Example:

"2023-04-25T13:25:00-05:00"

updated_at
string<date-time> | null

The value must be equal to or greater than created_at.

Example:

"2023-04-25T13:45:00-05:00"

options
ProductOption · object[] | null

The provided array will overwrite the existing set of options.

images
string<uri>[] | null

The provided array will overwrite the existing set of images.

Minimum string length: 1
tags
string[] | null

The provided array will overwrite the existing set of tags.

Required string length: 1 - 255
is_gift_card
boolean | null

Whether the product is a gift card.

Example:

false

Response

OK

product
ProductResponse · object