Batch upsert Listings
curl --request POST \
--url https://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"listings": [
{
"title": "<string>",
"description": "<string>",
"allowedAiIds": [
"<string>"
],
"category": "<string>",
"tags": [
"<string>"
],
"media": [
{}
],
"pricing": {
"currency": "<string>",
"amountMinor": 1,
"minimumAmountMinor": 1,
"maximumAmountMinor": 1,
"unit": "<string>",
"interval": "<string>"
},
"availability": {},
"capacity": {},
"attributes": {},
"preferredDealTemplateKey": "<string>",
"supportedDealTemplateKeys": [
"<string>"
],
"sourceId": "<string>",
"externalRef": "<string>",
"variants": [
{
"id": "<string>",
"title": "<string>",
"externalRef": "<string>",
"sku": "<string>",
"options": {},
"pricing": {},
"availability": {},
"inventory": {},
"attributes": {}
}
]
}
]
}
'import requests
url = "https://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert"
payload = { "listings": [
{
"title": "<string>",
"description": "<string>",
"allowedAiIds": ["<string>"],
"category": "<string>",
"tags": ["<string>"],
"media": [{}],
"pricing": {
"currency": "<string>",
"amountMinor": 1,
"minimumAmountMinor": 1,
"maximumAmountMinor": 1,
"unit": "<string>",
"interval": "<string>"
},
"availability": {},
"capacity": {},
"attributes": {},
"preferredDealTemplateKey": "<string>",
"supportedDealTemplateKeys": ["<string>"],
"sourceId": "<string>",
"externalRef": "<string>",
"variants": [
{
"id": "<string>",
"title": "<string>",
"externalRef": "<string>",
"sku": "<string>",
"options": {},
"pricing": {},
"availability": {},
"inventory": {},
"attributes": {}
}
]
}
] }
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({
listings: [
{
title: '<string>',
description: '<string>',
allowedAiIds: ['<string>'],
category: '<string>',
tags: ['<string>'],
media: [{}],
pricing: {
currency: '<string>',
amountMinor: 1,
minimumAmountMinor: 1,
maximumAmountMinor: 1,
unit: '<string>',
interval: '<string>'
},
availability: {},
capacity: {},
attributes: {},
preferredDealTemplateKey: '<string>',
supportedDealTemplateKeys: ['<string>'],
sourceId: '<string>',
externalRef: '<string>',
variants: [
{
id: '<string>',
title: '<string>',
externalRef: '<string>',
sku: '<string>',
options: {},
pricing: {},
availability: {},
inventory: {},
attributes: {}
}
]
}
]
})
};
fetch('https://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert', 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.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert",
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([
'listings' => [
[
'title' => '<string>',
'description' => '<string>',
'allowedAiIds' => [
'<string>'
],
'category' => '<string>',
'tags' => [
'<string>'
],
'media' => [
[
]
],
'pricing' => [
'currency' => '<string>',
'amountMinor' => 1,
'minimumAmountMinor' => 1,
'maximumAmountMinor' => 1,
'unit' => '<string>',
'interval' => '<string>'
],
'availability' => [
],
'capacity' => [
],
'attributes' => [
],
'preferredDealTemplateKey' => '<string>',
'supportedDealTemplateKeys' => [
'<string>'
],
'sourceId' => '<string>',
'externalRef' => '<string>',
'variants' => [
[
'id' => '<string>',
'title' => '<string>',
'externalRef' => '<string>',
'sku' => '<string>',
'options' => [
],
'pricing' => [
],
'availability' => [
],
'inventory' => [
],
'attributes' => [
]
]
]
]
]
]),
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://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert"
payload := strings.NewReader("{\n \"listings\": [\n {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"allowedAiIds\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"media\": [\n {}\n ],\n \"pricing\": {\n \"currency\": \"<string>\",\n \"amountMinor\": 1,\n \"minimumAmountMinor\": 1,\n \"maximumAmountMinor\": 1,\n \"unit\": \"<string>\",\n \"interval\": \"<string>\"\n },\n \"availability\": {},\n \"capacity\": {},\n \"attributes\": {},\n \"preferredDealTemplateKey\": \"<string>\",\n \"supportedDealTemplateKeys\": [\n \"<string>\"\n ],\n \"sourceId\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"variants\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"sku\": \"<string>\",\n \"options\": {},\n \"pricing\": {},\n \"availability\": {},\n \"inventory\": {},\n \"attributes\": {}\n }\n ]\n }\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://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"listings\": [\n {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"allowedAiIds\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"media\": [\n {}\n ],\n \"pricing\": {\n \"currency\": \"<string>\",\n \"amountMinor\": 1,\n \"minimumAmountMinor\": 1,\n \"maximumAmountMinor\": 1,\n \"unit\": \"<string>\",\n \"interval\": \"<string>\"\n },\n \"availability\": {},\n \"capacity\": {},\n \"attributes\": {},\n \"preferredDealTemplateKey\": \"<string>\",\n \"supportedDealTemplateKeys\": [\n \"<string>\"\n ],\n \"sourceId\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"variants\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"sku\": \"<string>\",\n \"options\": {},\n \"pricing\": {},\n \"availability\": {},\n \"inventory\": {},\n \"attributes\": {}\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert")
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 \"listings\": [\n {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"allowedAiIds\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"media\": [\n {}\n ],\n \"pricing\": {\n \"currency\": \"<string>\",\n \"amountMinor\": 1,\n \"minimumAmountMinor\": 1,\n \"maximumAmountMinor\": 1,\n \"unit\": \"<string>\",\n \"interval\": \"<string>\"\n },\n \"availability\": {},\n \"capacity\": {},\n \"attributes\": {},\n \"preferredDealTemplateKey\": \"<string>\",\n \"supportedDealTemplateKeys\": [\n \"<string>\"\n ],\n \"sourceId\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"variants\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"sku\": \"<string>\",\n \"options\": {},\n \"pricing\": {},\n \"availability\": {},\n \"inventory\": {},\n \"attributes\": {}\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{}
]
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Product API · Listings
Batch upsert Listings
Upserts at most 100 Listings by sourceId and externalRef.
POST
/
ais
/
{aiId}
/
listings
/
batch-upsert
Batch upsert Listings
curl --request POST \
--url https://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"listings": [
{
"title": "<string>",
"description": "<string>",
"allowedAiIds": [
"<string>"
],
"category": "<string>",
"tags": [
"<string>"
],
"media": [
{}
],
"pricing": {
"currency": "<string>",
"amountMinor": 1,
"minimumAmountMinor": 1,
"maximumAmountMinor": 1,
"unit": "<string>",
"interval": "<string>"
},
"availability": {},
"capacity": {},
"attributes": {},
"preferredDealTemplateKey": "<string>",
"supportedDealTemplateKeys": [
"<string>"
],
"sourceId": "<string>",
"externalRef": "<string>",
"variants": [
{
"id": "<string>",
"title": "<string>",
"externalRef": "<string>",
"sku": "<string>",
"options": {},
"pricing": {},
"availability": {},
"inventory": {},
"attributes": {}
}
]
}
]
}
'import requests
url = "https://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert"
payload = { "listings": [
{
"title": "<string>",
"description": "<string>",
"allowedAiIds": ["<string>"],
"category": "<string>",
"tags": ["<string>"],
"media": [{}],
"pricing": {
"currency": "<string>",
"amountMinor": 1,
"minimumAmountMinor": 1,
"maximumAmountMinor": 1,
"unit": "<string>",
"interval": "<string>"
},
"availability": {},
"capacity": {},
"attributes": {},
"preferredDealTemplateKey": "<string>",
"supportedDealTemplateKeys": ["<string>"],
"sourceId": "<string>",
"externalRef": "<string>",
"variants": [
{
"id": "<string>",
"title": "<string>",
"externalRef": "<string>",
"sku": "<string>",
"options": {},
"pricing": {},
"availability": {},
"inventory": {},
"attributes": {}
}
]
}
] }
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({
listings: [
{
title: '<string>',
description: '<string>',
allowedAiIds: ['<string>'],
category: '<string>',
tags: ['<string>'],
media: [{}],
pricing: {
currency: '<string>',
amountMinor: 1,
minimumAmountMinor: 1,
maximumAmountMinor: 1,
unit: '<string>',
interval: '<string>'
},
availability: {},
capacity: {},
attributes: {},
preferredDealTemplateKey: '<string>',
supportedDealTemplateKeys: ['<string>'],
sourceId: '<string>',
externalRef: '<string>',
variants: [
{
id: '<string>',
title: '<string>',
externalRef: '<string>',
sku: '<string>',
options: {},
pricing: {},
availability: {},
inventory: {},
attributes: {}
}
]
}
]
})
};
fetch('https://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert', 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.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert",
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([
'listings' => [
[
'title' => '<string>',
'description' => '<string>',
'allowedAiIds' => [
'<string>'
],
'category' => '<string>',
'tags' => [
'<string>'
],
'media' => [
[
]
],
'pricing' => [
'currency' => '<string>',
'amountMinor' => 1,
'minimumAmountMinor' => 1,
'maximumAmountMinor' => 1,
'unit' => '<string>',
'interval' => '<string>'
],
'availability' => [
],
'capacity' => [
],
'attributes' => [
],
'preferredDealTemplateKey' => '<string>',
'supportedDealTemplateKeys' => [
'<string>'
],
'sourceId' => '<string>',
'externalRef' => '<string>',
'variants' => [
[
'id' => '<string>',
'title' => '<string>',
'externalRef' => '<string>',
'sku' => '<string>',
'options' => [
],
'pricing' => [
],
'availability' => [
],
'inventory' => [
],
'attributes' => [
]
]
]
]
]
]),
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://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert"
payload := strings.NewReader("{\n \"listings\": [\n {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"allowedAiIds\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"media\": [\n {}\n ],\n \"pricing\": {\n \"currency\": \"<string>\",\n \"amountMinor\": 1,\n \"minimumAmountMinor\": 1,\n \"maximumAmountMinor\": 1,\n \"unit\": \"<string>\",\n \"interval\": \"<string>\"\n },\n \"availability\": {},\n \"capacity\": {},\n \"attributes\": {},\n \"preferredDealTemplateKey\": \"<string>\",\n \"supportedDealTemplateKeys\": [\n \"<string>\"\n ],\n \"sourceId\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"variants\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"sku\": \"<string>\",\n \"options\": {},\n \"pricing\": {},\n \"availability\": {},\n \"inventory\": {},\n \"attributes\": {}\n }\n ]\n }\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://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"listings\": [\n {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"allowedAiIds\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"media\": [\n {}\n ],\n \"pricing\": {\n \"currency\": \"<string>\",\n \"amountMinor\": 1,\n \"minimumAmountMinor\": 1,\n \"maximumAmountMinor\": 1,\n \"unit\": \"<string>\",\n \"interval\": \"<string>\"\n },\n \"availability\": {},\n \"capacity\": {},\n \"attributes\": {},\n \"preferredDealTemplateKey\": \"<string>\",\n \"supportedDealTemplateKeys\": [\n \"<string>\"\n ],\n \"sourceId\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"variants\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"sku\": \"<string>\",\n \"options\": {},\n \"pricing\": {},\n \"availability\": {},\n \"inventory\": {},\n \"attributes\": {}\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.darwin.so/api/v1/ais/{aiId}/listings/batch-upsert")
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 \"listings\": [\n {\n \"title\": \"<string>\",\n \"description\": \"<string>\",\n \"allowedAiIds\": [\n \"<string>\"\n ],\n \"category\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"media\": [\n {}\n ],\n \"pricing\": {\n \"currency\": \"<string>\",\n \"amountMinor\": 1,\n \"minimumAmountMinor\": 1,\n \"maximumAmountMinor\": 1,\n \"unit\": \"<string>\",\n \"interval\": \"<string>\"\n },\n \"availability\": {},\n \"capacity\": {},\n \"attributes\": {},\n \"preferredDealTemplateKey\": \"<string>\",\n \"supportedDealTemplateKeys\": [\n \"<string>\"\n ],\n \"sourceId\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"variants\": [\n {\n \"id\": \"<string>\",\n \"title\": \"<string>\",\n \"externalRef\": \"<string>\",\n \"sku\": \"<string>\",\n \"options\": {},\n \"pricing\": {},\n \"availability\": {},\n \"inventory\": {},\n \"attributes\": {}\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{}
]
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Authorizations
Darwin API keys begin with darwin_ and are created in Developer settings.
Path Parameters
Body
application/json
Required array length:
1 - 100 elementsShow child attributes
Show child attributes
Response
Per-record create or update results.
⌘I