---
title: "Create Proximity Segment Definition"
description: "How to call Create Proximity Segment Definition (POST /api/proximity-segment-definitions) in the Klaviyo REST API: authentication, parameters, request and response bodies, and an example request."
url: "https://developers.klaviyo.com/en/reference/query_proximity_segment_definition_beta"
revision: "2026-10-15.pre"
operationId: "query_proximity_segment_definition_beta"
aliases: ["create_proximity_segment_definition"]
method: "POST"
endpoint: "https://a.klaviyo.com/api/proximity-segment-definitions"
authentication: "privateKey"
scopes: ["locations:read","segments:read"]
rateLimits: {"burst":"10/s","steady":"150/m"}
revisionHeader: {"name":"revision","required":true}
deprecated: false
preRelease: "BETA"
openApi: "https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/query_proximity_segment_definition_beta.json"
jsonApi: {"fields":{"proximity-segment-definition":["definition","id","name"]}}
related: ["https://developers.klaviyo.com/en/reference/location-hub-beta/llms.txt","https://developers.klaviyo.com/en/reference/get_locations_beta.md","https://developers.klaviyo.com/en/reference/get_location_beta.md","https://developers.klaviyo.com/en/reference/create_location_beta.md","https://developers.klaviyo.com/en/reference/update_location_beta.md","https://developers.klaviyo.com/en/reference/delete_location_beta.md","https://developers.klaviyo.com/en/reference/get_location_hub_setting_beta.md","https://developers.klaviyo.com/en/reference/update_location_hub_setting_beta.md","https://developers.klaviyo.com/en/reference/get_segment_ids_for_location_beta.md","https://developers.klaviyo.com/en/reference/add_segments_to_location_beta.md","https://developers.klaviyo.com/en/reference/remove_segments_from_location_beta.md","https://developers.klaviyo.com/en/reference/get_segments_for_location_beta.md"]
---

# Create Proximity Segment Definition

> This is the Markdown version of https://developers.klaviyo.com/en/reference/query_proximity_segment_definition_beta

```http
POST https://a.klaviyo.com/api/proximity-segment-definitions
```


> [!WARNING]
> **This endpoint is in beta and subject to change.**
> A beta revision header (2026-10-15.pre) is required to use our beta APIs. Klaviyo APIs in beta are not intended for use in production. See our [versioning and deprecation policy](https://developers.klaviyo.com/en/docs/api_versioning_and_deprecation_policy.md) for more information.


Build a segment definition that targets profiles near a location.

Nothing is created or stored. Pass the returned `name` and `definition` to `POST /api/segments`, then link the result with `POST /api/locations/{id}/relationships/segments`.

The definition matches on the location's postal code and country, so a location missing either cannot produce one.

- Revision header: `revision: 2026-10-15.pre` (required)
- Scopes: `locations:read`, `segments:read`
- Rate limits: Burst: `10/s`, Steady: `150/m`
- OpenAPI: [Download this endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/query_proximity_segment_definition_beta.json)

## Example request

### curl

```bash
curl --request POST \
     --url 'https://a.klaviyo.com/api/proximity-segment-definitions' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'revision: 2026-10-15.pre' \
     --header 'content-type: application/vnd.api+json' \
     --data '{
  "data": {
    "type": "proximity-segment-definition",
    "attributes": {
      "radius": 30,
      "unit": "miles"
    },
    "relationships": {
      "location": {
        "data": {
          "type": "location",
          "id": "01HQ8V5X9K2M4N6P8R0T2W4Y6A"
        }
      }
    }
  }
}'
```

### CLI

```bash
klaviyo beta location-hub query-proximity-segment-definition \
  -d '{
  "data": {
    "type": "proximity-segment-definition",
    "attributes": {
      "radius": 30,
      "unit": "miles"
    },
    "relationships": {
      "location": {
        "data": {
          "type": "location",
          "id": "01HQ8V5X9K2M4N6P8R0T2W4Y6A"
        }
      }
    }
  }
}'
```

Sign in first with `klaviyo auth login`. [Install the Klaviyo CLI](https://developers.klaviyo.com/en/docs/klaviyo_cli.md)

## Query parameters

- `fields[proximity-segment-definition]` (string[]): For more information please visit [API overview](https://developers.klaviyo.com/en/reference.md) Allowed values: `definition`, `id`, `name`

## Headers

- `revision` (string, required): API endpoint revision (format: YYYY-MM-DD[.suffix]) Default: `2026-10-15.pre`

## Request body

Content type: `application/vnd.api+json` (required)

- `data` (object, required)
  - `type` (string, required): Allowed values: `proximity-segment-definition`
  - `attributes` (object, required)
    - `radius` (number): Distance from the location that profiles must be within, in `unit`. Default: `30` Example: `30`
    - `unit` (string): Unit `radius` is measured in. Allowed values: `miles`, `kilometers` Default: `miles` Example: `miles`
  - `relationships` (object, required)
    - `location` (object, required)
      - `data` (object, required): Fields nested this deep are in [the endpoint's OpenAPI document](https://raw.githubusercontent.com/klaviyo/openapi/2026-10-15.pre/openapi/beta/apis/query_proximity_segment_definition_beta.json).

### Example request body

```json
{
  "data": {
    "type": "proximity-segment-definition",
    "attributes": {
      "radius": 30,
      "unit": "miles"
    },
    "relationships": {
      "location": {
        "data": {
          "type": "location",
          "id": "01HQ8V5X9K2M4N6P8R0T2W4Y6A"
        }
      }
    }
  }
}
```

## Responses

### 200: Success

Content type: `application/vnd.api+json`

- `data` (object, required)
  - `type` (string, required): Allowed values: `proximity-segment-definition`
  - `id` (string, required): Identifier of the location this definition was seeded from. Example: `01HQ8V5X9K2M4N6P8R0T2W4Y6A`
  - `attributes` (object, required)
    - `name` (string, required): Suggested segment name, taken from the location's name. Example: `Klaviyo Boston`
    - `definition` (object, required): The segment's conditions, in the same format the segments API uses. Pass this back unchanged when creating a segment through `POST /api/segments`.
  - `links` (object, required)
    - `self` (string<uri>, required)
- `links` (ObjectLinks): Same fields as the first ObjectLinks above.

#### Example response body

```json
{
  "data": {
    "type": "proximity-segment-definition",
    "id": "01HQ8V5X9K2M4N6P8R0T2W4Y6A",
    "attributes": {
      "name": "Klaviyo Boston",
      "definition": {}
    },
    "links": {
      "self": "https://www.example.com"
    }
  },
  "links": {
    "self": "https://www.example.com"
  }
}
```

### 4XX: Client Error

Content type: `application/vnd.api+json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```

### 5XX: Server Error

Content type: `application/vnd.api+json`

- `errors` (object[], required)
  - `id` (string, required)
  - `code` (string, required)
  - `title` (string, required)
  - `detail` (string, required)
  - `source` (object)
    - `pointer` (string)
    - `parameter` (string)

#### Example response body

```json
{
  "errors": [
    {
      "id": "string",
      "code": "string",
      "title": "string",
      "detail": "string",
      "source": {
        "pointer": "string",
        "parameter": "string"
      }
    }
  ]
}
```
