Complete addresses as customers type, and confirm an address before you ship
to it.
GraphQL
Use locationSuggest to offer complete addresses while a customer types, and locationValidate to check an address and get it back in a standardized form. When an address validates, you can pass the result to partyCreate or partyCreateWorkflow so the address is recorded as verified.
Send the partial address the customer has typed and the country to search in. locationSuggest returns complete addresses that match, in the same shape as the location input on partyCreate, so you can fill in the rest of the address form from the one the customer picks.
Send the full address to locationValidate. It returns how well the address verified, the address in its standardized form, and a verificationToken when the address is verified.
The code for the state, province, or region, such as CA.
countryCode
The ISO 3166-1 alpha-2 code of the country.
line1
The first line of the address.
line2 – line4
Additional address lines, if applicable.
locality
The city, town, or village.
postalCode
The postal or ZIP code.
Send as much of the address as you have. A postal code, or a locality with an administrative area, gives the best results.
Validation statuses
Status↕
Meaning↕
Suggested next step↕
VERIFIED
The address was verified to the building or the exact unit.
Use the standardized address.
PARTIALLY_VERIFIED
Only part of the address was verified, such as the street or the city, but not the building.
Ask the customer to check details like the house or unit number.
UNVERIFIED
The address could not be verified. address is null.
Ask the customer to check the address.
The standardized address
When the address is VERIFIED or PARTIALLY_VERIFIED, address holds its standardized form. It can differ from what you sent: missing details such as the city may be filled in, the postal code may be completed, and capitalization and abbreviations are corrected. Show the standardized address to the customer, or use it in place of what they typed.
latitude and longitude are included when available.
propertyType is RESIDENTIAL or COMMERCIAL when the address is verified and its type is known, and null otherwise. It is not applied for you. Pass it in the location input when you create the party if you want to use it.
A VERIFIED result includes a verificationToken. Pass it in the location input of partyCreate or partyCreateWorkflow, along with the standardized address exactly as locationValidate returned it. The party's location is then recorded as verified, without the address being checked again.
1mutationPartyCreate($input: PartyCreateInput!){
2 partyCreate(input:$input) {
3 id
4 type
5 location {
6 id
7 line1
8 locality
9 administrativeAreaCode
10 postalCode
11 countryCode
12 propertyType
13}
14}
15}
Keep these rules in mind when you pass a token:
A token is valid for one day. An expired token is ignored, and the party is still created.
The address fields must match the standardized address. If the customer edits the address after validating it, the token is ignored and the party is still created. Validate the edited address to get a new token.
latitude, longitude, propertyType, and metadata can be changed without affecting the token.
Treat the token as an opaque value. Don't parse or change it. A token that was altered, or that was issued to another organization, fails the request.
Suggest and validate addresses
Suggest and validate addresses
Complete addresses as customers type, and confirm an address before you ship to it.
GraphQL
Use
locationSuggestto offer complete addresses while a customer types, andlocationValidateto check an address and get it back in a standardized form. When an address validates, you can pass the result topartyCreateorpartyCreateWorkflowso the address is recorded as verified.Suggest addresses as customers type
Send the partial address the customer has typed and the country to search in.
locationSuggestreturns complete addresses that match, in the same shape as the location input onpartyCreate, so you can fill in the rest of the address form from the one the customer picks.query LocationSuggest($input: LocationSuggestInput!) {locationSuggest(input: $input) {line1line2localityadministrativeAreaadministrativeAreaCodepostalCodecountryCodelatitudelongitude}}Suggestion input fields
countryCodelimitquery22382 Avenida Emp.Suggestions are a starting point, not a verified address. Validate the address the customer ends up with before you create a party with it.
Validate an address
Send the full address to
locationValidate. It returns how well the address verified, the address in its standardized form, and averificationTokenwhen the address is verified.query LocationValidate($input: LocationValidateInput!) {locationValidate(input: $input) {statusverificationTokenaddress {line1line2localityadministrativeAreaadministrativeAreaCodepostalCodecountryCodelatitudelongitudepropertyType}}}Validation input fields
administrativeAreaadministrativeAreaCodeCA.countryCodeline1line2–line4localitypostalCodeSend as much of the address as you have. A postal code, or a locality with an administrative area, gives the best results.
Validation statuses
VERIFIEDPARTIALLY_VERIFIEDUNVERIFIEDaddressisnull.The standardized address
When the address is
VERIFIEDorPARTIALLY_VERIFIED,addressholds its standardized form. It can differ from what you sent: missing details such as the city may be filled in, the postal code may be completed, and capitalization and abbreviations are corrected. Show the standardized address to the customer, or use it in place of what they typed.latitudeandlongitudeare included when available.propertyTypeisRESIDENTIALorCOMMERCIALwhen the address is verified and its type is known, andnullotherwise. It is not applied for you. Pass it in the location input when you create the party if you want to use it.Record a verified address on a party
A
VERIFIEDresult includes averificationToken. Pass it in thelocationinput ofpartyCreateorpartyCreateWorkflow, along with the standardized address exactly aslocationValidatereturned it. The party's location is then recorded as verified, without the address being checked again.mutation PartyCreate($input: PartyCreateInput!) {partyCreate(input: $input) {idtypelocation {idline1localityadministrativeAreaCodepostalCodecountryCodepropertyType}}}Keep these rules in mind when you pass a token:
latitude,longitude,propertyType, andmetadatacan be changed without affecting the token.Errors
Address verification is unavailableInvalid location verification tokenverificationTokenwas altered or was issued to another organization.locationValidatereturned it, or leave it out.limit must be between 1 and 20limitpassed tolocationSuggestwas outside the allowed range.limitfrom 1 to 20, or leave it out to get 10 suggestions.LocationSuggestInput LocationValidateInput PartyCreateInput PartyCreateWorkflowInput
partyCreate partyCreateWorkflow
Was this page helpful?