curl --request POST \
--url https://www.crossmint.com/api/unstable/agent-checkouts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"target": {
"kind": "direct_url",
"url": "https://merchant.example/products/classic-tee",
"request": "buy the medium in black"
},
"constraints": {
"maxCost": {
"amount": "100.00",
"currency": "USD"
}
},
"metadata": {
"orderRef": "order_8f2c"
}
}
'import requests
url = "https://www.crossmint.com/api/unstable/agent-checkouts"
payload = {
"target": {
"kind": "direct_url",
"url": "https://merchant.example/products/classic-tee",
"request": "buy the medium in black"
},
"constraints": { "maxCost": {
"amount": "100.00",
"currency": "USD"
} },
"metadata": { "orderRef": "order_8f2c" }
}
headers = {
"X-API-KEY": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-KEY': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
target: {
kind: 'direct_url',
url: 'https://merchant.example/products/classic-tee',
request: 'buy the medium in black'
},
constraints: {maxCost: {amount: '100.00', currency: 'USD'}},
metadata: {orderRef: 'order_8f2c'}
})
};
fetch('https://www.crossmint.com/api/unstable/agent-checkouts', 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://www.crossmint.com/api/unstable/agent-checkouts",
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([
'target' => [
'kind' => 'direct_url',
'url' => 'https://merchant.example/products/classic-tee',
'request' => 'buy the medium in black'
],
'constraints' => [
'maxCost' => [
'amount' => '100.00',
'currency' => 'USD'
]
],
'metadata' => [
'orderRef' => 'order_8f2c'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-API-KEY: <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://www.crossmint.com/api/unstable/agent-checkouts"
payload := strings.NewReader("{\n \"target\": {\n \"kind\": \"direct_url\",\n \"url\": \"https://merchant.example/products/classic-tee\",\n \"request\": \"buy the medium in black\"\n },\n \"constraints\": {\n \"maxCost\": {\n \"amount\": \"100.00\",\n \"currency\": \"USD\"\n }\n },\n \"metadata\": {\n \"orderRef\": \"order_8f2c\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://www.crossmint.com/api/unstable/agent-checkouts")
.header("X-API-KEY", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"target\": {\n \"kind\": \"direct_url\",\n \"url\": \"https://merchant.example/products/classic-tee\",\n \"request\": \"buy the medium in black\"\n },\n \"constraints\": {\n \"maxCost\": {\n \"amount\": \"100.00\",\n \"currency\": \"USD\"\n }\n },\n \"metadata\": {\n \"orderRef\": \"order_8f2c\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.crossmint.com/api/unstable/agent-checkouts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"target\": {\n \"kind\": \"direct_url\",\n \"url\": \"https://merchant.example/products/classic-tee\",\n \"request\": \"buy the medium in black\"\n },\n \"constraints\": {\n \"maxCost\": {\n \"amount\": \"100.00\",\n \"currency\": \"USD\"\n }\n },\n \"metadata\": {\n \"orderRef\": \"order_8f2c\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"target": {
"kind": "direct_url",
"url": "<string>",
"request": "buy the medium in black",
"merchantContext": "<string>"
},
"constraints": {
"maxCost": {
"amount": "100.00",
"currency": "USD"
}
},
"progressItems": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"intentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence": 1,
"label": "<string>",
"startedAt": "2023-11-07T05:31:56Z",
"status": "<string>",
"summary": "<string>",
"finishedAt": "2023-11-07T05:31:56Z"
}
],
"browser": {
"embedUrl": "<string>",
"permissions": []
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"pack": {
"packId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchantDisplayName": "<string>",
"phasesUsed": [
"<string>"
]
},
"pendingUserAction": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"intentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message": "<string>",
"responseSchema": {},
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
},
"receipt": {
"total": {
"amount": "100.00",
"currency": "USD"
},
"capturedAt": "2023-11-07T05:31:56Z",
"merchantOrderId": "<string>",
"evidence": {
"confirmationUrl": "<string>",
"confirmationText": "<string>"
}
},
"failure": {
"message": "<string>",
"failedAt": "2023-11-07T05:31:56Z"
},
"metadata": {}
}{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}Create Agent Checkout
Start an agent checkout that drives a browser through a merchant checkout to purchase a product.
API scope required: agent-checkouts.create
curl --request POST \
--url https://www.crossmint.com/api/unstable/agent-checkouts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"target": {
"kind": "direct_url",
"url": "https://merchant.example/products/classic-tee",
"request": "buy the medium in black"
},
"constraints": {
"maxCost": {
"amount": "100.00",
"currency": "USD"
}
},
"metadata": {
"orderRef": "order_8f2c"
}
}
'import requests
url = "https://www.crossmint.com/api/unstable/agent-checkouts"
payload = {
"target": {
"kind": "direct_url",
"url": "https://merchant.example/products/classic-tee",
"request": "buy the medium in black"
},
"constraints": { "maxCost": {
"amount": "100.00",
"currency": "USD"
} },
"metadata": { "orderRef": "order_8f2c" }
}
headers = {
"X-API-KEY": "<api-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-KEY': '<api-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
target: {
kind: 'direct_url',
url: 'https://merchant.example/products/classic-tee',
request: 'buy the medium in black'
},
constraints: {maxCost: {amount: '100.00', currency: 'USD'}},
metadata: {orderRef: 'order_8f2c'}
})
};
fetch('https://www.crossmint.com/api/unstable/agent-checkouts', 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://www.crossmint.com/api/unstable/agent-checkouts",
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([
'target' => [
'kind' => 'direct_url',
'url' => 'https://merchant.example/products/classic-tee',
'request' => 'buy the medium in black'
],
'constraints' => [
'maxCost' => [
'amount' => '100.00',
'currency' => 'USD'
]
],
'metadata' => [
'orderRef' => 'order_8f2c'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-API-KEY: <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://www.crossmint.com/api/unstable/agent-checkouts"
payload := strings.NewReader("{\n \"target\": {\n \"kind\": \"direct_url\",\n \"url\": \"https://merchant.example/products/classic-tee\",\n \"request\": \"buy the medium in black\"\n },\n \"constraints\": {\n \"maxCost\": {\n \"amount\": \"100.00\",\n \"currency\": \"USD\"\n }\n },\n \"metadata\": {\n \"orderRef\": \"order_8f2c\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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://www.crossmint.com/api/unstable/agent-checkouts")
.header("X-API-KEY", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"target\": {\n \"kind\": \"direct_url\",\n \"url\": \"https://merchant.example/products/classic-tee\",\n \"request\": \"buy the medium in black\"\n },\n \"constraints\": {\n \"maxCost\": {\n \"amount\": \"100.00\",\n \"currency\": \"USD\"\n }\n },\n \"metadata\": {\n \"orderRef\": \"order_8f2c\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.crossmint.com/api/unstable/agent-checkouts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"target\": {\n \"kind\": \"direct_url\",\n \"url\": \"https://merchant.example/products/classic-tee\",\n \"request\": \"buy the medium in black\"\n },\n \"constraints\": {\n \"maxCost\": {\n \"amount\": \"100.00\",\n \"currency\": \"USD\"\n }\n },\n \"metadata\": {\n \"orderRef\": \"order_8f2c\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"target": {
"kind": "direct_url",
"url": "<string>",
"request": "buy the medium in black",
"merchantContext": "<string>"
},
"constraints": {
"maxCost": {
"amount": "100.00",
"currency": "USD"
}
},
"progressItems": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"intentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"sequence": 1,
"label": "<string>",
"startedAt": "2023-11-07T05:31:56Z",
"status": "<string>",
"summary": "<string>",
"finishedAt": "2023-11-07T05:31:56Z"
}
],
"browser": {
"embedUrl": "<string>",
"permissions": []
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"pack": {
"packId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchantDisplayName": "<string>",
"phasesUsed": [
"<string>"
]
},
"pendingUserAction": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"intentId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message": "<string>",
"responseSchema": {},
"createdAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
},
"receipt": {
"total": {
"amount": "100.00",
"currency": "USD"
},
"capturedAt": "2023-11-07T05:31:56Z",
"merchantOrderId": "<string>",
"evidence": {
"confirmationUrl": "<string>",
"confirmationText": "<string>"
}
},
"failure": {
"message": "<string>",
"failedAt": "2023-11-07T05:31:56Z"
},
"metadata": {}
}{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}Authorizations
Client-side API key (ck_...) with the agent-checkouts.* scopes.
JWT identifying the end user, issued by an external auth provider your project trusts.
Body
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Optional legacy field: the id of a pack that guides the agent through this merchant's checkout. A checkout targets one merchant, so at most one pack applies. The applied pack is echoed back on the checkout view's pack field.
Optional id of a saved buyer profile whose name, contact, and shipping the agent prefills instead of asking.
Optional string key/value pairs echoed back on the checkout.
Show child attributes
Show child attributes
Response
The agent checkout has been initiated.
The full checkout view, returned by create, get, and cancel.
The checkout id.
Lifecycle state. succeeded, failed, and cancelled are terminal.
queued, running, awaiting_user_action, succeeded, failed, cancelled Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The live browser session the agent is driving.
Show child attributes
Show child attributes
Present on the checkout view when a pack drove the run. The pack id, merchant name, and phases used are captured on the run so they survive a later edit or deletion of the pack.
Show child attributes
Show child attributes
Present when status is awaiting_user_action. Render a form from responseSchema and submit matching values.
Show child attributes
Show child attributes
Present when status is succeeded.
Show child attributes
Show child attributes
Present when status is failed.
Show child attributes
Show child attributes
Optional string key/value pairs echoed back on the checkout.
Show child attributes
Show child attributes
Was this page helpful?

