
Lemon branches with coral blossoms and navy leaves on a soft cream ground
1
Get an API key
Create a key in Arcade Studio under Settings → API keys, then export it. A key has the same access as your account, so keep it on your server.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
Generate a pattern
Send a prompt. The The response is a job:Already have artwork? Upload it as a pattern instead. The upload returns a
requestId is an ID you choose; it makes the request safe to retry. See Idempotency.curl --fail-with-body https://platform.arcade.ai/v1/patterns/create \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{
"requestId": "lemon-branches-1",
"prompt": "Lemon branches with coral blossoms and navy leaves on a soft cream ground"
}'
import json
import os
import urllib.request
body = {
"requestId": "lemon-branches-1",
"prompt": "Lemon branches with coral blossoms and navy leaves on a soft cream ground"
}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/patterns/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/patterns/create", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({
"requestId": "lemon-branches-1",
"prompt": "Lemon branches with coral blossoms and navy leaves on a soft cream ground"
}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = { requestId: string; prompt: string };
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {
"requestId": "lemon-branches-1",
"prompt": "Lemon branches with coral blossoms and navy leaves on a soft cream ground"
};
const response = await fetch("https://platform.arcade.ai/v1/patterns/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/patterns/create", strings.NewReader(`{
"requestId": "lemon-branches-1",
"prompt": "Lemon branches with coral blossoms and navy leaves on a soft cream ground"
}`))
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/patterns/create")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({
"requestId": "lemon-branches-1",
"prompt": "Lemon branches with coral blossoms and navy leaves on a soft cream ground"
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"jobId": "3583f242-50ed-4250-94c2-c00ea25249dd",
"kind": "pattern",
"status": "running",
"result": null,
"error": null
}
patternId directly, so skip the next step too.3
Wait for the job
Call
jobs/get every 10 seconds until status is succeeded or failed. Generation takes a minute or two.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": "3583f242-50ed-4250-94c2-c00ea25249dd" }'
import json
import os
import urllib.request
body = {
"jobId": "3583f242-50ed-4250-94c2-c00ea25249dd"
}
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": "3583f242-50ed-4250-94c2-c00ea25249dd"
}),
});
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": "3583f242-50ed-4250-94c2-c00ea25249dd"
};
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": "3583f242-50ed-4250-94c2-c00ea25249dd"
}`))
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": "3583f242-50ed-4250-94c2-c00ea25249dd"
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"jobId": "3583f242-50ed-4250-94c2-c00ea25249dd",
"kind": "pattern",
"status": "succeeded",
"result": { "patternId": "cmujgkfnk0004pc10nt3kghxd" },
"error": null
}
result.patternId is your pattern. Call patterns/get with it to get the image. If the job failed, error.message says why.4
Edit it with a description
This step is optional. Describe the change in plain words. The edit returns a job.Poll the job as before. When it succeeds, 

Other refines, such as
curl --fail-with-body https://platform.arcade.ai/v1/patterns/refine/edit \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{
"requestId": "lemon-branches-edit-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"instruction": "Turn the leaves to a deep forest green"
}'
import json
import os
import urllib.request
body = {
"requestId": "lemon-branches-edit-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"instruction": "Turn the leaves to a deep forest green"
}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/patterns/refine/edit",
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/patterns/refine/edit", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({
"requestId": "lemon-branches-edit-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"instruction": "Turn the leaves to a deep forest green"
}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = { requestId: string; patternId: string; instruction: string };
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {
"requestId": "lemon-branches-edit-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"instruction": "Turn the leaves to a deep forest green"
};
const response = await fetch("https://platform.arcade.ai/v1/patterns/refine/edit", {
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/patterns/refine/edit", strings.NewReader(`{
"requestId": "lemon-branches-edit-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"instruction": "Turn the leaves to a deep forest green"
}`))
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/patterns/refine/edit")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({
"requestId": "lemon-branches-edit-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"instruction": "Turn the leaves to a deep forest green"
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
result.patternId is a new pattern. The original pattern stays as it was.{
"jobId": "9d2c7a41-6f0b-4e8a-b3d5-1a7e4c9f2b60",
"kind": "pattern",
"status": "succeeded",
"result": { "patternId": "cmujh2x9a0007pc10q4wd8rte" },
"error": null
}

Before: navy leaves

After: “Turn the leaves to a deep forest green”
crop, makeSeamless and extendPattern, work the same way: you send a pattern, get a job, and the job makes a new pattern. recolor needs one extra call first: recolorClusters, which lists the pattern’s colors.5
Choose a category
A category is a type of product. List the categories and choose one whose Category IDs can change. Read them from 
world is print.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": "c314010b-e15a-4014-a376-9b8f4e973461",
"name": "Throw Pillows",
"imageUrl": "https://...",
"world": "print"
}
]
}
categories/list; don’t hardcode them.
A print category: cushions
6
Choose the options
Each category has options, such as fabric and size. Call Among other fields, the response includes:
categories/get with the categoryId and an empty selections to see them.curl --fail-with-body https://platform.arcade.ai/v1/categories/get \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {}
}'
import json
import os
import urllib.request
body = {
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {}
}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/categories/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/categories/get", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {}
}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = { categoryId: string; selections: Record<string, string> };
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {}
};
const response = await fetch("https://platform.arcade.ai/v1/categories/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/categories/get", strings.NewReader(`{
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {}
}`))
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/get")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {}
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"options": [
{
"key": "fabric",
"label": "Fabric",
"values": [
{ "value": "cotton", "label": "Cotton", "isDefault": true, "available": true },
{ "value": "linen", "label": "Linen", "isDefault": false, "available": true }
]
},
{
"key": "size",
"label": "Size",
"values": [
{ "value": "20x20", "label": "20 x 20 in", "isDefault": true, "available": true },
{ "value": "18x18", "label": "18 x 18 in", "isDefault": false, "available": true }
]
}
],
"selections": { "fabric": "cotton", "size": "20x20" },
"canManufacture": true
}
optionslists every option and its values.selectionsis the set of choices to build with: yours, plus a value for the options you left out, the default where possible.canManufacturesays whether a maker can make the product inselections.
canManufacture is true, go to the next step.To change an option, send your choice and call categories/get again. For example, send "selections": { "fabric": "linen" } to choose linen. Choose only values with available: true. The response fills in the remaining options again.7
Create the product
Call The response is a job. Poll it as before; when it succeeds, 
If the pattern and the product have different shapes,
products/create with the edited patternId, the categoryId and the selections object from the latest categories/get response. Send the whole object, not only the choices you made.The values below are examples. Use the ones your category returned.curl --fail-with-body https://platform.arcade.ai/v1/products/create \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{
"requestId": "lemon-branches-pillow-1",
"patternId": "cmujh2x9a0007pc10q4wd8rte",
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": { "fabric": "cotton", "size": "20x20" }
}'
import json
import os
import urllib.request
body = {
"requestId": "lemon-branches-pillow-1",
"patternId": "cmujh2x9a0007pc10q4wd8rte",
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {
"fabric": "cotton",
"size": "20x20"
}
}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/products/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/products/create", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({
"requestId": "lemon-branches-pillow-1",
"patternId": "cmujh2x9a0007pc10q4wd8rte",
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {
"fabric": "cotton",
"size": "20x20"
}
}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = { requestId: string; patternId: string; categoryId: string; selections: Record<string, string> };
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {
"requestId": "lemon-branches-pillow-1",
"patternId": "cmujh2x9a0007pc10q4wd8rte",
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {
"fabric": "cotton",
"size": "20x20"
}
};
const response = await fetch("https://platform.arcade.ai/v1/products/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/products/create", strings.NewReader(`{
"requestId": "lemon-branches-pillow-1",
"patternId": "cmujh2x9a0007pc10q4wd8rte",
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {
"fabric": "cotton",
"size": "20x20"
}
}`))
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/create")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({
"requestId": "lemon-branches-pillow-1",
"patternId": "cmujh2x9a0007pc10q4wd8rte",
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {
"fabric": "cotton",
"size": "20x20"
}
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
result.productId is your product.
The edited pattern, made as a throw pillow
products/create can also need a fit, which says how to crop or extend the pattern. See Create a product.8
Order it
Create a checkout with the To order a single unit, see Dropshipping.
productId and a quantity, 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": "lemon-branches-checkout-1",
"lines": [{ "productId": "1cda0369-36f4-44ca-aae2-9d60e788a291", "quantity": 10 }]
}'
import json
import os
import urllib.request
body = {
"requestId": "lemon-branches-checkout-1",
"lines": [
{
"productId": "1cda0369-36f4-44ca-aae2-9d60e788a291",
"quantity": 10
}
]
}
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": "lemon-branches-checkout-1",
"lines": [
{
"productId": "1cda0369-36f4-44ca-aae2-9d60e788a291",
"quantity": 10
}
]
}),
});
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 }> };
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {
"requestId": "lemon-branches-checkout-1",
"lines": [
{
"productId": "1cda0369-36f4-44ca-aae2-9d60e788a291",
"quantity": 10
}
]
};
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": "lemon-branches-checkout-1",
"lines": [
{
"productId": "1cda0369-36f4-44ca-aae2-9d60e788a291",
"quantity": 10
}
]
}`))
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": "lemon-branches-checkout-1",
"lines": [
{
"productId": "1cda0369-36f4-44ca-aae2-9d60e788a291",
"quantity": 10
}
]
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"checkoutId": "1129729917083",
"checkoutUrl": "https://checkout.arcade.ai/checkouts/..."
}
9
Track the order
After payment, Arcade handles manufacturing and fulfillment. Call 
orders/get with the checkoutId to see the order’s status and its lines. It can return 404 for a short time right after payment; try again shortly.curl --fail-with-body https://platform.arcade.ai/v1/orders/get \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: your-app/1.0 (you@example.com)" \
-d '{
"checkoutId": "1129729917083"
}'
import json
import os
import urllib.request
body = {
"checkoutId": "1129729917083"
}
request = urllib.request.Request(
"https://platform.arcade.ai/v1/orders/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/orders/get", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
"User-Agent": "your-app/1.0 (you@example.com)",
},
body: JSON.stringify({
"checkoutId": "1129729917083"
}),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());
type RequestBody = { checkoutId: string };
const apiKey = process.env.ARCADE_API_KEY;
if (!apiKey) throw new Error("Set ARCADE_API_KEY");
const body: RequestBody = {
"checkoutId": "1129729917083"
};
const response = await fetch("https://platform.arcade.ai/v1/orders/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/orders/get", strings.NewReader(`{
"checkoutId": "1129729917083"
}`))
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/orders/get")
.bearer_auth(std::env::var("ARCADE_API_KEY")?)
.header("User-Agent", "your-app/1.0 (you@example.com)")
.json(&json!({
"checkoutId": "1129729917083"
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}

A maker finishing a printed cushion
Next steps
- Skip the pattern step:
products/generatemakes a product straight from a prompt, and Arcade picks the options. - Get notified when a job finishes with webhooks instead of polling.
Tips
- Retry with the same
requestId. The work runs once, and the retry returns the original result. Use a newrequestIdfor new work. See Idempotency. - Poll every 10 seconds. Polling faster counts against the rate limit and doesn’t make a job finish sooner.
- Read category IDs from
categories/list. They can change, so don’t hardcode them. - Send the complete
selections. Use the objectcategories/getreturns, not only the choices you sent.