1
Get an API key
Create a key in Arcade Studio under Settings → API keys, then export it.Every sample sends a
export ARCADE_API_KEY="your-api-key"
User-Agent header that names your integration and a contact. Replace it with your own; see Identify your client.2
Choose a jewelry category
A category is a type of product. List the categories and choose one whose
world is jewelry.curl --fail-with-body https://platform.arcade.ai/v1/categories/list \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{}'
import json
import os
import urllib.request
body = {}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/categories/list",
data=json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {os.environ['ARCADE_API_KEY']}",
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
method="POST",
)
with urllib.request.urlopen(request) as response:
print(json.dumps(json.load(response), indent=2))
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const response = await fetch("https://platform.arcade.ai/v1/categories/list", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = Record<string, never>;
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {};
const response = await fetch("https://platform.arcade.ai/v1/categories/list", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
)
func main() {
apiKey := os.Getenv("ARCADE_API_KEY")
if apiKey == "" {
log.Fatal("Set ARCADE_API_KEY")
}
request, err := http.NewRequest(http.MethodPost, "https://platform.arcade.ai/v1/categories/list", strings.NewReader(`{}`))
if err != nil {
log.Fatal(err)
}
request.Header.Set("Authorization", "Bearer "+apiKey)
request.Header.Set("Content-Type", "application/json")
request.Header.Set("User-Agent", "your-app/1.0 (you@example.com)")
response, err := http.DefaultClient.Do(request)
if err != nil {
log.Fatal(err)
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
log.Fatal(err)
}
if response.StatusCode >= 400 {
log.Fatalf("HTTP %s: %s", response.Status, body)
}
fmt.Println(string(body))
}
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = reqwest::blocking::Client::new()
.post("https://platform.arcade.ai/v1/categories/list")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"items": [
{
"categoryId": "8e1f5c3a-2b7d-4f0e-9a61-3c5d7b2e4f18",
"name": "Rings",
"imageUrl": "https://...",
"world": "jewelry",
"category": { "categoryId": "8e1f5c3a-2b7d-4f0e-9a61-3c5d7b2e4f18", "name": "Rings" }
},
{
"categoryId": "b52d9e07-6c1a-4e3f-8d2b-9f4a1c7e5b30",
"name": "Pendant Necklace",
"imageUrl": "https://...",
"world": "jewelry",
"category": { "categoryId": "e7c4a915-3d8b-4b62-a0f5-6d1e9c2b7a43", "name": "Necklaces" }
}
]
}
category is the group the category belongs to. Category IDs can change. Read them from categories/list; don’t hardcode them.3
Generate the piece
Call The response is a job:If the prompt clearly doesn’t fit the category, such as a necklace prompt in a ring category, the request returns
products/generate with a prompt and the categoryId. Each call makes one product.Arcade picks the product’s options, such as the metal, from your prompt. Name the ones you want. categories/get lists the options a category has.The requestId is an ID you choose; it makes the request safe to retry. See Idempotency.curl --fail-with-body https://platform.arcade.ai/v1/products/generate \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{
"requestId": "gold-ring-1",
"prompt": "A 14k yellow gold ring with a wide hammered band",
"categoryId": "8e1f5c3a-2b7d-4f0e-9a61-3c5d7b2e4f18"
}'
import json
import os
import urllib.request
body = {
"requestId": "gold-ring-1",
"prompt": "A 14k yellow gold ring with a wide hammered band",
"categoryId": "8e1f5c3a-2b7d-4f0e-9a61-3c5d7b2e4f18"
}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/products/generate",
data=json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {os.environ['ARCADE_API_KEY']}",
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
method="POST",
)
with urllib.request.urlopen(request) as response:
print(json.dumps(json.load(response), indent=2))
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const response = await fetch("https://platform.arcade.ai/v1/products/generate", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({
"requestId": "gold-ring-1",
"prompt": "A 14k yellow gold ring with a wide hammered band",
"categoryId": "8e1f5c3a-2b7d-4f0e-9a61-3c5d7b2e4f18"
}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = { requestId: string; prompt: string; categoryId: string };
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {
"requestId": "gold-ring-1",
"prompt": "A 14k yellow gold ring with a wide hammered band",
"categoryId": "8e1f5c3a-2b7d-4f0e-9a61-3c5d7b2e4f18"
};
const response = await fetch("https://platform.arcade.ai/v1/products/generate", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
)
func main() {
apiKey := os.Getenv("ARCADE_API_KEY")
if apiKey == "" {
log.Fatal("Set ARCADE_API_KEY")
}
request, err := http.NewRequest(http.MethodPost, "https://platform.arcade.ai/v1/products/generate", strings.NewReader(`{
"requestId": "gold-ring-1",
"prompt": "A 14k yellow gold ring with a wide hammered band",
"categoryId": "8e1f5c3a-2b7d-4f0e-9a61-3c5d7b2e4f18"
}`))
if err != nil {
log.Fatal(err)
}
request.Header.Set("Authorization", "Bearer "+apiKey)
request.Header.Set("Content-Type", "application/json")
request.Header.Set("User-Agent", "your-app/1.0 (you@example.com)")
response, err := http.DefaultClient.Do(request)
if err != nil {
log.Fatal(err)
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
log.Fatal(err)
}
if response.StatusCode >= 400 {
log.Fatalf("HTTP %s: %s", response.Status, body)
}
fmt.Println(string(body))
}
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = reqwest::blocking::Client::new()
.post("https://platform.arcade.ai/v1/products/generate")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({
"requestId": "gold-ring-1",
"prompt": "A 14k yellow gold ring with a wide hammered band",
"categoryId": "8e1f5c3a-2b7d-4f0e-9a61-3c5d7b2e4f18"
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"jobId": "6b0f2a9e-4c71-4d3a-9e58-2f7b1c4d8a06",
"kind": "product",
"status": "running",
"result": null,
"error": null
}
400 and no job starts. Change the prompt or the category and try again.4
Wait for the job
Call
jobs/get every 10 seconds until status is succeeded or failed. The job finishes when the product is built.curl --fail-with-body https://platform.arcade.ai/v1/jobs/get \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{ "jobId": "6b0f2a9e-4c71-4d3a-9e58-2f7b1c4d8a06" }'
import json
import os
import urllib.request
body = {
"jobId": "6b0f2a9e-4c71-4d3a-9e58-2f7b1c4d8a06"
}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/jobs/get",
data=json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {os.environ['ARCADE_API_KEY']}",
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
method="POST",
)
with urllib.request.urlopen(request) as response:
print(json.dumps(json.load(response), indent=2))
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const response = await fetch("https://platform.arcade.ai/v1/jobs/get", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({
"jobId": "6b0f2a9e-4c71-4d3a-9e58-2f7b1c4d8a06"
}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = { jobId: string };
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {
"jobId": "6b0f2a9e-4c71-4d3a-9e58-2f7b1c4d8a06"
};
const response = await fetch("https://platform.arcade.ai/v1/jobs/get", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
)
func main() {
apiKey := os.Getenv("ARCADE_API_KEY")
if apiKey == "" {
log.Fatal("Set ARCADE_API_KEY")
}
request, err := http.NewRequest(http.MethodPost, "https://platform.arcade.ai/v1/jobs/get", strings.NewReader(`{
"jobId": "6b0f2a9e-4c71-4d3a-9e58-2f7b1c4d8a06"
}`))
if err != nil {
log.Fatal(err)
}
request.Header.Set("Authorization", "Bearer "+apiKey)
request.Header.Set("Content-Type", "application/json")
request.Header.Set("User-Agent", "your-app/1.0 (you@example.com)")
response, err := http.DefaultClient.Do(request)
if err != nil {
log.Fatal(err)
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
log.Fatal(err)
}
if response.StatusCode >= 400 {
log.Fatalf("HTTP %s: %s", response.Status, body)
}
fmt.Println(string(body))
}
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = reqwest::blocking::Client::new()
.post("https://platform.arcade.ai/v1/jobs/get")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({
"jobId": "6b0f2a9e-4c71-4d3a-9e58-2f7b1c4d8a06"
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"jobId": "6b0f2a9e-4c71-4d3a-9e58-2f7b1c4d8a06",
"kind": "product",
"status": "succeeded",
"result": { "productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84" },
"error": null
}
result.productId is your product.If the job failed, error.message says why. One cause is that no maker can price the design. In that case, try a different metal or prompt, with a new requestId.5
Review the product
Call Among other fields, the response includes:
products/get to see the product’s images, options and price.curl --fail-with-body https://platform.arcade.ai/v1/products/get \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{ "productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84" }'
import json
import os
import urllib.request
body = {
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84"
}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/products/get",
data=json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {os.environ['ARCADE_API_KEY']}",
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
method="POST",
)
with urllib.request.urlopen(request) as response:
print(json.dumps(json.load(response), indent=2))
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const response = await fetch("https://platform.arcade.ai/v1/products/get", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84"
}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = { productId: string };
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84"
};
const response = await fetch("https://platform.arcade.ai/v1/products/get", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
)
func main() {
apiKey := os.Getenv("ARCADE_API_KEY")
if apiKey == "" {
log.Fatal("Set ARCADE_API_KEY")
}
request, err := http.NewRequest(http.MethodPost, "https://platform.arcade.ai/v1/products/get", strings.NewReader(`{
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84"
}`))
if err != nil {
log.Fatal(err)
}
request.Header.Set("Authorization", "Bearer "+apiKey)
request.Header.Set("Content-Type", "application/json")
request.Header.Set("User-Agent", "your-app/1.0 (you@example.com)")
response, err := http.DefaultClient.Do(request)
if err != nil {
log.Fatal(err)
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
log.Fatal(err)
}
if response.StatusCode >= 400 {
log.Fatalf("HTTP %s: %s", response.Status, body)
}
fmt.Println(string(body))
}
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = reqwest::blocking::Client::new()
.post("https://platform.arcade.ai/v1/products/get")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84"
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84",
"title": "14k Yellow Gold Ring",
"categoryId": "8e1f5c3a-2b7d-4f0e-9a61-3c5d7b2e4f18",
"selections": { "material": "14k Yellow Gold" },
"unitPrice": { "amount": "836.00", "currency": "USD" }
}
selections holds the options Arcade picked from your prompt. unitPrice is the price of one piece.You can’t edit a jewelry product. To change the piece, call products/generate again with a revised prompt and a new requestId.6
Get a dropshipping quote
An order for a single piece uses dropshipping, which costs credits unless the cost is waived. Get the current cost before you create the checkout.
curl --fail-with-body https://platform.arcade.ai/v1/checkouts/quoteDropshipping \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{}'
import json
import os
import urllib.request
body = {}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/checkouts/quoteDropshipping",
data=json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {os.environ['ARCADE_API_KEY']}",
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
method="POST",
)
with urllib.request.urlopen(request) as response:
print(json.dumps(json.load(response), indent=2))
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const response = await fetch("https://platform.arcade.ai/v1/checkouts/quoteDropshipping", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = Record<string, never>;
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {};
const response = await fetch("https://platform.arcade.ai/v1/checkouts/quoteDropshipping", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
)
func main() {
apiKey := os.Getenv("ARCADE_API_KEY")
if apiKey == "" {
log.Fatal("Set ARCADE_API_KEY")
}
request, err := http.NewRequest(http.MethodPost, "https://platform.arcade.ai/v1/checkouts/quoteDropshipping", strings.NewReader(`{}`))
if err != nil {
log.Fatal(err)
}
request.Header.Set("Authorization", "Bearer "+apiKey)
request.Header.Set("Content-Type", "application/json")
request.Header.Set("User-Agent", "your-app/1.0 (you@example.com)")
response, err := http.DefaultClient.Do(request)
if err != nil {
log.Fatal(err)
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
log.Fatal(err)
}
if response.StatusCode >= 400 {
log.Fatalf("HTTP %s: %s", response.Status, body)
}
fmt.Println(string(body))
}
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = reqwest::blocking::Client::new()
.post("https://platform.arcade.ai/v1/checkouts/quoteDropshipping")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"creditCost": 25,
"standardCreditCost": 25,
"revision": "3",
"waiverReason": null,
"includesDropshipping": false,
"planId": null
}
creditCost is what this order will cost you in credits. It is 0 when the cost is waived, for example when your plan includes dropshipping.7
Order it
Create a checkout with After payment,
"dropShip": true. Pass the quote’s creditCost as expectedDropshippingCreditCost and its revision, as a number, as expectedDropshippingPolicyRevision. Then open checkoutUrl to pay.curl --fail-with-body https://platform.arcade.ai/v1/checkouts/create \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{
"requestId": "gold-ring-checkout-1",
"lines": [{ "productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84", "quantity": 1 }],
"dropShip": true,
"expectedDropshippingCreditCost": 25,
"expectedDropshippingPolicyRevision": 3
}'
import json
import os
import urllib.request
body = {
"requestId": "gold-ring-checkout-1",
"lines": [
{
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84",
"quantity": 1
}
],
"dropShip": True,
"expectedDropshippingCreditCost": 25,
"expectedDropshippingPolicyRevision": 3
}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/checkouts/create",
data=json.dumps(body).encode(),
headers={
"Authorization": f"Bearer {os.environ['ARCADE_API_KEY']}",
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
method="POST",
)
with urllib.request.urlopen(request) as response:
print(json.dumps(json.load(response), indent=2))
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const response = await fetch("https://platform.arcade.ai/v1/checkouts/create", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({
"requestId": "gold-ring-checkout-1",
"lines": [
{
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84",
"quantity": 1
}
],
"dropShip": true,
"expectedDropshippingCreditCost": 25,
"expectedDropshippingPolicyRevision": 3
}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = {
requestId: string;
lines: Array<{ productId: string; quantity: number }>;
dropShip: boolean;
expectedDropshippingCreditCost: number;
expectedDropshippingPolicyRevision: number;
};
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {
"requestId": "gold-ring-checkout-1",
"lines": [
{
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84",
"quantity": 1
}
],
"dropShip": true,
"expectedDropshippingCreditCost": 25,
"expectedDropshippingPolicyRevision": 3
};
const response = await fetch("https://platform.arcade.ai/v1/checkouts/create", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"strings"
)
func main() {
apiKey := os.Getenv("ARCADE_API_KEY")
if apiKey == "" {
log.Fatal("Set ARCADE_API_KEY")
}
request, err := http.NewRequest(http.MethodPost, "https://platform.arcade.ai/v1/checkouts/create", strings.NewReader(`{
"requestId": "gold-ring-checkout-1",
"lines": [
{
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84",
"quantity": 1
}
],
"dropShip": true,
"expectedDropshippingCreditCost": 25,
"expectedDropshippingPolicyRevision": 3
}`))
if err != nil {
log.Fatal(err)
}
request.Header.Set("Authorization", "Bearer "+apiKey)
request.Header.Set("Content-Type", "application/json")
request.Header.Set("User-Agent", "your-app/1.0 (you@example.com)")
response, err := http.DefaultClient.Do(request)
if err != nil {
log.Fatal(err)
}
defer response.Body.Close()
body, err := io.ReadAll(response.Body)
if err != nil {
log.Fatal(err)
}
if response.StatusCode >= 400 {
log.Fatalf("HTTP %s: %s", response.Status, body)
}
fmt.Println(string(body))
}
use serde_json::json;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let response = reqwest::blocking::Client::new()
.post("https://platform.arcade.ai/v1/checkouts/create")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({
"requestId": "gold-ring-checkout-1",
"lines": [
{
"productId": "4d9a7c12-8e3b-4f60-b5a1-7c2e9d0f3b84",
"quantity": 1
}
],
"dropShip": true,
"expectedDropshippingCreditCost": 25,
"expectedDropshippingPolicyRevision": 3
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"checkoutId": "1129730264571",
"checkoutUrl": "https://checkout.arcade.ai/checkouts/..."
}
orders/get with the checkoutId returns the order. It can return 404 for a short time right after payment; try again shortly.What you can’t do with jewelry
A jewelry product’s image is not a pattern. These calls return400 for it:
patterns/get. Read the images withproducts/getinstead.- Every refine, such as
patterns/refine/edit. products/create, and using the image as a reference.
patterns/list doesn’t list jewelry images. Use products/list.