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

# Locations

The locations model describes your merchant's locations, addresses, and
configured POS loyalty and ordering provider identifiers.

> [card] SFTP Exports
>
> File name: `locations.csv`

> [card] Thanx Connex
>
> Table name: `locations`

## Attributes

Address and provider fields may be `NULL` when unavailable.

| Column | Data Type | Description |
| - | - | - |
| `location_id` | `string` | The unique identifier for this location. Use it to join to the location identifiers in [Memberships](https://docs.thanx.com/data/models/memberships.md) and [Purchases](https://docs.thanx.com/data/models/purchases.md). |
| `merchant_id` | `string` | The unique identifier of the merchant in Thanx. |
| `location_name` | `string` | The location's current name, as defined by the merchant. |
| `location_uid` | `string` | A nullable alternate location identifier used in Thanx APIs. This is distinct from the `location_id` export join key. |
| `synced_at` | `timestamp` | Latest source synchronization time for this record. |
| `location_street` | `string` | The location's street address. |
| `location_city` | `string` | The location's city. |
| `location_state` | `string` | The location's state or region. |
| `location_zip` | `string` | The location's postal code. Read it as text to preserve leading zeroes. |
| `pos_location_id` | `string` | The location identifier for the configured POS loyalty provider. |
| `pos_provider` | `string` | The configured direct POS loyalty provider. |
| `ordering_provider_location_id` | `string` | The location identifier for the configured integrated ordering provider. |
| `ordering_provider` | `string` | The configured integrated ordering provider. |

## Provider Mappings

Provider fields describe configured POS loyalty and ordering integrations.
A provider may be present without a location identifier. These fields do
not confirm current checkout routing or availability.

## Joining Memberships to Locations

After importing the exports as `memberships` and `locations`, join on
`location_id`. Use left joins to retain memberships with missing or unresolved
location IDs:

```sql theme={null}
SELECT
  m.user_id,
  signup.location_name AS current_signup_location_name,
  favorite.location_name AS current_favorite_location_name
FROM memberships AS m
LEFT JOIN locations AS signup
  ON m.signup_location_id = signup.location_id
LEFT JOIN locations AS favorite
  ON m.favorite_location_id = favorite.location_id;
```

The same join works for Purchases using `purchases.location_id`. Do not join
export location IDs to `location_uid`.


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