Skip to main content

Address Suggestions API

Usageโ€‹

import { epilot } from '@epilot/sdk'

epilot.authorize(() => '<token>')
const { data } = await epilot.addressSuggestions.getAddresses(...)

Tree-shakeable importโ€‹

import { getClient, authorize } from '@epilot/sdk/address-suggestions'

const addressSuggestionsClient = getClient()
authorize(addressSuggestionsClient, () => '<token>')
const { data } = await addressSuggestionsClient.getAddresses(...)

Operationsโ€‹

Addresses API

Schemas

getAddressesโ€‹

get addresses from file

GET /v1/public/suggestions

const { data } = await client.getAddresses({
X-Epilot-Org-ID: 'example',
s3FileUrl: 'example',
fileId: 'example',
countryCodeSearchTerm: 'example',
postalCodeSearchTerm: 'example',
streetSearchTerm: 'example',
})
Response
[
{
"country": "string",
"postal_code": "string",
"city": "string",
"street": "string",
"street_number": "string"
}
]

checkAvailabilityโ€‹

Check address availability

GET /v1/public/availability:check

const { data } = await client.checkAvailability({
X-Epilot-Org-ID: 'example',
files: 'example',
countryCode: 'example',
postalCode: 'example',
street: 'example',
streetNumber: 'example',
})
Response
{
"fileId": "4e7b7d95-ced6-4f5f-9326-0c61f30dcadb"
}

validateAddressesFileโ€‹

validate addresses file

GET /v1/addresses-files:validate

const { data } = await client.validateAddressesFile({
fileId: 'example',
})
Response
{
"status": "success",
"rules_parsed_count": 0,
"errors": [
{
"line": 0,
"msg": "string",
"data": "string"
}
]
}

Schemasโ€‹

AvailabilityLocationโ€‹

type AvailabilityLocation = {
street?: string
street_number?: string
postal_code?: string
city?: string
country?: string
}

AvailabilityResultโ€‹

type AvailabilityResult = {
fileId?: string
}

Errorโ€‹

type Error = {
message: string
status?: number
cause?: string
}

AddressSuggestionโ€‹

The address suggestions entity

type AddressSuggestion = {
country?: string
postal_code?: string
city?: string
street?: string
street_number?: string
}

AddressSuggestionsโ€‹

The address suggestions entity array

type AddressSuggestions = Array<{
country?: string
postal_code?: string
city?: string
street?: string
street_number?: string
}>

ValidateAddressSuggestionsFileResultโ€‹

The availability map file result payload

type ValidateAddressSuggestionsFileResult = {
status?: "success" | "error"
rules_parsed_count?: number
errors?: Array<{
line?: number
msg: string
data?: string
}>
}

ValidateAddressFileResultโ€‹

The address file validation result payload

type ValidateAddressFileResult = {
status?: "success" | "error"
rules_parsed_count?: number
errors?: Array<{
line?: number
msg: string
data?: string
}>
}

AddressSuggestionErrorโ€‹

The availability rule error

type AddressSuggestionError = {
line?: number
msg: string
data?: string
}

ValidateAddressFileErrorโ€‹

The address rule error

type ValidateAddressFileError = {
line?: number
msg: string
data?: string
}