All tutorials
Swiftcomplete Validate API
The Validate API matches addresses against official address records, normalises formatting, and suggests corrections when the input contains meaningful errors.
Detects and validates what3words addresses. If invalid, returns the most likely candidate using proximity to the rest of the address, where available.
The response contains three top-level parts:
| Part | Description |
|---|---|
| validation | Describes whether the input matched an underlying source record and at which resolution. |
| address | The normalised address to use, provided as a single string and split into multiple lines. |
| associatedRecords | A list of any records associated with the returned address, such as apartments, suites, departments, or business names. |
All requests require an API key passed in the X-API-Key header.
X-API-Key: your_api_key_here
POST https://api.swiftcomplete.com/v1/validate-address/ Content-Type: application/json
Request and response bodies are UTF-8 encoded JSON.
Each field is optional, but the request must contain at least one non-empty value in singleLine, companyName, line1, line2, line3, tertiaryLocality, secondaryLocality, primaryLocality, or postalCode.
state, stateCode, countryName, and countryCode do not satisfy this minimum-input requirement by themselves, but may be included with another qualifying field.
If your address data is unstructured, pass the whole address in singleLine.
If your address data is already structured, pass the components into their respective fields.
Do not combine singleLine with the structured address fields. When singleLine is provided, it takes precedence and the structured fields are ignored. You may still provide countryCode to restrict matching to one or more markets.
Providing one or more supported country codes restricts matching to those markets and improves accuracy. Separate multiple country codes with commas. It is strongly recommended whenever the relevant market is known.
| Field | Type | Description |
|---|---|---|
| singleLine | string | Freeform, unstructured address string. Example: 10 downing st london sw1a2aa. |
| companyName | string | Business or organisation name associated with the address. |
| line1 | string | Primary address line. |
| line2 | string | Secondary address line. |
| line3 | string | Tertiary address line. |
| tertiaryLocality | string | Sub-locality, neighbourhood, or village within a larger locality. |
| secondaryLocality | string | District, borough, or suburb. |
| primaryLocality | string | City or town. |
| state | string | State, province, county, region, or other principal administrative area, where applicable. |
| stateCode | string | State abbreviation, where applicable. |
| postalCode | string | Postal or ZIP code. |
| countryName | string | Country name. |
| countryCode | string | One or more supported ISO 3166-1 alpha-2 country codes. Separate multiple codes with commas, for example GB,DE. |
| what3words | string | A what3words address, eg. ///filled.count.soap |
A response contains validation, address, and associatedRecords.
| Field | Type | Description |
|---|---|---|
| validation | object | The result of matching the input to the underlying source data. |
| address | object or null | The normalised address to use. Returned for match and suggestion; null for none. |
| associatedRecords | array or null | Records associated with the returned address. null when none exist. |
validation
validation.result
validation.result is the core result of the operation. Read it first when deciding whether to accept the returned address, ask the user to confirm a suggestion, or ask the user to re-enter the address.
| Result | Description |
|---|---|
| match | The input was successfully matched to an official record. |
| suggestion | The input matched the underlying source data but changes are large enough to justify seeking user confirmation. |
| none | The input could not be matched to an address in the underlying source data. address and validation.resolution will be null. |
validation.resolution
validation.resolution describes the highest address level matched against the underlying source data. See Input preservation for how this relates to values returned in address.
| Resolution | Description | Example of matched source data |
|---|---|---|
| subPremise | The input matched a specific unit, flat, suite, floor, department, organisation, or other source record within or associated with a building. | HSBC Holdings plc, 8 Canada Square, London, E14 5HQ |
| premise | The input matched a specific building or premise. | 10 Downing Street, London, SW1A 2AA |
| street | The input matched a street or thoroughfare, but not a specific premise. | Great Russell Street, London, WC1B 3DG |
| city | The input matched only a city, town, or locality. | London, United Kingdom |
| null | No address level could be matched, or resolution is not applicable. | Returned with validation.result: none. |
address
address is the normalised address to use when validation.result is match or suggestion.
| Field | Type | Description |
|---|---|---|
| address.singleLine | string | The complete normalised address, formatted as a single display line. |
| address.multiLine | object | The same address broken into structured components. |
address.multiLine contains companyName, line1, line2, line3, tertiaryLocality, secondaryLocality, primaryLocality, state, stateCode, postalCode, countryName, countryCode, and what3words.
Each field contains the value returned by Swiftcomplete, or null where the component does not apply. When validation.result is none, address is null.
associatedRecords
associatedRecords provides a list of any address records associated with the returned address, such as companies, flats, suites, departments.
These records can be presented to the end user as optional refinements to the default address; they do not change the core validation result. When records are returned, show their picklistDisplay values to the user after the base address has been validated or accepted.
| Field | Type | Description |
|---|---|---|
| associatedRecords[].picklistDisplay | string | Consumer-facing text to display in a pick list. Do not use this value directly as an address field. |
| associatedRecords[].overrides | object | The replacement values to apply to the default address if this record is selected. |
| associatedRecords[].overrides.singleLine | string | The value that should replace address.singleLine if the integration uses the single-line format. |
| associatedRecords[].overrides.multiLine | object | A partial address object containing each structured field that should replace the corresponding field in address.multiLine. It can contain any multi-line address field. |
Applying an associated record
Do not change the default address unless the user selects an associated record.
When a record is selected:
- If your integration uses
address.singleLine, replace it withassociatedRecords[n].overrides.singleLine. - If your integration uses
address.multiLine, replace each field present inassociatedRecords[n].overrides.multiLinewith the returned value. - Leave every address field not included in
overrides.multiLineunchanged.
When no associated records are available, associatedRecords is null.
Swiftcomplete validates submitted address data against underlying source records. It may also preserve important input that is not present in the matched record but is still useful for delivery or recipient identification.
Examples include:
- recipient or attention details, such as
FAO Reception Desk; - department names;
- informal or newly registered business names; and
- delivery or entrance instructions, such as
Use side entranceorDeliver to loading bay.
Swiftcomplete determines whether input should be preserved and where it should appear in the returned address. Integrations should use address.singleLine or address.multiLine as returned and should not attempt to identify or reposition preserved input.
Relationship with validation.resolution
validation.resolution describes the highest address level matched against the underlying source data. It does not describe the resolution of address.
Preserved input can therefore make the returned address more detailed than the matched source record. A populated field is not evidence that the field itself was validated.
Always use:
validation.resolutionto assess match precision; andaddressas the normalised address to display, store, or submit.
Worked example
The request and response below show Swiftcomplete matching the university at subPremise level while preserving an unvalidated department name:
{ "singleLine": "Department of Geospatial Engineering, King's College London, Strand, London, WC2R 2LS, United Kingdom", "countryCode": "GB" }
{ "validation": { "result": "match", "resolution": "subPremise" }, "address": { "singleLine": "Department Of Geospatial Engineering, Kings College London, Strand, London, WC2R 2LS, United Kingdom", "multiLine": { "companyName": "Kings College London", "line1": "Department Of Geospatial Engineering", "line2": "Strand", "line3": null, "tertiaryLocality": null, "secondaryLocality": null, "primaryLocality": "London", "state": "Greater London", "stateCode": null, "postalCode": "WC2R 2LS", "countryName": "United Kingdom", "countryCode": "GB" } }, "associatedRecords": null }
Kings College London is matched against the underlying source data and returned in companyName. Department Of Geospatial Engineering is not part of the matched source record, but is preserved in line1. The authoritative match level remains subPremise.| Result | Associated records | Recommended handling |
|---|---|---|
| match | null | Use address as the normalised address, subject to your required validation.resolution. |
| match | Array | Use address as the default. Optionally show each picklistDisplay as a more specific choice and apply its overrides if selected. |
| suggestion | null | Present address as the corrected address and ask the user to confirm it before replacing their original address. |
| suggestion | Array | Present address as the corrected default. If accepted, optionally show associated records and apply an override only if selected. |
| none | null | Ask the user to review, edit, or re-enter the address. |
The Validate API currently supports the following markets:
| Market | Country code |
|---|---|
| United Kingdom | GB |
| Germany | DE |
match
{ "singleLine": "40 Sisters Avenue, London, SW11 5SQ, United Kingdom", "countryCode": "GB" }
{ "validation": { "result": "match", "resolution": "premise" }, "address": { "singleLine": "40 Sisters Avenue, London, SW11 5SQ, United Kingdom", "multiLine": { "companyName": null, "line1": "40 Sisters Avenue", "line2": null, "line3": null, "tertiaryLocality": null, "secondaryLocality": null, "primaryLocality": "London", "state": "Greater London", "stateCode": null, "postalCode": "SW11 5SQ", "countryName": "United Kingdom", "countryCode": "GB" } }, "associatedRecords": null }
match with associatedRecords
{ "singleLine": "242 acklam road w105jj", "countryCode": "GB" }
{ "validation": { "result": "match", "resolution": "premise" }, "address": { "singleLine": "242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": null, "line1": "242 Acklam Road", "line2": null, "line3": null, "tertiaryLocality": null, "secondaryLocality": null, "primaryLocality": "London", "state": "Greater London", "stateCode": null, "postalCode": "W10 5JJ", "countryName": "United Kingdom", "countryCode": "GB" } }, "associatedRecords": [ { "picklistDisplay": "A P D A London Ltd", "overrides": { "singleLine": "A P D A London Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "A P D A London Ltd" } } }, { "picklistDisplay": "Barton Engineers", "overrides": { "singleLine": "Barton Engineers, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Barton Engineers" } } }, { "picklistDisplay": "Bloobloom", "overrides": { "singleLine": "Bloobloom, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Bloobloom" } } }, { "picklistDisplay": "Buchanan Advertising (UK) Ltd", "overrides": { "singleLine": "Buchanan Advertising (UK) Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Buchanan Advertising (UK) Ltd" } } }, { "picklistDisplay": "Frescobol", "overrides": { "singleLine": "Frescobol, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Frescobol" } } }, { "picklistDisplay": "Fusion One International Ltd", "overrides": { "singleLine": "Fusion One International Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Fusion One International Ltd" } } }, { "picklistDisplay": "Goodwood Contractors Ltd", "overrides": { "singleLine": "Goodwood Contractors Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Goodwood Contractors Ltd" } } }, { "picklistDisplay": "Indie Bay Snacks", "overrides": { "singleLine": "Indie Bay Snacks, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Indie Bay Snacks" } } }, { "picklistDisplay": "Intelligent Imaging Innovations Ltd", "overrides": { "singleLine": "Intelligent Imaging Innovations Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Intelligent Imaging Innovations Ltd" } } }, { "picklistDisplay": "Ottoman Hands Ltd", "overrides": { "singleLine": "Ottoman Hands Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Ottoman Hands Ltd" } } }, { "picklistDisplay": "Paymentsense", "overrides": { "singleLine": "Paymentsense, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Paymentsense" } } }, { "picklistDisplay": "Perfect Storm Media Ltd", "overrides": { "singleLine": "Perfect Storm Media Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Perfect Storm Media Ltd" } } }, { "picklistDisplay": "Phycobloom Ltd", "overrides": { "singleLine": "Phycobloom Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Phycobloom Ltd" } } }, { "picklistDisplay": "Powder Bowl Trading Ltd", "overrides": { "singleLine": "Powder Bowl Trading Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Powder Bowl Trading Ltd" } } }, { "picklistDisplay": "Rachel Nevin Communications", "overrides": { "singleLine": "Rachel Nevin Communications, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Rachel Nevin Communications" } } }, { "picklistDisplay": "Rigby & Marchant Ltd", "overrides": { "singleLine": "Rigby & Marchant Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Rigby & Marchant Ltd" } } }, { "picklistDisplay": "Sophie Harley London", "overrides": { "singleLine": "Sophie Harley London, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Sophie Harley London" } } }, { "picklistDisplay": "Twotwentyseven", "overrides": { "singleLine": "Twotwentyseven, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Twotwentyseven" } } }, { "picklistDisplay": "V M V Studio", "overrides": { "singleLine": "V M V Studio, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "V M V Studio" } } }, { "picklistDisplay": "Westbourne Studios", "overrides": { "singleLine": "Westbourne Studios, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Westbourne Studios" } } }, { "picklistDisplay": "Workspace Management", "overrides": { "singleLine": "Workspace Management, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Workspace Management" } } }, { "picklistDisplay": "Yousoft Ltd", "overrides": { "singleLine": "Yousoft Ltd, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Yousoft Ltd" } } }, { "picklistDisplay": "Zalacain Wayfinding", "overrides": { "singleLine": "Zalacain Wayfinding, 242 Acklam Road, London, W10 5JJ, United Kingdom", "multiLine": { "companyName": "Zalacain Wayfinding" } } } ] }
suggestion with associatedRecords and an attention line
The attention line is preserved in line1. Each associated-record override adds the selected company while leaving the attention line in place.
{ "singleLine": "FAO Accounts Payable, 65 Alfred Rod, London, W2 5EU, United Kingdom", "countryCode": "GB" }
{ "validation": { "result": "suggestion", "resolution": "premise" }, "address": { "singleLine": "FAO Accounts Payable, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": null, "line1": "FAO Accounts Payable", "line2": "65 Alfred Road", "line3": null, "tertiaryLocality": null, "secondaryLocality": null, "primaryLocality": "London", "state": "Greater London", "stateCode": null, "postalCode": "W2 5EU", "countryName": "United Kingdom", "countryCode": "GB" } }, "associatedRecords": [ { "picklistDisplay": "Blaiz Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Blaiz Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Blaiz Ltd" } } }, { "picklistDisplay": "Carnot Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Carnot Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Carnot Ltd" } } }, { "picklistDisplay": "Craster Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Craster Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Craster Ltd" } } }, { "picklistDisplay": "Daisy Global Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Daisy Global Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Daisy Global Ltd" } } }, { "picklistDisplay": "Davina Combe Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Davina Combe Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Davina Combe Ltd" } } }, { "picklistDisplay": "Great Western Studios", "overrides": { "singleLine": "FAO Accounts Payable, Great Western Studios, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Great Western Studios" } } }, { "picklistDisplay": "Italspirits Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Italspirits Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Italspirits Ltd" } } }, { "picklistDisplay": "Moxon Architects Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Moxon Architects Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Moxon Architects Ltd" } } }, { "picklistDisplay": "Nishura Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Nishura Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Nishura Ltd" } } }, { "picklistDisplay": "Obatan Llc", "overrides": { "singleLine": "FAO Accounts Payable, Obatan Llc, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Obatan Llc" } } }, { "picklistDisplay": "R F Gill & Associates", "overrides": { "singleLine": "FAO Accounts Payable, R F Gill & Associates, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "R F Gill & Associates" } } }, { "picklistDisplay": "Run For The Hills", "overrides": { "singleLine": "FAO Accounts Payable, Run For The Hills, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Run For The Hills" } } }, { "picklistDisplay": "Solid Floor Ltd", "overrides": { "singleLine": "FAO Accounts Payable, Solid Floor Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Solid Floor Ltd" } } }, { "picklistDisplay": "Stephen Fletcher Architects", "overrides": { "singleLine": "FAO Accounts Payable, Stephen Fletcher Architects, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "Stephen Fletcher Architects" } } }, { "picklistDisplay": "What3words Ltd", "overrides": { "singleLine": "FAO Accounts Payable, What3words Ltd, 65 Alfred Road, London, W2 5EU, United Kingdom", "multiLine": { "companyName": "What3words Ltd" } } } ] }
none
{ "singleLine": "This is not a real address", "countryCode": "GB" }
{ "validation": { "result": "none", "resolution": null }, "address": null, "associatedRecords": null }
| HTTP code | Meaning | What to do |
|---|---|---|
| 400 | The request contains malformed JSON or fails request validation, such as when no non-empty address component is provided. | Correct the request. Do not retry it unchanged. |
| 401 | The X-API-Key header is missing or contains an invalid key. | Check the key and header name. |
| 429 | Too many requests. | Back off and retry after the period indicated in Retry-After. |
| 500 | An unexpected error occurred on the server. | Retry with backoff. If the problem persists, contact support. |