Skip to main content
POST
/
unstable
/
agent-checkouts
/
buyer-profiles
Create Buyer Profile
curl --request POST \
  --url https://www.crossmint.com/api/unstable/agent-checkouts/buyer-profiles \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '
{
  "label": "Home",
  "name": {
    "first": "Ada",
    "last": "Lovelace"
  },
  "contact": {
    "email": "ada@example.com",
    "phone": "+44 20 7946 0000"
  },
  "shipping": {
    "addressLines": [
      "12 Analytical Engine Way"
    ],
    "locality": "London",
    "postalCode": "EC1A 1BB",
    "countryCode": "GB"
  }
}
'
import requests

url = "https://www.crossmint.com/api/unstable/agent-checkouts/buyer-profiles"

payload = {
"label": "Home",
"name": {
"first": "Ada",
"last": "Lovelace"
},
"contact": {
"email": "ada@example.com",
"phone": "+44 20 7946 0000"
},
"shipping": {
"addressLines": ["12 Analytical Engine Way"],
"locality": "London",
"postalCode": "EC1A 1BB",
"countryCode": "GB"
}
}
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({
label: 'Home',
name: {first: 'Ada', last: 'Lovelace'},
contact: {email: 'ada@example.com', phone: '+44 20 7946 0000'},
shipping: {
addressLines: ['12 Analytical Engine Way'],
locality: 'London',
postalCode: 'EC1A 1BB',
countryCode: 'GB'
}
})
};

fetch('https://www.crossmint.com/api/unstable/agent-checkouts/buyer-profiles', 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/buyer-profiles",
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([
'label' => 'Home',
'name' => [
'first' => 'Ada',
'last' => 'Lovelace'
],
'contact' => [
'email' => 'ada@example.com',
'phone' => '+44 20 7946 0000'
],
'shipping' => [
'addressLines' => [
'12 Analytical Engine Way'
],
'locality' => 'London',
'postalCode' => 'EC1A 1BB',
'countryCode' => 'GB'
]
]),
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/buyer-profiles"

payload := strings.NewReader("{\n \"label\": \"Home\",\n \"name\": {\n \"first\": \"Ada\",\n \"last\": \"Lovelace\"\n },\n \"contact\": {\n \"email\": \"ada@example.com\",\n \"phone\": \"+44 20 7946 0000\"\n },\n \"shipping\": {\n \"addressLines\": [\n \"12 Analytical Engine Way\"\n ],\n \"locality\": \"London\",\n \"postalCode\": \"EC1A 1BB\",\n \"countryCode\": \"GB\"\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/buyer-profiles")
.header("X-API-KEY", "<api-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"Home\",\n \"name\": {\n \"first\": \"Ada\",\n \"last\": \"Lovelace\"\n },\n \"contact\": {\n \"email\": \"ada@example.com\",\n \"phone\": \"+44 20 7946 0000\"\n },\n \"shipping\": {\n \"addressLines\": [\n \"12 Analytical Engine Way\"\n ],\n \"locality\": \"London\",\n \"postalCode\": \"EC1A 1BB\",\n \"countryCode\": \"GB\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://www.crossmint.com/api/unstable/agent-checkouts/buyer-profiles")

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 \"label\": \"Home\",\n \"name\": {\n \"first\": \"Ada\",\n \"last\": \"Lovelace\"\n },\n \"contact\": {\n \"email\": \"ada@example.com\",\n \"phone\": \"+44 20 7946 0000\"\n },\n \"shipping\": {\n \"addressLines\": [\n \"12 Analytical Engine Way\"\n ],\n \"locality\": \"London\",\n \"postalCode\": \"EC1A 1BB\",\n \"countryCode\": \"GB\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "shipping": {
    "addressLines": [
      "<string>"
    ],
    "locality": "<string>",
    "countryCode": "<string>",
    "administrativeAreaCode": "<string>",
    "postalCode": "<string>"
  },
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "label": "<string>",
  "name": {
    "first": "<string>",
    "last": "<string>"
  },
  "contact": {
    "email": "jsmith@example.com",
    "phone": "<string>"
  }
}
{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}
{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}
{
"statusCode": 123,
"error": "<string>",
"message": "<string>"
}

Authorizations

X-API-KEY
string
header
required

Client-side API key (ck_...) with the agent-checkouts.* scopes.

Authorization
string
header
required

JWT identifying the end user, issued by an external auth provider your project trusts.

Body

application/json
shipping
object
required

Global shipping address. administrativeAreaCode and postalCode are nullable for global-address compatibility.

label
string

Optional human-readable label for the profile.

Required string length: 1 - 120
name
object

Optional buyer name. Both parts are optional.

contact
object

Optional buyer contact details.

Response

The buyer profile was created.

The full buyer profile, returned by create, get, list items, and update.

id
string<uuid>
required

The buyer profile id. Pass it as buyerProfileId when creating a checkout.

shipping
object
required

Global shipping address. administrativeAreaCode and postalCode are nullable for global-address compatibility.

createdAt
string<date-time>
required
updatedAt
string<date-time>
required
label
string

Optional human-readable label for the profile.

Required string length: 1 - 120
name
object

Optional buyer name. Both parts are optional.

contact
object

Optional buyer contact details.