Addresses
The Addresses API allows you to manage shipping and billing addresses for your account.
List Shipping Addresses
GET/api/v1/address/shipping/
Get all shipping addresses for the current user.
Example Request
- cURL
- JavaScript
- PHP
- Python
- Go
- C#
curl -X GET https://api.axro.com/api/v1/address/shipping/ \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
// Using Fetch API
fetch('https://api.axro.com/api/v1/product/', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
// Using cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.axro.com/api/v1/address/shipping/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer YOUR_ACCESS_TOKEN'
));
$response = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if ($error) {
echo "Error: " . $error;
} else {
$data = json_decode($response, true);
print_r($data);
}
# Using requests library
import requests
url = 'https://api.axro.com/api/v1/address/shipping/'
headers = {'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.axro.com/api/v1/address/shipping/"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println("Response Status:", resp.Status)
fmt.Println("Response Body:", string(body))
}
// Using HttpClient (modern approach)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using (HttpClient client = new HttpClient())
{
// Set authorization header
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN");
// Make the GET request
HttpResponseMessage response = await client.GetAsync("https://api.axro.com/api/v1/address/shipping/");
// Read the response
string responseBody = await response.Content.ReadAsStringAsync();
// Check if request was successful
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Response: " + responseBody);
}
else
{
Console.WriteLine("Error: " + response.StatusCode);
Console.WriteLine("Response: " + responseBody);
}
}
}
}
Example Response
[
{
"id": "a1b2c3d4-e5f6-7890-abcd-1234567890ab",
"company": "Example Corp",
"department": "Warehouse",
"firstname": null,
"lastname": null,
"street": "123 Shipping St",
"zip": "10001",
"city": "New York",
"country": "US",
"phone": "+491234567890",
"email": "mail@example.com",
"status": "approved",
"info": null
}
]
Get Shipping Address by ID
GET/api/v1/address/shipping/{id}
Return a single shipping address by its UUID.
Status values:
- WAITING_APPROVAL: The address is pending approval.
- USABLE: The address can be used for shipping.
Example Request (cURL)
curl -X GET "https://api.axro.com/api/v1/address/shipping/a1b2c3d4-e5f6-7890-abcd-1234567890ab" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Example Response
{
"id": "a1b2c3d4-e5f6-7890-abcd-1234567890ab",
"company": "Example Corp",
"department": "Warehouse",
"firstname": null,
"lastname": null,
"street": "123 Shipping St",
"zip": "10001",
"city": "New York",
"country": "US",
"phone": "+491234567890",
"email": "mail@example.com",
"status": "USABLE",
"info": "Can be used for shipping."
}
Create Shipping Address
POST/api/v1/address/shipping/
Create a shipping address for the current user.
Query parameters
- check (boolean, optional): If true, the address is validated/normalized and a suggestion is returned without saving.
Request body
| Name | Type | Required | Description |
|---|---|---|---|
company | string | ✅ | Company name (max 35 chars) |
department | string | ✅ | Department name (max 35 chars) |
firstname | string | ❌ | Contact first name |
lastname | string | ❌ | Contact last name |
street | string | ✅ | Street and number (max 35 chars) |
zip | string | ✅ | ZIP/Postal code |
city | string | ✅ | City (max 35 chars) |
country | string | ✅ | Country code (ISO 3166-1 alpha-2) |
phone | string | ❌ | Phone number in format +4912345678 (+ and 5-20 digits) |
email | string | ❌ | Email address |
Attention!
- You must provide at least firstname and lastname or company and department.
- Not possible combinations: only firstname, only lastname, only company, only department, firstname + department, lastname + department, firstname + company, lastname + company.
Validation
- company, department, street, and city must be at most 35 characters. Exceeding this limit results in HTTP 422 with a field-specific error.
- phone must match +[5-20 digits].
Example Request
- cURL
- JavaScript
- PHP
- Python
- Go
- C#
# Normal create (persists address)
curl -X POST "https://api.axro.com/api/v1/address/shipping/" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"company": "Example Corp",
"department": "Warehouse",
"street": "123 Shipping St",
"zip": "10001",
"city": "New York",
"country": "US"
}'
# Check-only (validates/normalizes, does NOT persist, no id in response)
curl -X POST "https://api.axro.com/api/v1/address/shipping/?check=true" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"company": "Example Corp",
"department": "Warehouse",
"street": "123 Shipping St",
"zip": "10001",
"city": "New York",
"country": "US"
}'
// Using Fetch API
async function createShippingAddress() {
const url = 'https://api.axro.com/api/v1/address/shipping/';
const token = 'YOUR_ACCESS_TOKEN';
const data = {
company: 'Example Corp',
department: 'Warehouse',
street: '123 Shipping St',
zip: '10001',
city: 'New York',
country: 'US'
};
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const result = await response.json();
console.log('Success:', result);
return result;
} catch (error) {
console.error('Error:', error);
throw error;
}
}
// Call the function
createShippingAddress();
// Using cURL
function createShippingAddress() {
$url = 'https://api.axro.com/api/v1/address/shipping/';
$token = 'YOUR_ACCESS_TOKEN';
$data = [
'company' => 'Example Corp',
'department' => 'Warehouse',
'street' => '123 Shipping St',
'zip' => '10001',
'city' => 'New York',
'country' => 'US'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $token,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
$error = curl_error($ch);
curl_close($ch);
return ['error' => $error];
}
curl_close($ch);
$responseData = json_decode($response, true);
if ($httpCode >= 200 && $httpCode < 300) {
return $responseData;
} else {
return ['error' => 'HTTP Error: ' . $httpCode, 'response' => $responseData];
}
}
// Call the function
$result = createShippingAddress();
print_r($result);
# Using requests library
import requests
import json
def create_shipping_address():
url = 'https://api.axro.com/api/v1/address/shipping/'
token = 'YOUR_ACCESS_TOKEN'
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
data = {
'company': 'Example Corp',
'department': 'Warehouse',
'street': '123 Shipping St',
'zip': '10001',
'city': 'New York',
'country': 'US'
}
try:
response = requests.post(url, headers=headers, json=data)
response.raise_for_status() # Raise exception for HTTP errors
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error: {e}')
return None
# Call the function
result = create_shipping_address()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type ShippingAddress struct {
Company string `json:"company"`
Department string `json:"department"`
Street string `json:"street"`
Zip string `json:"zip"`
City string `json:"city"`
Country string `json:"country"`
}
func createShippingAddress() (map[string]interface{}, error) {
url := "https://api.axro.com/api/v1/address/shipping/"
token := "YOUR_ACCESS_TOKEN"
// Create address data
address := ShippingAddress{
Company: "Example Corp",
Department: "Warehouse",
Street: "123 Shipping St",
Zip: "10001",
City: "New York",
Country: "US",
}
// Convert to JSON
jsonData, err := json.Marshal(address)
if err != nil {
return nil, fmt.Errorf("error marshalling JSON: %v", err)
}
// Create request
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
if err != nil {
return nil, fmt.Errorf("error creating request: %v", err)
}
// Add headers
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
// Execute request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("error executing request: %v", err)
}
defer resp.Body.Close()
// Read response
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("error reading response: %v", err)
}
// Check status code
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, fmt.Errorf("received HTTP %d: %s", resp.StatusCode, string(body))
}
// Parse response
var result map[string]interface{}
if err := json.Unmarshal(body, &result); err != nil {
return nil, fmt.Errorf("error parsing response: %v", err)
}
return result, nil
}
func main() {
result, err := createShippingAddress()
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Println("Success:")
for k, v := range result {
fmt.Printf("%s: %v\n", k, v)
}
}
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
// Define address model
class ShippingAddress
{
public string Company { get; set; }
public string Department { get; set; }
public string Street { get; set; }
public string Zip { get; set; }
public string City { get; set; }
public string Country { get; set; }
}
static async Task Main()
{
try
{
var result = await CreateShippingAddress();
Console.WriteLine("Success:");
Console.WriteLine(JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true }));
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
static async Task CreateShippingAddress()
{
string url = "https://api.axro.com/api/v1/address/shipping/";
string token = "YOUR_ACCESS_TOKEN";
// Create address data
var address = new ShippingAddress
{
Company = "Example Corp",
Department = "Warehouse",
Street = "123 Shipping St",
Zip = "10001",
City = "New York",
Country = "US"
};
// Create HttpClient
using (var client = new HttpClient())
{
// Add headers
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// Serialize address to JSON
string jsonData = JsonSerializer.Serialize(address);
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
// Send request
HttpResponseMessage response = await client.PostAsync(url, content);
// Read response content
string responseContent = await response.Content.ReadAsStringAsync();
// Check if request was successful
if (response.IsSuccessStatusCode)
{
// Parse JSON response
return JsonSerializer.Deserialize(responseContent);
}
else
{
throw new Exception($"HTTP error {(int)response.StatusCode}: {responseContent}");
}
}
}
}
Example Response (create, persisted)
{
"id": "a1b2c3d4-e5f6-7890-abcd-1234567890ab",
"company": "Example Corp",
"department": "Warehouse",
"firstname": null,
"lastname": null,
"street": "123 Shipping St",
"zip": "10001",
"city": "New York",
"country": "US",
"phone": "+491234567890",
"email": "mail@example.com",
"status": "USABLE",
"info": "Can be used for shipping."
}
Example Response (check=true, suggestion only)
{
"company": "Example Corp",
"department": "Warehouse",
"street": "123 Shipping St",
"zip": "10001",
"city": "New York",
"country": "US",
"phone": "+491234567890",
"email": "mail@example.com",
"status": "CHECK_ONLY",
"info": "Suggested validated/normalized address. Not saved."
}
Example Response (duplicate address - HTTP 409)
{
"message":"Shipping address already exists.",
"address_id":"145df5c9-f2b6-54c8-979a-3cab913c1a17",
"request_id":"6f13384e-481e-41ed-b5a9-7448976bb68f"
}
Info: If a shipping address already exists, the API responds with HTTP 409 Conflict and provides the existing address ID.
Use existing address ID to place your order.
Update Shipping Address (Phone and Email)
PUT/api/v1/address/shipping/{shipping-address-id}
Update email and phone for shipping service provider
| Name | Type | Required | Description |
|---|---|---|---|
phone | string | ❌ | Phone number |
email | string | ❌ | Email address |
Example Request
- cURL
- JavaScript
- PHP
- Python
- Go
- C#
curl -X PUT https://api.axro.com/api/v1/address/shipping/a1b2c3d4-e5f6-7890-abcd-1234567890ab \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"phone": "+491234567890",
"email": "mail@example.com"
}'
// Using Fetch API
async function createShippingAddress() {
const url = 'https://api.axro.com/api/v1/address/shipping/a1b2c3d4-e5f6-7890-abcd-1234567890ab';
const token = 'YOUR_ACCESS_TOKEN';
const data = {
phone: '+491234567890',
email: 'mail@example.com',
};
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const result = await response.json();
console.log('Success:', result);
return result;
} catch (error) {
console.error('Error:', error);
throw error;
}
}
// Call the function
createShippingAddress();
// Using cURL
function createShippingAddress() {
$url = 'https://api.axro.com/api/v1/address/shipping/a1b2c3d4-e5f6-7890-abcd-1234567890ab';
$token = 'YOUR_ACCESS_TOKEN';
$data = [
'phone' => '+491234567890',
'email' => 'mail@example.com'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $token,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
$error = curl_error($ch);
curl_close($ch);
return ['error' => $error];
}
curl_close($ch);
$responseData = json_decode($response, true);
if ($httpCode >= 200 && $httpCode < 300) {
return $responseData;
} else {
return ['error' => 'HTTP Error: ' . $httpCode, 'response' => $responseData];
}
}
// Call the function
$result = createShippingAddress();
print_r($result);
# Using requests library
import requests
import json
def create_shipping_address():
url = 'https://api.axro.com/api/v1/address/shipping/a1b2c3d4-e5f6-7890-abcd-1234567890ab'
token = 'YOUR_ACCESS_TOKEN'
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
data = {
'phone': '+491234567890',
'email': 'mail@example.com'
}
try:
response = requests.put(url, headers=headers, json=data)
response.raise_for_status() # Raise exception for HTTP errors
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error: {e}')
return None
# Call the function
result = create_shipping_address()
print(result)
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type ShippingAddress struct {
Phone string `json:"phone"`
Email string `json:"email"`
}
func createShippingAddress() (map[string]interface{}, error) {
url := "https://api.axro.com/api/v1/address/shipping/a1b2c3d4-e5f6-7890-abcd-1234567890ab"
token := "YOUR_ACCESS_TOKEN"
// Create address data
address := ShippingAddress{
Phone: "+491234567890",
Email: "mail@example.com"
}
// Convert to JSON
jsonData, err := json.Marshal(address)
if err != nil {
return nil, fmt.Errorf("error marshalling JSON: %v", err)
}
// Create request
req, err := http.NewRequest("PUT", url, bytes.NewBuffer(jsonData))
if err != nil {
return nil, fmt.Errorf("error creating request: %v", err)
}
// Add headers
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
// Execute request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("error executing request: %v", err)
}
defer resp.Body.Close()
// Read response
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("error reading response: %v", err)
}
// Check status code
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, fmt.Errorf("received HTTP %d: %s", resp.StatusCode, string(body))
}
// Parse response
var result map[string]interface{}
if err := json.Unmarshal(body, &result); err != nil {
return nil, fmt.Errorf("error parsing response: %v", err)
}
return result, nil
}
func main() {
result, err := createShippingAddress()
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Println("Success:")
for k, v := range result {
fmt.Printf("%s: %v\n", k, v)
}
}
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
// Define address model
class ShippingAddress
{
public string Phone { get; set; }
public string Email { get; set; }
}
static async Task Main()
{
try
{
var result = await CreateShippingAddress();
Console.WriteLine("Success:");
Console.WriteLine(JsonSerializer.Serialize(result, new JsonSerializerOptions { WriteIndented = true }));
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
static async Task CreateShippingAddress()
{
string url = "https://api.axro.com/api/v1/address/shipping/a1b2c3d4-e5f6-7890-abcd-1234567890ab";
string token = "YOUR_ACCESS_TOKEN";
// Create address data
var address = new ShippingAddress
{
Phone = "+491234567890",
Email = "mail@example.com"
};
// Create HttpClient
using (var client = new HttpClient())
{
// Add headers
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// Serialize address to JSON
string jsonData = JsonSerializer.Serialize(address);
var content = new StringContent(jsonData, Encoding.UTF8, "application/json");
// Send request
HttpResponseMessage response = await client.PutAsync(url, content);
// Read response content
string responseContent = await response.Content.ReadAsStringAsync();
// Check if request was successful
if (response.IsSuccessStatusCode)
{
// Parse JSON response
return JsonSerializer.Deserialize(responseContent);
}
else
{
throw new Exception($"HTTP error {(int)response.StatusCode}: {responseContent}");
}
}
}
}
Example Response
{
"id": "a1b2c3d4-e5f6-7890-abcd-1234567890ab",
"company": "Example Corp",
"department": "Warehouse",
"firstname": "John",
"lastname": "Doe",
"street": "123 Shipping St",
"zip": "10001",
"city": "New York",
"country": "US",
"phone": "+491234567890",
"email": "mail@example.com",
"status": "pending",
"info": null
}
List Billing Address
GET/api/v1/address/billing/
Get the billing address for the current user
Example Request
- cURL
- JavaScript
- PHP
- Python
- Go
- C#
curl -X GET https://api.axro.com/api/v1/address/billing/ \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
// Using Fetch API
fetch('https://api.axro.com/api/v1/product/', {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
// Using cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.axro.com/api/v1/address/billing/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer YOUR_ACCESS_TOKEN'
));
$response = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if ($error) {
echo "Error: " . $error;
} else {
$data = json_decode($response, true);
print_r($data);
}
# Using requests library
import requests
url = 'https://api.axro.com/api/v1/address/billing/'
headers = {'Authorization': 'Bearer YOUR_ACCESS_TOKEN'}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.axro.com/api/v1/address/billing/"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
fmt.Println("Response Status:", resp.Status)
fmt.Println("Response Body:", string(body))
}
// Using HttpClient (modern approach)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using (HttpClient client = new HttpClient())
{
// Set authorization header
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN");
// Make the GET request
HttpResponseMessage response = await client.GetAsync("https://api.axro.com/api/v1/address/billing/");
// Read the response
string responseBody = await response.Content.ReadAsStringAsync();
// Check if request was successful
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Response: " + responseBody);
}
else
{
Console.WriteLine("Error: " + response.StatusCode);
Console.WriteLine("Response: " + responseBody);
}
}
}
}
Example Response
{
"company": "Example Corp",
"department": "Accounting",
"street": "456 Billing Ave",
"zip": "10002",
"city": "New York",
"country": "US"
}