{
"openapi": "3.0.2",
"info": {
"title": "Klaviyo API (Beta)",
"version": "2026-10-15.pre",
"description": "The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details.",
"contact": {
"name": "Klaviyo Developer Experience Team",
"email": "developers@klaviyo.com",
"url": "https://developers.klaviyo.com"
},
"termsOfService": "https://www.klaviyo.com/legal/api-terms",
"license": {
"name": "License",
"url": "https://www.klaviyo.com/legal"
}
},
"servers": [
{
"url": "https://a.klaviyo.com",
"description": "Production"
}
],
"security": [
{
"Klaviyo-API-Key": []
}
],
"paths": {
"/api/locations/{id}/relationships/segments": {
"post": {
"operationId": "add_segments_to_location_beta",
"summary": "Add Segments to Location",
"description": "\n > \ud83d\udea7 This endpoint is in beta and subject to change.\n >\n > 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) for more information.\n\nLink existing segments to a location.\n\nSegments already linked to this location are left alone, so sending the same request twice changes nothing. A segment linked to a *different* location moves to this one.\n\nTo create a new segment first, use `POST /api/segments`.
*Rate limits*:
Burst: `3/s`
Steady: `60/m`\n\n**Scopes:**\n`locations:write`\n`segments:write`\n\n[OpenAPI Spec](https://raw.githubusercontent.com/klaviyo/openapi/main/openapi/beta/apis/add_segments_to_location_beta.json)",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "revision",
"in": "header",
"description": "API endpoint revision (format: YYYY-MM-DD[.suffix])",
"required": true,
"schema": {
"type": "string",
"default": "2026-10-15.pre"
}
}
],
"requestBody": {
"description": "A segment as a JSON:API resource identifier.\n\nWritten out rather than derived with ``TypeAndIdOnly`` because a dynamically built class can't be used as a type annotation.",
"required": true,
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "#/components/schemas/SegmentIdentifierRequestDataListWrapper"
}
}
}
},
"responses": {
"204": {
"description": "Success"
},
"4XX": {
"$ref": "#/components/responses/ClientError"
},
"5XX": {
"$ref": "#/components/responses/ServerError"
}
},
"tags": [
"Beta APIs"
],
"x-klaviyo-operation-aliases": [
"create_location_relationships_segments"
],
"x-klaviyo-pre-release": "BETA",
"x-klaviyo-ratelimit": {
"burst": "3/s",
"steady": "60/m"
},
"x-klaviyo-scopes": [
"locations:write",
"segments:write"
],
"x-klaviyo-subtag": "Location Hub"
}
}
},
"components": {
"responses": {
"ClientError": {
"description": "Client Error",
"content": {
"application/vnd.api+json": {
"schema": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"type": "object",
"required": [
"id",
"code",
"title",
"detail"
],
"properties": {
"id": {
"type": "string"
},
"code": {
"type": "string"
},
"title": {
"type": "string"
},
"detail": {
"type": "string"
},
"source": {
"type": "object",
"properties": {
"pointer": {
"type": "string"
},
"parameter": {
"type": "string"
}
}
}
}
}
}
},
"required": [
"errors"
]
}
}
}
},
"ServerError": {
"description": "Server Error",
"content": {
"application/vnd.api+json": {
"schema": {
"type": "object",
"properties": {
"errors": {
"type": "array",
"items": {
"type": "object",
"required": [
"id",
"code",
"title",
"detail"
],
"properties": {
"id": {
"type": "string"
},
"code": {
"type": "string"
},
"title": {
"type": "string"
},
"detail": {
"type": "string"
},
"source": {
"type": "object",
"properties": {
"pointer": {
"type": "string"
},
"parameter": {
"type": "string"
}
}
}
}
}
}
},
"required": [
"errors"
]
}
}
}
}
},
"schemas": {
"SegmentIdentifierRequestData": {
"type": "object",
"properties": {
"type": {
"$ref": "#/components/schemas/SegmentResourceName"
},
"id": {
"description": "Identifier of the segment.",
"type": "string",
"example": "01HQ8V5X9K2M4N6P8R0T2W4Y6A"
}
},
"required": [
"type",
"id"
]
},
"SegmentIdentifierRequestDataListWrapper": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SegmentIdentifierRequestData"
}
}
},
"required": [
"data"
]
},
"SegmentResourceName": {
"type": "string",
"enum": [
"segment"
]
}
},
"securitySchemes": {
"Klaviyo-API-Key": {
"type": "apiKey",
"in": "header",
"name": "Authorization",
"description": "Private key authentication for /api/ endpoints is performed by setting the `Authorization` header to `Klaviyo-API-Key your-private-api-key`
For more information please visit https://developers.klaviyo.com/en/v2026-10-15.pre/reference/api-overview#authentication",
"x-default": "Klaviyo-API-Key your-private-api-key"
}
}
},
"tags": [
{
"name": "Beta APIs",
"description": "beta apis"
}
]
}