Skip to main content

Postal Codes

The Postal Codes GraphQL API provides access to postal code data including geographic coordinates, country/state associations, and automatic time zone resolution from GPS coordinates.

Overview

  • Entity: postalCode
  • Queries: Single lookup by ID, paginated list with search/filter/sort
  • Time Zone Resolution: Automatically resolves time zone from latitude/longitude when not stored
  • Search: By postal code or place name (case-insensitive)

GraphQL Schema

Types

postalCode

type postalCode {
id: Int!
accuracy: AccuracyTypes
code: String!
countryCode: String!
country: country!
created: DateTime!
createdBy: String!
customValues: Map
lastModified: DateTime!
lastModifiedBy: String!
location: [Float]
longitude: Float
latitude: Float
organizationId: Int!
placeName: String!
stateCode: String
timeZone: String
state: state
updatedUser: user!
createdUser: user!
}

Key fields:

FieldTypeDescription
codeString!The postal/ZIP code
placeNameString!City or locality name
countryCodeString!ISO country code
stateCodeStringState/province code
latitudeFloatGPS latitude coordinate
longitudeFloatGPS longitude coordinate
location[Float]Raw coordinate array [longitude, latitude]
timeZoneStringIANA time zone identifier (e.g., America/New_York) — resolved automatically from coordinates if not stored
accuracyAccuracyTypesGeocoding accuracy level
customValuesMapCustom key-value data
countrycountry!Related country entity
statestateRelated state/province entity

Time Zone Resolution

The timeZone field uses a smart resolver that:

  1. Returns the stored time zone if one exists on the postal code record
  2. Otherwise, computes the time zone from the latitude and longitude coordinates using GPS-based lookup
  3. Returns null if no stored time zone exists and coordinates are unavailable

This means you can always request timeZone and get a resolved value for any postal code that has GPS coordinates, even if the time zone was never explicitly stored.

Queries

Get Single Postal Code

Retrieve a specific postal code by ID.

query {
postalCode(
organizationId: 1
id: 456
) {
id
code
placeName
countryCode
stateCode
latitude
longitude
timeZone
country {
name
}
state {
name
}
}
}

List Postal Codes

Retrieve a paginated list of postal codes with optional search, filter, and sort.

query {
postalCodes(
organizationId: 1
search: "9001"
orderBy: "code asc"
skip: 0
take: 25
) {
items {
id
code
placeName
countryCode
latitude
longitude
timeZone
}
pageInfo {
hasNextPage
hasPreviousPage
}
totalCount
}
}

Parameters:

ParameterRequiredDescription
organizationIdYesOrganization ID
searchNoSearch by postal code or place name (case-insensitive, partial match)
filterNoFilter expression
orderByNoSort order (e.g., "code asc", "placeName desc")
skipNoNumber of items to skip for pagination
takeNoNumber of items to return

Example: Look Up Time Zone for a Postal Code

query {
postalCodes(
organizationId: 1
search: "10001"
) {
items {
code
placeName
timeZone
latitude
longitude
}
}
}

Response:

{
"data": {
"postalCodes": {
"items": [
{
"code": "10001",
"placeName": "New York",
"timeZone": "America/New_York",
"latitude": 40.7484,
"longitude": -73.9967
}
]
}
}
}