Skip to content
 


POST /api.xro/1.0/contacts

Saves a batch of contact records for a particular Xero customer. If any of the contact records do not exist (based on either ContactID or ContactNumber) then it’s created, otherwise it’s updated.

Request

Parameter Description
apiKey(Required) Your partner API Key.
xeroKey(Required) The Xero Customer Key generated by the Xero customer and provided to you to access their organisation data.

Example

To save contacts perform the following HTTP request (this will perform an update because the Contact Number already exists):

POST https://networktest.xero.com/api.xro/1.0/contacts?apiKey=[Your API Key]&xeroKey=[The Xero Customer Key]

<Contacts>
	<Contact>
		<ContactNumber>C20081234</ContactNumber>
		<ContactStatus>ACTIVE</ContactStatus>
		<Name>Red House Reads</Name>
		<EmailAddress>accounts@redhousereads.co.nz</EmailAddress>
		<Addresses>
			<Address>
				<AddressType>STREET</AddressType>
				<AddressLine1></AddressLine1>
				<AddressLine2></AddressLine2>
				<AddressLine3></AddressLine3>
				<AddressLine4></AddressLine4>
				<City></City>
				<Region></Region>
				<PostalCode></PostalCode>
				<Country></Country>
			</Address>
			<Address>
				<AddressType>POBOX</AddressType>
				<AddressLine1>Lvl 1</AddressLine1>
				<AddressLine2>Herd St Building</AddressLine2>
				<AddressLine3>Herd St</AddressLine3>
				<AddressLine4>Wellington</AddressLine4>
				<City>Wellington</City>
				<Region>Wellington</Region>
				<PostalCode>6011</PostalCode>
				<Country>New Zealand</Country>
			</Address>
		</Addresses>
		<Phones>
			<Phone>
				<PhoneType>DDI</PhoneType>
				<PhoneNumber>1234567</PhoneNumber>
				<PhoneAreaCode>4</PhoneAreaCode>
				<PhoneCountryCode>64</PhoneCountryCode>
			</Phone>
			<Phone>
				<PhoneType>DEFAULT</PhoneType>
				<PhoneNumber>1234567</PhoneNumber>
				<PhoneAreaCode>4</PhoneAreaCode>
				<PhoneCountryCode>64</PhoneCountryCode>
			</Phone>
			<Phone>
				<PhoneType>MOBILE</PhoneType>
				<PhoneNumber>123123</PhoneNumber>
				<PhoneAreaCode>21</PhoneAreaCode>
				<PhoneCountryCode>64</PhoneCountryCode>
			</Phone>
			<Phone>
				<PhoneType>FAX</PhoneType>
				<PhoneNumber>1234568</PhoneNumber>
				<PhoneAreaCode>4</PhoneAreaCode>
				<PhoneCountryCode>64</PhoneCountryCode>
			</Phone>
		</Phones>
		<SkypeUserName>echo123</SkypeUserName>
		<BankAccountDetails>123-456-789</BankAccountDetails>
	</Contact>
</Contacts>

Request Body Schema

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified"
	elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="Contacts">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="Contact">
					<xs:complexType>
						<xs:sequence>
							<xs:element minOccurs="0" name="ContactID" type="xs:string" />
							<xs:element minOccurs="0" name="ContactNumber" type="xs:string" />
							<xs:element name="ContactStatus" type="xs:string" />
							<xs:element name="Name" type="xs:string" />
							<xs:element name="EmailAddress" type="xs:string" />
							<xs:element name="Addresses">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="Address">
											<xs:complexType>
												<xs:sequence>
													<xs:element name="AddressType" type="xs:string" />
													<xs:element name="AddressLine1" type="xs:string" />
													<xs:element name="AddressLine2" type="xs:string" />
													<xs:element name="AddressLine3" type="xs:string" />
													<xs:element name="AddressLine4" type="xs:string" />
													<xs:element name="City" type="xs:string" />
													<xs:element name="Region" type="xs:string" />
													<xs:element name="PostalCode" type="xs:unsignedShort" />
													<xs:element name="Country" type="xs:string" />
												</xs:sequence>
											</xs:complexType>
										</xs:element>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
							<xs:element name="Phones">
								<xs:complexType>
									<xs:sequence>
										<xs:element maxOccurs="unbounded" name="Phone">
											<xs:complexType>
												<xs:sequence>
													<xs:element name="PhoneType" type="xs:string" />
													<xs:element name="PhoneNumber" type="xs:unsignedInt" />
													<xs:element name="PhoneAreaCode" type="xs:unsignedByte" />
													<xs:element name="PhoneCountryCode" type="xs:unsignedByte" />
												</xs:sequence>
											</xs:complexType>
										</xs:element>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
							<xs:element minOccurs="0" name="SkypeUserName" type="xs:string" />
							<xs:element minOccurs="0" name="BankAccountDetails" type="xs:string" />
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

Response Xml Schema

See Contacts Response Xml Schema