> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Placekey API reference

> API reference for the Placekey plugin in Corsair: every `placekey.api.*` operation with its input and output types, taken from the plugin's Zod schemas.

> [!NOTE]
>
> **New to Corsair?** See [API access](https://docs.corsair.dev/concepts/api.md), [authentication](https://docs.corsair.dev/concepts/auth.md), and [error handling](https://docs.corsair.dev/concepts/error-handling).

## Geocode

### fromAddress

`geocode.fromAddress`

Get the Placekey plus latitude/longitude and precision (geocode.location, geocode.location\_type) for an address. Uses two lookups.

**Risk:** `read`

```ts theme={null}
await corsair.placekey.api.geocode.fromAddress({ streetAddress: '598 Portola Dr', city: 'San Francisco', region: 'CA', isoCountryCode: 'US' });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `queryId` | `string` | No | Echoed back as query\_id in the answer |
| `locationName` | `string` | No | Name of the place |
| `streetAddress` | `string` | Yes | — |
| `city` | `string` | No | — |
| `region` | `string` | No | State or province, e.g. CA |
| `postalCode` | `string` | No | — |
| `isoCountryCode` | `string` | No | Two-letter country code, e.g. US |
| `latitude` | `number` | No | — |
| `longitude` | `number` | No | — |
| `placeMetadata` | `object` | No | Business details that help match a point of interest. |
| `fields` | `(address_placekey \| building_placekey \| confidence_score \| normalized_address \| geocode \| upi \| parcel \| geoid \| gers)[]` | No | Extra fields to return. geocode counts as a second lookup per query. |

POST /v1/placekey with options.fields including geocode. geocode.location has lat and lng (not longitude); location\_type is ROOFTOP, PARCEL, APPROXIMATE or RANGE\_INTERPOLATED. Costs two lookups.

> [accordion] placeMetadata full type
>
> ```ts theme={null}
> {
>   phoneNumber?: string,
>   naicsCode?: string,
>   website?: string,
>   mccCode?: string,
>   storeId?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `query_id` | `string \| number \| null` | No | — |
| `placekey` | `string \| null` | No | — |
| `error` | `string \| null` | No | — |
| `address_placekey` | `string \| null` | No | — |
| `building_placekey` | `string \| null` | No | — |
| `confidence_score` | `string \| null` | No | — |
| `normalized_address` | `object \| null` | No | — |
| `geocode` | `object \| null` | No | — |
| `upi` | `string \| null` | No | — |
| `parcel` | `string \| null` | No | — |
| `geoid` | `string \| null` | No | — |
| `gers` | `string \| null` | No | — |

> [accordion] normalized\_address full type
>
> ```ts theme={null}
> {
>   primary_number?: string | null,
>   street_name?: string | null,
>   street_suffix?: string | null,
>   formatted_street?: string | null,
>   city?: string | null,
>   region?: string | null,
>   postal_code?: string | null,
>   iso_country_code?: string | null
> } | null
> ```

> [accordion] geocode full type
>
> ```ts theme={null}
> {
>   location?: {
>     lat?: number | null,
>     lng?: number | null
>   } | null,
>   location_type?: string | null
> } | null
> ```

***

## Placekey

### fromAddress

`placekey.fromAddress`

Get the Placekey for a street address, optionally with a place name for a point of interest. Needs region and country plus city or postal code.

**Risk:** `read`

```ts theme={null}
await corsair.placekey.api.placekey.fromAddress({});
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `queryId` | `string` | No | Echoed back as query\_id in the answer |
| `locationName` | `string` | No | Name of the place |
| `streetAddress` | `string` | Yes | — |
| `city` | `string` | No | — |
| `region` | `string` | No | State or province, e.g. CA |
| `postalCode` | `string` | No | — |
| `isoCountryCode` | `string` | No | Two-letter country code, e.g. US |
| `latitude` | `number` | No | — |
| `longitude` | `number` | No | — |
| `placeMetadata` | `object` | No | Business details that help match a point of interest. |
| `fields` | `(address_placekey \| building_placekey \| confidence_score \| normalized_address \| geocode \| upi \| parcel \| geoid \| gers)[]` | No | Extra fields to return. geocode counts as a second lookup per query. |

POST /v1/placekey with an address query.

> [accordion] placeMetadata full type
>
> ```ts theme={null}
> {
>   phoneNumber?: string,
>   naicsCode?: string,
>   website?: string,
>   mccCode?: string,
>   storeId?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `query_id` | `string \| number \| null` | No | — |
| `placekey` | `string \| null` | No | — |
| `error` | `string \| null` | No | — |
| `address_placekey` | `string \| null` | No | — |
| `building_placekey` | `string \| null` | No | — |
| `confidence_score` | `string \| null` | No | — |
| `normalized_address` | `object \| null` | No | — |
| `geocode` | `object \| null` | No | — |
| `upi` | `string \| null` | No | — |
| `parcel` | `string \| null` | No | — |
| `geoid` | `string \| null` | No | — |
| `gers` | `string \| null` | No | — |

> [accordion] normalized\_address full type
>
> ```ts theme={null}
> {
>   primary_number?: string | null,
>   street_name?: string | null,
>   street_suffix?: string | null,
>   formatted_street?: string | null,
>   city?: string | null,
>   region?: string | null,
>   postal_code?: string | null,
>   iso_country_code?: string | null
> } | null
> ```

> [accordion] geocode full type
>
> ```ts theme={null}
> {
>   location?: {
>     lat?: number | null,
>     lng?: number | null
>   } | null,
>   location_type?: string | null
> } | null
> ```

***

### fromCoordinates

`placekey.fromCoordinates`

Get the Where part of a Placekey (the hexagon, e.g. @5vg-82n-kzz) for a latitude and longitude.

**Risk:** `read`

```ts theme={null}
await corsair.placekey.api.placekey.fromCoordinates({ latitude: 37.7371, longitude: -122.44283 });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `queryId` | `string` | No | Echoed back as query\_id in the answer |
| `latitude` | `number` | Yes | — |
| `longitude` | `number` | Yes | — |
| `fields` | `(address_placekey \| building_placekey \| confidence_score \| normalized_address \| geocode \| upi \| parcel \| geoid \| gers)[]` | No | Extra fields to return. geocode counts as a second lookup per query. |

POST /v1/placekey with latitude and longitude only. Returns just the Where part, e.g. @5vg-82n-kzz.

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `query_id` | `string \| number \| null` | No | — |
| `placekey` | `string \| null` | No | — |
| `error` | `string \| null` | No | — |
| `address_placekey` | `string \| null` | No | — |
| `building_placekey` | `string \| null` | No | — |
| `confidence_score` | `string \| null` | No | — |
| `normalized_address` | `object \| null` | No | — |
| `geocode` | `object \| null` | No | — |
| `upi` | `string \| null` | No | — |
| `parcel` | `string \| null` | No | — |
| `geoid` | `string \| null` | No | — |
| `gers` | `string \| null` | No | — |

> [accordion] normalized\_address full type
>
> ```ts theme={null}
> {
>   primary_number?: string | null,
>   street_name?: string | null,
>   street_suffix?: string | null,
>   formatted_street?: string | null,
>   city?: string | null,
>   region?: string | null,
>   postal_code?: string | null,
>   iso_country_code?: string | null
> } | null
> ```

> [accordion] geocode full type
>
> ```ts theme={null}
> {
>   location?: {
>     lat?: number | null,
>     lng?: number | null
>   } | null,
>   location_type?: string | null
> } | null
> ```

***

### get

`placekey.get`

Get the Placekey for one place from any mix of name, address, coordinates and business details (phone, website, NAICS/MCC code, store id). fields adds address/building Placekeys, confidence, normalized address, geocode, parcel ids and GERS. A query that cannot be matched comes back with error instead of placekey.

**Risk:** `read`

```ts theme={null}
await corsair.placekey.api.placekey.get({ locationName: 'Twin Peaks Petroleum', streetAddress: '598 Portola Dr', city: 'San Francisco', region: 'CA', postalCode: '94131', isoCountryCode: 'US', fields: ['address_placekey', 'confidence_score', 'normalized_address'] });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `queryId` | `string` | No | Echoed back as query\_id in the answer |
| `locationName` | `string` | No | Name of the place |
| `streetAddress` | `string` | No | — |
| `city` | `string` | No | — |
| `region` | `string` | No | State or province, e.g. CA |
| `postalCode` | `string` | No | — |
| `isoCountryCode` | `string` | No | Two-letter country code, e.g. US |
| `latitude` | `number` | No | — |
| `longitude` | `number` | No | — |
| `placeMetadata` | `object` | No | Business details that help match a point of interest. |
| `fields` | `(address_placekey \| building_placekey \| confidence_score \| normalized_address \| geocode \| upi \| parcel \| geoid \| gers)[]` | No | Extra fields to return. geocode counts as a second lookup per query. |

POST /v1/placekey. Minimum input is a street address with region and country (plus city or postal code), or latitude and longitude. A place name (locationName) gives the point-of-interest Placekey (What\@Where); placeMetadata (phone, website, NAICS/MCC code, store id) improves the match.

> [accordion] placeMetadata full type
>
> ```ts theme={null}
> {
>   phoneNumber?: string,
>   naicsCode?: string,
>   website?: string,
>   mccCode?: string,
>   storeId?: string
> }
> ```

**Output**

| Name | Type | Required | Description |
| - | - | - | - |
| `query_id` | `string \| number \| null` | No | — |
| `placekey` | `string \| null` | No | — |
| `error` | `string \| null` | No | — |
| `address_placekey` | `string \| null` | No | — |
| `building_placekey` | `string \| null` | No | — |
| `confidence_score` | `string \| null` | No | — |
| `normalized_address` | `object \| null` | No | — |
| `geocode` | `object \| null` | No | — |
| `upi` | `string \| null` | No | — |
| `parcel` | `string \| null` | No | — |
| `geoid` | `string \| null` | No | — |
| `gers` | `string \| null` | No | — |

> [accordion] normalized\_address full type
>
> ```ts theme={null}
> {
>   primary_number?: string | null,
>   street_name?: string | null,
>   street_suffix?: string | null,
>   formatted_street?: string | null,
>   city?: string | null,
>   region?: string | null,
>   postal_code?: string | null,
>   iso_country_code?: string | null
> } | null
> ```

> [accordion] geocode full type
>
> ```ts theme={null}
> {
>   location?: {
>     lat?: number | null,
>     lng?: number | null
>   } | null,
>   location_type?: string | null
> } | null
> ```

***

## Placekeys

### bulk

`placekeys.bulk`

Get Placekeys for up to 100 places in one request. Each query counts as a lookup; answers come back in order with query\_id.

**Risk:** `read`

```ts theme={null}
await corsair.placekey.api.placekeys.bulk({ queries: [{ queryId: 'a', streetAddress: '598 Portola Dr', city: 'San Francisco', region: 'CA', isoCountryCode: 'US' }, { latitude: 37.7371, longitude: -122.44283 }], fields: ['confidence_score'] });
```

**Input**

| Name | Type | Required | Description |
| - | - | - | - |
| `queries` | `object[]` | Yes | Up to 100 queries, all with the same isoCountryCode (queries without one are fine). |
| `fields` | `(address_placekey \| building_placekey \| confidence_score \| normalized_address \| geocode \| upi \| parcel \| geoid \| gers)[]` | No | Extra fields to return. geocode counts as a second lookup per query. |

POST /v1/placekeys with up to 100 queries and one fields list for all of them. Placekey's docs ask that the queries share one country code. Unnamed queries get query\_id "0", "1", ... by position.

> [accordion] queries full type
>
> ```ts theme={null}
> {
>   queryId?: string,
>   locationName?: string,
>   streetAddress?: string,
>   city?: string,
>   region?: string,
>   postalCode?: string,
>   isoCountryCode?: string,
>   latitude?: number,
>   longitude?: number,
>   placeMetadata?: {
>     phoneNumber?: string,
>     naicsCode?: string,
>     website?: string,
>     mccCode?: string,
>     storeId?: string
>   }
> }[]
> ```

**Output:** `object[]`

> [accordion] Output full type
>
> ```ts theme={null}
> {
>   query_id?: string | number | null,
>   placekey?: string | null,
>   error?: string | null,
>   address_placekey?: string | null,
>   building_placekey?: string | null,
>   confidence_score?: string | null,
>   normalized_address?: {
>     primary_number?: string | null,
>     street_name?: string | null,
>     street_suffix?: string | null,
>     formatted_street?: string | null,
>     city?: string | null,
>     region?: string | null,
>     postal_code?: string | null,
>     iso_country_code?: string | null
>   } | null,
>   geocode?: {
>     location?: {
>       lat?: number | null,
>       lng?: number | null
>     } | null,
>     location_type?: string | null
>   } | null,
>   upi?: string | null,
>   parcel?: string | null,
>   geoid?: string | null,
>   gers?: string | null
> }[]
> ```

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.