Create Ship/Bill Address

This function is used to create a new address resource. The address is linked to a specific customer when it is created.

When posting a new address, Fusebill accepts a variety of values for the Country ID and State ID key-value pairs. The Country ID and State ID fields allow you to use standard ISO 3166-2 Numeric and Subdivision ISO codes. ISO standards are defined and maintained by ISO 3166/MA. For your convenience, we have included downloads of these codes here:

Country Reference List

Shipping and Billing Address Fields

FieldData TypeDescriptionRequired
customerAddressPreferenceIdIntegerThis is the Fusebill generated customer ID.Yes
companyNameStringThe company name if applicable.
[Max Length: 255]
Optional
line1Stringstandard line 1 of an address.

[Max Length: 60]
Optional
line2Stringstandard line 2 of an address.

[Max Length: 60]
Optional
countryIdIntegerThe ID of the country. Retrievable with the Read Country ID call.Optional
stateIdIntegerThe ID of the state, province, or territory. Retrievable with the Read Country ID call.Optional
cityStringThe city of the Customer.Optional
postalZipStringThe postal code or zip code.

[Max Length: 10]
Optional
addressTypeEnum: {Billing, Shipping}In Fusebill a customer can have up to one billing and up to one shipping addressYes
Examples
curl -X POST "https://secure.fusebill.com/v1/Addresses" \
	-H "Content-Type: application/json" \
	-H "Authorization: Basic {APIKey}" \
	-d "{customerAddressPreferenceId:{customerId},companyName:'Fusebill',line1:'232 Herzberg Road',line2:'Suite 203',countryId:124,country:'Canada',stateId:9,state:'Ontario',city:'Kanata',postalZip:'K2K 2A1',addressType:'Billing'}"
//Json data, Fusebill Id which corresponds to the customerId Field
string jsonData ="{customerAddressPreferenceId:{customerId},companyName:'Fusebill',line1:'232 Herzberg Road',line2:'Suite 203',countryId:124,country:'Canada',stateId:9,state:'Ontario',city:'Kanata',postalZip:'K2K 2A1',addressType:'Billing'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/Addresses");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "POST";
//Add the json data to request
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
  streamWriter.Write(jsonData);
  streamWriter.Flush();
  streamWriter.Close();
}
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
  result = streamReader.ReadToEnd();
}
#Import library JSON
import json
#Import library Requests
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in a dictionary to the Payload parameter
payload = {"customerAddressPreferenceId":{id},"companyName":'Fusebill',"line1":'232 Herzberg Road',"line2":'Suite 
203',"countryId":124,"country":'Canada',"stateId":9,"state":'Ontario',"city":'Kanata',"postalZip":'K2K 2A1',"addressType":'Billing'}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/addresses', data=json.dumps(payload), headers=headers)
print(r.content)
{
"CustomerAddressPreferenceId": 652929,
"companyName": "Electricity Inc",
"line1": "10 March Rd",
"line2": "Unit A",
"state": "New York",
"city": "New York",
"postalZip": 12345,
"addressType": "Shipping"
}
Response
{
		"customerAddressPreferenceId": 84636,
		"companyName": "DarkSide",
		"line1": "117 Waba Road",
		"line2": null,
		"countryId": 124,
		"country": "Canada",
		"stateId": 9,
		"state": "Ontario",
		"city": "Pakenham",
		"postalZip": "K0A2X0",
		"addressType": "Billing",
		"id": 63406,
		"uri": "https://secure.fusebill.com/v1/addresses/63406"
}
{
    "ErrorId": 0,
    "HttpStatusCode": 400,
    "Errors": [
        {
            "Key": "Api Error",
            "Value": "Only 1 Billing Address is allowed per customer. Please update it instead."
        }
    ]
}
Language
Authorization