Shipping Addresses
Create
Create a shipping address and attach it to a profile.
POST
/
shipping
/
create
Create
curl --request POST \
--url https://api.buybase.ai/shipping/create \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"country_code": "<string>",
"province_code": "<string>",
"postal_code": "<string>"
},
"profile_id": "<string>"
}
'import requests
url = "https://api.buybase.ai/shipping/create"
payload = {
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"country_code": "<string>",
"province_code": "<string>",
"postal_code": "<string>"
},
"profile_id": "<string>"
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
shipping_address: {
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>',
address_1: '<string>',
address_2: '<string>',
city: '<string>',
country_code: '<string>',
province_code: '<string>',
postal_code: '<string>'
},
profile_id: '<string>'
})
};
fetch('https://api.buybase.ai/shipping/create', 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://api.buybase.ai/shipping/create",
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([
'shipping_address' => [
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'address_1' => '<string>',
'address_2' => '<string>',
'city' => '<string>',
'country_code' => '<string>',
'province_code' => '<string>',
'postal_code' => '<string>'
],
'profile_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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://api.buybase.ai/shipping/create"
payload := strings.NewReader("{\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"country_code\": \"<string>\",\n \"province_code\": \"<string>\",\n \"postal_code\": \"<string>\"\n },\n \"profile_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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://api.buybase.ai/shipping/create")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"country_code\": \"<string>\",\n \"province_code\": \"<string>\",\n \"postal_code\": \"<string>\"\n },\n \"profile_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buybase.ai/shipping/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"country_code\": \"<string>\",\n \"province_code\": \"<string>\",\n \"postal_code\": \"<string>\"\n },\n \"profile_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"shipping": {
"id": "ship_12345",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "+1234567890",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "New York",
"country_code": "US",
"province_code": "NY",
"postal_code": "10001",
"profile_id": "prof_67890",
"created_at": "2023-09-15T14:22:31Z"
},
"attached_profile_id": "prof_67890",
"code": "SHIPPING_CREATED"
}
Headers
string
required
Your API key for authorization.
Body Parameters
object
required
Show Shipping Address Object
Show Shipping Address Object
string
required
First name of the recipient.
string
required
Last name of the recipient.
string
required
Email address of the recipient.
string
required
Phone number of the recipient.
string
required
Primary address line.
string
Secondary address line (optional).
string
required
City name.
string
required
Country code (e.g., US, CA).
string
required
Province or state code.
string
required
Postal or ZIP code.
string
required
The ID of the profile to attach this shipping address to.
Response
boolean
Indicates whether the operation was successful.
object
The created shipping address object.
string
The ID of the profile this shipping address is attached to.
string
A code indicating the result of the operation. Possible values:
SHIPPING_CREATED: Shipping address created successfullySHIPPING_CREATION_FAILED: Failed to create shipping address
string
Error message if the request fails.
Shipping addresses are used for order fulfillment. Ensure all required fields are provided with accurate information.
{
"success": true,
"shipping": {
"id": "ship_12345",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "+1234567890",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "New York",
"country_code": "US",
"province_code": "NY",
"postal_code": "10001",
"profile_id": "prof_67890",
"created_at": "2023-09-15T14:22:31Z"
},
"attached_profile_id": "prof_67890",
"code": "SHIPPING_CREATED"
}
⌘I
Create
curl --request POST \
--url https://api.buybase.ai/shipping/create \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"country_code": "<string>",
"province_code": "<string>",
"postal_code": "<string>"
},
"profile_id": "<string>"
}
'import requests
url = "https://api.buybase.ai/shipping/create"
payload = {
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>",
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"country_code": "<string>",
"province_code": "<string>",
"postal_code": "<string>"
},
"profile_id": "<string>"
}
headers = {
"authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
shipping_address: {
first_name: '<string>',
last_name: '<string>',
email: '<string>',
phone: '<string>',
address_1: '<string>',
address_2: '<string>',
city: '<string>',
country_code: '<string>',
province_code: '<string>',
postal_code: '<string>'
},
profile_id: '<string>'
})
};
fetch('https://api.buybase.ai/shipping/create', 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://api.buybase.ai/shipping/create",
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([
'shipping_address' => [
'first_name' => '<string>',
'last_name' => '<string>',
'email' => '<string>',
'phone' => '<string>',
'address_1' => '<string>',
'address_2' => '<string>',
'city' => '<string>',
'country_code' => '<string>',
'province_code' => '<string>',
'postal_code' => '<string>'
],
'profile_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$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://api.buybase.ai/shipping/create"
payload := strings.NewReader("{\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"country_code\": \"<string>\",\n \"province_code\": \"<string>\",\n \"postal_code\": \"<string>\"\n },\n \"profile_id\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "<authorization>")
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://api.buybase.ai/shipping/create")
.header("authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"country_code\": \"<string>\",\n \"province_code\": \"<string>\",\n \"postal_code\": \"<string>\"\n },\n \"profile_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.buybase.ai/shipping/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"email\": \"<string>\",\n \"phone\": \"<string>\",\n \"address_1\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"country_code\": \"<string>\",\n \"province_code\": \"<string>\",\n \"postal_code\": \"<string>\"\n },\n \"profile_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"shipping": {
"id": "ship_12345",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"phone": "+1234567890",
"address_1": "123 Main St",
"address_2": "Apt 4B",
"city": "New York",
"country_code": "US",
"province_code": "NY",
"postal_code": "10001",
"profile_id": "prof_67890",
"created_at": "2023-09-15T14:22:31Z"
},
"attached_profile_id": "prof_67890",
"code": "SHIPPING_CREATED"
}