Address API
- Base URL:
https://address.sls.epilot.io - Full API Docs: https://docs.epilot.io/api/address
Usageโ
import { epilot } from '@epilot/sdk'
epilot.authorize(() => '<token>')
const { data } = await epilot.address.getAddressSuggestions(...)
Tree-shakeable importโ
import { getClient, authorize } from '@epilot/sdk/address'
const addressClient = getClient()
authorize(addressClient, () => '<token>')
const { data } = await addressClient.getAddressSuggestions(...)
Operationsโ
Address Suggestion
Availability
Schemas
AvailabilityCheckParamsAvailabilityFiltersAvailabilityDateAvailabilityLocationAvailabilityResultValidateAvailabilityFileResultValidateAvailabilityFileErrorAddressSuggestionAddressSuggestionsErrorResponse
getAddressSuggestionsโ
Get address suggestions for the given Availability File
GET /v1/public/suggestions
const { data } = await client.getAddressSuggestions({
fileRef: 'example',
countryCodeSearchTerm: 'example',
postalCodeSearchTerm: 'example',
streetSearchTerm: 'example',
})
Response
[
{
"country": "st",
"postal_code": "string",
"city": "string",
"street": "string",
"street_number": "string"
}
]
availabilityCheckโ
Check for Entities that contain a matching availability range in related availability files.
POST /v1/public/availability
const { data } = await client.availabilityCheck(
null,
{},
)
Response
{
"available_entities": [],
"check_results": [
{
"entity_id": "72c803b2-2e5d-4bd6-bffc-fad998bbbe36",
"matching_hits": 0
},
{
"entity_id": "72c803b2-2e5d-4bd6-bffc-fad998bbbe37",
"matching_hits": 0
}
]
}
validateAvailabilityFileโ
Validates an already uploaded availability file, it returns an array of errors if any errors are found in the file.
GET /v1/availability/{id}/validate
const { data } = await client.validateAvailabilityFile({
id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
"status": "success",
"rules_parsed_count": 0,
"errors": [
{
"line": 0,
"message": "string",
"data": "string"
}
]
}
Schemasโ
AvailabilityCheckParamsโ
type AvailabilityCheckParams = {
entities: string // uuid[]
schemas?: string[]
filters: {
location: {
street?: { ... }
street_number?: { ... }
postal_code?: { ... }
city?: { ... }
country?: { ... }
}
available_date?: string // date
}
}
AvailabilityFiltersโ
Availability filters dimensions
type AvailabilityFilters = {
location: {
street?: string
street_number?: string
postal_code?: string
city?: string
country?: string
}
available_date?: string // date
}
AvailabilityDateโ
A value to be matched against the availability window (start & end date)
type AvailabilityDate = string // date
AvailabilityLocationโ
type AvailabilityLocation = {
street?: string
street_number?: string
postal_code?: string
city?: string
country?: string
}
AvailabilityResultโ
The availability check result payload
type AvailabilityResult = {
available_entities: string[]
check_results: Array<{
entity_id: string // uuid
matching_hits: number
matching_error?: object
}>
}
ValidateAvailabilityFileResultโ
The availability map file result payload
type ValidateAvailabilityFileResult = {
status: "success" | "error"
rules_parsed_count: number
errors: Array<{
line?: number
message: string
data?: string
}>
}
ValidateAvailabilityFileErrorโ
The availability rule error
type ValidateAvailabilityFileError = {
line?: number
message: string
data?: string
}
AddressSuggestionโ
The address suggestions entity
type AddressSuggestion = {
country?: string
postal_code?: string // postal-code
city?: string // city
street?: string // street-address
street_number?: string // street-number
}
AddressSuggestionsโ
The address suggestions entity array
type AddressSuggestions = Array<{
country?: string
postal_code?: string // postal-code
city?: string // city
street?: string // street-address
street_number?: string // street-number
}>
ErrorResponseโ
type ErrorResponse = {
error: string
}