1
Get an API key
Create a key in Arcade Studio under Settings → API keys, then export it.
export ARCADE_API_KEY="your-api-key"
2
Generate a pattern
Send a prompt. The
requestId makes the request safe to retry. Name your integration in the User-Agent header; see Identify your client.curl --fail-with-body https://platform.arcade.ai/v1/patterns/create \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"requestId": "linen-florals-1",
"prompt": "Small blue and white block-print florals on natural linen"
}'
import json
import os
import urllib.request
body = {
"requestId": "linen-florals-1",
"prompt": "Small blue and white block-print florals on natural linen"
}
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",
},
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",
},
body: JSON.stringify({
"requestId": "linen-florals-1",
"prompt": "Small blue and white block-print florals on natural linen"
}),
});
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": "linen-florals-1",
"prompt": "Small blue and white block-print florals on natural linen"
};
const response = await fetch("https://platform.arcade.ai/v1/patterns/create", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
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": "linen-florals-1",
"prompt": "Small blue and white block-print florals on natural linen"
}`))
if err != nil {
log.Fatal(err)
}
request.Header.Set("Authorization", "Bearer "+apiKey)
request.Header.Set("Content-Type", "application/json")
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")?)
.json(&json!({
"requestId": "linen-florals-1",
"prompt": "Small blue and white block-print florals on natural linen"
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
{
"jobId": "3583f242-50ed-4250-94c2-c00ea25249dd",
"kind": "pattern",
"status": "running",
"result": null
}
3
Wait for the job
Poll the job until
status is succeeded or failed. Generation takes a minute or two; if it fails, error.message says why.curl --fail-with-body https://platform.arcade.ai/v1/jobs/get \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-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",
},
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",
},
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",
},
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")
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")?)
.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" }
}
4
Create a product
Choose a category from Product builds also return a job. When it succeeds,
categories/list and its options from categories/get; category IDs differ between production and staging. This example makes cotton dinner napkins in production.curl --fail-with-body https://platform.arcade.ai/v1/products/create \
-H "Authorization: Bearer $ARCADE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"requestId": "linen-florals-napkins-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": { "fabric": "cotton", "size": "20x20" }
}'
import json
import os
import urllib.request
body = {
"requestId": "linen-florals-napkins-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"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",
},
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",
},
body: JSON.stringify({
"requestId": "linen-florals-napkins-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"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": "linen-florals-napkins-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"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",
},
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": "linen-florals-napkins-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"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")
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")?)
.json(&json!({
"requestId": "linen-florals-napkins-1",
"patternId": "cmujgkfnk0004pc10nt3kghxd",
"categoryId": "c314010b-e15a-4014-a376-9b8f4e973461",
"selections": {
"fabric": "cotton",
"size": "20x20"
}
}))
.send()?
.error_for_status()?;
println!("{}", response.text()?);
Ok(())
}
result.productId is your product.5
Order it
Create a checkout, then open After payment,
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" \
-d '{
"requestId": "linen-florals-checkout-1",
"lines": [{ "productId": "1cda0369-36f4-44ca-aae2-9d60e788a291", "quantity": 10 }]
}'
import json
import os
import urllib.request
body = {
"requestId": "linen-florals-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",
},
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",
},
body: JSON.stringify({
"requestId": "linen-florals-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": "linen-florals-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",
},
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": "linen-florals-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")
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")?)
.json(&json!({
"requestId": "linen-florals-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/..."
}
orders/get with the checkoutId returns the order.