Set Default Address
2/7/25Less than 1 minute
Set Default Address
The Set Default Address API allows users to designate a specific address as their default address.
Endpoint:
PATCH /v1/addresses/{addressId}/default
Required Headers:
{
"Authorization": "Bearer JWT_TOKEN",
"X-MerchantApiKey": "MERCHANT_API_KEY",
"Content-Type": "application/json"
}
Path Parameters:
Parameter | Type | Required | Description |
---|---|---|---|
addressId | string | Yes | The unique ID of the address to be set as default. |
Example API Call (Fetch or Axios)
fetch('https://api.shopsynch.com/v1/addresses/67a6233a39c0d26e52f6c1b4/default', {
method: 'PUT',
headers: {
'Authorization': 'Bearer JWT_TOKEN',
'X-MerchantApiKey': 'MERCHANT_API_KEY',
'Content-Type': 'application/json'
}
})
.then(response => response.json())
.then(data => console.log(data));
Sample 200 Response (Success):
{
"data": {
"id": "67a6233a39c0d26e52f6c1b4",
"street": "123 Main St",
"streetNumber": "12A",
"postalCode": "100001",
"city": "Lagos",
"state": "Lagos",
"country": "Nigeria",
"localGovernmentName": "Ikeja",
"isDefault": true
},
"message": "Address set as default successfully",
"status": true
}
Sample 422 Response (Validation Error):
{
"data": null,
"message": "Invalid address ID provided.",
"status": false
}
Sample 401 Response (Unauthorized):
{
"data": null,
"message": "Unauthorized. Missing or invalid token.",
"status": false
}
Next Steps
- Learn more about Fetching Addresses