---
title: "Custom Objects"
description: "Reference documentation for the Custom Objects endpoints in the Klaviyo REST API."
url: "https://developers.klaviyo.com/en/v2026-01-15/reference/custom-objects"
revision: "2026-01-15"
llmsTxt: "https://developers.klaviyo.com/en/v2026-01-15/reference/custom-objects/llms.txt"
---

# Custom Objects

## What are custom objects?

Custom objects let you sync structured data into Klaviyo and link it to customer profiles — things like pet records, product subscriptions, reservations, or wishlist items. Once your data is in Klaviyo, you can use it to personalize emails, build segments, and trigger flows.

> [!NOTE]
> **Building an app?** If you are an app partner creating custom objects that should automatically appear in your customers' Klaviyo accounts when they install your app, see [Application objects for app partners](https://developers.klaviyo.com/en/docs/application_objects_for_app_partners.md) for the shared schema workflow and review process.

> [!WARNING]
> This API requires the following scopes:

- `custom-objects:read`
- `custom-objects:write`

## How it works

### Key concepts

- **Data source**: Represents a collection of data from an external system where your data source records live (e.g., a table from your internal database or Shopify Subscriptions). You send JSON records as data source records to a data source in Klaviyo. A single data source can be used by multiple object types. We recommend using different data sources for different payloads, but schema is not required or enforced for any data source records.
- **Object type**: The kind of custom object you're creating (e.g., "Pet", "Reservation"). Creating one automatically generates a draft **schema** and an empty **source mapping**.
- **Schema**: Defines the structure of your object — its properties and relationships. Starts in `draft` status. Must be set to `active` before data is processed into object records. You can only modify a schema's properties and relationships while it's in `draft`.
- **Configuration** (beta): Controls which properties are indexed for search and how records are displayed in Klaviyo. Unlike properties and relationships, you can update the configuration on an `active` schema. See [Configure search and display](#configure-search-and-display-beta).
- **Source mapping**: The bridge between your data source records and your schema. Uses [JSONPath](https://jsonpath.com/) expressions to extract fields from your data and map them to schema properties. Each property mapping references a data source by its `source_id`, which is how the data source connects to the object type.
- **Profile relationship**: Links each object record to a Klaviyo profile via an identifier like email, phone number, external ID, Klaviyo ID, or anonymous ID.

### Private vs. shared schema

Custom objects support two schema visibility modes:

- **Private** (`visibility: "private"`): The default. The schema is scoped to a single Klaviyo account. This is used when a Klaviyo customer creates their own custom objects.
- **Shared** (`visibility: "shared"`): The schema is tied to an application via the `namespace` field (format: `applications/<app_id>`) and is automatically linked to every account that installs the app. This is used by app partners building integration objects. An application can define up to 8 shared schema object types. See [Application objects for app partners](https://developers.klaviyo.com/en/docs/application_objects_for_app_partners.md) for the full workflow.

When a customer installs an app with a shared schema object, the object type is automatically linked to their account — they do not need to create or configure it themselves. When they uninstall the app, the object type is unlinked, but existing records persist.

### Data flow

```
Data Source Records  →  Data Source  →  Source Mapping  →  Schema  →  Custom Object Records
                                          ↓                              ↓
                                   (extracts fields              (linked to profiles
                                    via JSONPath)                 via relationships)
```

Data source records are stored when you ingest them. When you activate a schema, Klaviyo processes all existing data source records into custom object records and links them to profiles. After activation, new records are processed immediately.

### Object properties

Every object can have up to 15 properties (or 30 depending on your billing plan). Each property must not exceed 2 KB in size.

Each property must be one of the following types:

- `string` (called `Text` in the UI): Max 2 KB. Source data must NOT be a boolean or array type.
- `int` (called `Number (Integer)` in the UI): Supports up to 2 KB large integers. May be coerced from string type. Source data must NOT have a non-zero fractional component.
- `float` (called `Number (Decimal)` in the UI): Supports up to 2 KB large floating point numbers. May be coerced from a string type.
- `boolean`: Represents true or false. Acceptable values are `false`, `'f'`, `'n'`, `'no'`, `'off'`, `'false'`, `true`, `'t'`, `'y'`, `'on'`, `'yes'`, `'true'`, case insensitive.
- `timestamp`: Must follow Klaviyo's [acceptable timestamp formats](https://developers.klaviyo.com/en/docs/acceptable_date_and_timestamp_formats_for_profile_and_event_properties.md). Converted to UTC if a timezone offset is provided. Assumed UTC if no timezone offset is provided. Defaults to midnight if no time is provided.

Property names must be valid identifiers: letters, numbers, and underscores only. They cannot start with an underscore, cannot be Python reserved keywords (e.g., `class`, `return`), and cannot start with the prefix `kl_` (reserved for internal use). The name `id` is reserved for the built-in identifier at property ID 0. Note that property names are independent from field names in your data source records — the source mapping connects them via JSONPath, so your data can have keys with spaces or special characters (e.g., `"Variant Name"`, `"$value"`) even though property names cannot.

The built-in `id` property is created automatically and does not count against your total property limit. The built-in `id` is populated by the `id_path` field in your source mapping — it stores whatever value that JSONPath extracts from your data source records (e.g., a product ID, coupon code, or subscription ID). You do not need to define a separate property for your unique identifier; the built-in `id` handles it.

The value extracted by `id_path` must be **globally unique within the object type**. If two records produce the same `id` value, the second record will overwrite the first. For example, if you have line items from different subscriptions that both use `id: "00001"`, they will collide. In this case, use a more specific identifier (e.g., `subscription_line_id`) or a composite value that ensures uniqueness across all records of that object type.

> [!WARNING]
> If the extracted value does not match the declared property type, Klaviyo will attempt to coerce it. For example, Klaviyo will attempt to convert the string `"123"` to the integer `123`. If coercion fails, the entire object record will be marked invalid and skipped.
>
> Array values are stored as their Python string representation. For example, `["Skis", "black"]` would be stored as `"['Skis', 'black']"` (with square brackets and single-quoted strings). If you need a specific string format (e.g., JSON or comma-separated), convert the array to a string before ingestion. Support for native array properties is coming soon.

### Profile identifiers

Custom object records can be linked to a profile via a profile relationship. When configuring the relationship mapping, you specify which field in your data identifies the profile and what type of identifier it is:

- `email` — email address
- `phone` — phone number: must be in ISO E.164 format
- `external-id` — an ID from your external system (must already exist on the profile in Klaviyo)
- `klaviyo-id` — Klaviyo's internal profile ID

If you configure multiple profile identifiers (e.g., both email and phone) but only have one available, include the identifier you have and set the other to `null`. Setting a profile identifier to `null` in the payload will not overwrite or remove that identifier from the profile.

Each entry in `related_id_paths` is a different identifier type (email, phone, etc.) for the **same** profile — they are not separate profile links. To link a single object record to **multiple profiles**, use array wildcards in your source mapping and structure your data with an array of identifier tuples. See [Many-to-many profile relationships](#many-to-many-profile-relationships) for a worked example.

> [!NOTE]
> **Profile auto-creation:** If the identifier you provide does not match any existing Klaviyo profile, Klaviyo automatically creates a new profile and links the object record to it.

### Updating object records

If you ingest a record with the same unique identifier as an existing record, the existing record is updated with the new values. You must provide the entire object record when updating — if you exclude any properties, those properties are set to `null`. If your source mapping extracts profile identifiers from the same record as object properties, you must include the profile identifiers as well. To update object properties and profile links independently, consider [separating them in your record structure](#separating-object-data-from-profile-identifiers).

When multiple object types share a data source, each source mapping extracts independently. The "entire object record" requirement applies per object type, not per data source record. For example, if you re-send a subscription payload without the `line_items` array, the Subscription object updates normally, but the Line Item source mapping finds nothing to match and existing Line Item records are left untouched — missing array data does not null out or delete child records.

### Relationships between object types

The Custom Objects API supports two types of relationships:

- **Profile relationships** link object records to Klaviyo profiles via identifiers (email, phone, external ID, or Klaviyo ID). See [Step 3](#step-3-create-a-profile-relationship) in the quick start.
- **Object-to-object relationships** link object records to records of another object type. For example, linking a Pet record to a Subscription record. See [Step 3b](#step-3b-create-an-object-to-object-relationship-optional) in the quick start.

Both relationship types require a corresponding relationship mapping in the source mapping before activation.

### JSONPath reference

Source mappings use [JSONPath](https://jsonpath.com/) expressions to extract data from your data source records. There is no limit on nesting depth — you can chain as many levels as your data requires. The bracket notation (`$['field']`) handles keys with spaces, special characters, and `$` prefixes:

| Pattern | Description | Example |
| :------ | :---------- | :------ |
| `$['field']` | Top-level field | `$['reservation_id']` |
| `$['parent']['child']` | Nested field | `$['owner']['email']` |
| `$['a']['b']['c']` | Deeply nested field | `$['properties']['event_properties']['ProductID']` |
| `$['array'][*]['field']` | Field from each item in an array | `$['pets'][*]['name']` |
| `$['special key']` | Key with spaces or special characters | `$['Variant Option: Size']`, `$['$value']` |

You don't need to flatten or preprocess your source data. The source mapping handles extraction from nested structures and arrays. Fields in your data source records that are not referenced by any source mapping are still persisted in the data source record, but will not appear on the resulting object record. If you later add a mapping for those fields, the data will be available on the object record.

> [!NOTE]
> **`id_path` in source mappings**
>
> The `id_path` field tells Klaviyo which field uniquely identifies each record. It can reference any field in your data — it doesn't have to be named `id`, and it can be a string, number, or any scalar type. For example, `$['CouponIdentifier']`, `$['ProductID']`, or `$['subscription_id']` are all valid. The value extracted by `id_path` is converted to a string and stored in the built-in `id` property (property ID 0) on the resulting object record. The `id_path` is repeated in every property mapping because each mapping must identify which record it belongs to.

> [!NOTE]
> **Array wildcards**
>
> Array wildcards (e.g., `$['items'][*]['price']`) can be used to expand a list of records from a single data source record. When expanding custom object records from JSON arrays, be sure to include wildcards in both the `id_path` and the `data_path` JSONPath values.

> [!NOTE]
> **Mixing top-level and array paths**
>
> When using array wildcards, you can also reference top-level fields (e.g., `$['email']`) in the `data_path` of both property mappings and relationship mappings. Top-level values are applied to every record extracted from the array. This is useful when a shared field like an email address or a parent ID sits outside the array in your data. See the [parent-child example](#parent-child-data--two-object-types-shared-data-source) for a worked example.

## Quick start

This walkthrough creates a "Pet" custom object from scratch using the programmatic API. By the end, you'll have pet records linked to customer profiles in Klaviyo.

> [!NOTE]
> All Custom Objects API endpoints use the revision header `revision: 2026-07-15`.

Here's the data we'll be working with — three pet records, each with an email to link to a customer profile and a `subscription_id` to link to a Subscription object:

```json
[
    {"id": 1, "name": "Buddy", "type": "dog", "breed": "Golden Retriever", "age": 3, "birth_datetime": "2023-03-15T00:00:00Z", "email": "amy.smith@klaviyo.com", "subscription_id": "sub-001"},
    {"id": 2, "name": "Whiskers", "type": "cat", "breed": "Siamese", "age": 2, "birth_datetime": "2024-06-01T00:00:00Z", "email": "amy.smith@klaviyo.com", "subscription_id": "sub-001"},
    {"id": 3, "name": "Nibbles", "type": "rabbit", "breed": "Holland Lop", "age": 1, "birth_datetime": "2025-01-10T00:00:00Z", "email": "jon.jacobson@klaviyo.com", "subscription_id": "sub-002"}
]
```

> [!NOTE]
> **ID format (ULID)**
>
> Identifiers in the Custom Objects API are formatted as ULIDs — 26-character alphanumeric strings, e.g., `01JKV3YV229CP2NVMXHM5SD9N5`. Save the IDs returned from each response, as you'll need them in later steps.

### Step 1: Create a data source

A data source represents where your data comes from. Create one using the [Create Data Source](https://developers.klaviyo.com/en/reference/create_data_source.md) endpoint.

> [!WARNING]
> Set `visibility` to `"private"` and `namespace` to `"custom-objects"` for standard custom objects. App partners building integration objects should set `visibility` to `"shared"` and `namespace` to `"applications/<app_id>"` — see [Application objects for app partners](https://developers.klaviyo.com/en/docs/application_objects_for_app_partners.md).

```curl Request
curl --request POST \
     --url https://a.klaviyo.com/api/data-sources \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'content-type: application/vnd.api+json' \
     --header 'revision: 2026-07-15' \
     --data '
{
    "data": {
        "type": "data-source",
        "attributes": {
            "visibility": "private",
            "namespace": "custom-objects",
            "title": "Pet Registry",
            "description": "Source of truth for customer pets"
        }
    }
}
'
```

Save the returned `id` — you'll need it in later steps.

### Step 2: Create an object type and define its schema

Create an object type with its schema properties in a single call using the [Create Object Type](https://developers.klaviyo.com/en/reference/create_object_type.md) endpoint. This also automatically creates a source mapping.

Each property needs a unique numeric `id` (starting from 1) and a [data type](#object-properties).

```curl Request
curl --request POST \
     --url https://a.klaviyo.com/api/object-types \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'content-type: application/vnd.api+json' \
     --header 'revision: 2026-07-15' \
     --data '
{
    "data": {
        "type": "object-type",
        "attributes": {
            "title": "Pet",
            "description": "Customer pets",
            "object-schema": {
                "data": {
                    "type": "object-schema",
                    "attributes": {
                        "properties": [
                            {"id": 1, "name": "name", "type": "string"},
                            {"id": 2, "name": "type", "type": "string"},
                            {"id": 3, "name": "breed", "type": "string"},
                            {"id": 4, "name": "age", "type": "int"},
                            {"id": 5, "name": "birth_datetime", "type": "timestamp"}
                        ]
                    }
                }
            }
        }
    }
}
'
```

The response includes the IDs you'll need for the remaining steps. Save the `draft-schema` ID from `relationships`:

```json Response (abbreviated)
{
    "data": {
        "type": "object-type",
        "id": "01KJ5HFANFPC2W4XG9D4GP24J1",
        "relationships": {
            "draft-schema": {
                "data": {
                    "type": "object-schema",
                    "id": "01KJ5HFAKYX5N1W2A9TB1RDQ86"
                }
            }
        }
    }
}
```

> [!NOTE]
> **One ID for schema, source mapping, and activation**
>
> The `draft-schema` ID (`01KJ5HFAKYX5N1W2A9TB1RDQ86` in this example) is reused as the source mapping ID. You'll use this same ID in Step 3 (profile relationship URL), Step 4 (source mapping URL and body), and Step 6 (activation URL and body).

### Step 3: Create a profile relationship

Every custom object must be linked to Klaviyo profiles. Create this relationship on your draft schema.

The `meta` object is **required** and must include a `name` for the relationship (same naming rules as properties: letters, numbers, and underscores only). The `type` must be `"profile-object-schema"`. The `id` field in the request must always be the static string `"profile"`. The response `id` will be `"profile:::<name>"` (e.g. `"profile:::pet_owner"`) — this compound format ensures uniqueness when multiple relationships exist between the same schemas. The server-generated `relationship_id` returned in `meta` is what you'll use in the source mapping in Step 4.

```curl Request
curl --request POST \
     --url https://a.klaviyo.com/api/object-schemas/<DRAFT_SCHEMA_ID>/relationships/profile-object-schemas \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'content-type: application/vnd.api+json' \
     --header 'revision: 2026-07-15' \
     --data '
{
    "data": [
        {
            "type": "profile-object-schema",
            "id": "profile",
            "meta": {
                "name": "pet_owner",
                "description": "The profile who owns this pet"
            }
        }
    ]
}
'
```

The response includes the server-generated `relationship_id` in `meta`:

```json Response
{
    "data": [
        {
            "type": "profile-object-schema",
            "id": "profile:::pet_owner",
            "meta": {
                "relationship_id": "01K5YKKQKM819VVGCPZZKGE6D4",
                "name": "pet_owner",
                "description": "The profile who owns this pet"
            }
        }
    ]
}
```

Save the `relationship_id` from the response — you'll need it in the next step.

### Step 3b: Create an object-to-object relationship (optional)

If your data model links objects to other object types (e.g., each Pet has a Subscription), you can create an object-to-object relationship on the draft schema. This step requires that the target object type already exists and has an active schema.

The request structure is similar to a profile relationship, but uses the `object-schemas` relationship endpoint and the target object's **schema ID** (not its object type ID) as the `id`.

```curl Request
curl --request POST \
     --url https://a.klaviyo.com/api/object-schemas/<DRAFT_SCHEMA_ID>/relationships/object-schemas \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'content-type: application/vnd.api+json' \
     --header 'revision: 2026-07-15' \
     --data '
{
    "data": [
        {
            "type": "object-schema",
            "id": "<TARGET_SCHEMA_ID>",
            "meta": {
                "name": "subscription",
                "description": "The subscription this pet is enrolled in"
            }
        }
    ]
}
'
```

The response includes the server-generated `relationship_id` in `meta`:

```json Response
{
    "data": [
        {
            "type": "object-schema",
            "id": "<TARGET_SCHEMA_ID>:::subscription",
            "meta": {
                "relationship_id": "01K97SE7GH4TE57FVNQY310QAK",
                "name": "subscription",
                "description": "The subscription this pet is enrolled in"
            }
        }
    ]
}
```

Save the `relationship_id` — you'll need it when configuring the source mapping. The source mapping relationship entry for an object-to-object relationship uses `"type": "custom-object"` and a `related_id_path` (instead of `related_id_paths`):

```json Source mapping relationship entry
{
    "relationship_id": "<RELATIONSHIP_ID_FROM_STEP_3B>",
    "type": "simple",
    "source": {
        "source_id": "<DATA_SOURCE_ID>",
        "id_path": "$['id']",
        "type": "custom-object",
        "related_id_path": "$['subscription_id']"
    }
}
```

> [!NOTE]
> **Object-to-object relationship naming:** The relationship `name` should describe what the target object represents from the perspective of the source object. For example, a Pet's relationship to a Subscription is named `"subscription"` — the pet *has a* subscription. The same naming rules apply as for profile relationships (letters, numbers, underscores only).

### Step 4: Configure the source mapping

The source mapping tells Klaviyo how to read your data source records. It connects each schema property to a field in your data using [JSONPath](https://jsonpath.com/) expressions, and links records to profiles.

> [!WARNING]
> Every schema property must have exactly one corresponding property mapping with the same `id`, and every relationship (both profile and object-to-object) must have a corresponding relationship mapping. For example, a schema property with `"id": 3` must have a property mapping with `"id": 3`. Mismatches will cause activation to fail.

```curl Request
curl --request PATCH \
     --url https://a.klaviyo.com/api/source-mappings/<DRAFT_SCHEMA_ID> \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'content-type: application/vnd.api+json' \
     --header 'revision: 2026-07-15' \
     --data @- << 'EOF'
{
    "data": {
        "type": "source-mapping",
        "id": "<DRAFT_SCHEMA_ID>",
        "attributes": {
            "property_mappings": [
                {"id": 1, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['id']", "data_path": "$['name']"}},
                {"id": 2, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['id']", "data_path": "$['type']"}},
                {"id": 3, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['id']", "data_path": "$['breed']"}},
                {"id": 4, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['id']", "data_path": "$['age']"}},
                {"id": 5, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['id']", "data_path": "$['birth_datetime']"}}
            ],
            "relationship_mappings": [
                {
                    "relationship_id": "<RELATIONSHIP_ID_FROM_STEP_3>",
                    "type": "simple",
                    "source": {
                        "source_id": "<DATA_SOURCE_ID>",
                        "id_path": "$['id']",
                        "type": "profile",
                        "related_id_paths": [
                            {
                                "identifier_type": "email",
                                "path": "$['email']"
                            }
                        ]
                    }
                },
                {
                    "relationship_id": "<RELATIONSHIP_ID_FROM_STEP_3B>",
                    "type": "simple",
                    "source": {
                        "source_id": "<DATA_SOURCE_ID>",
                        "id_path": "$['id']",
                        "type": "custom-object",
                        "related_id_path": "$['subscription_id']"
                    }
                }
            ]
        }
    }
}
EOF
```

> [!NOTE]
> **Understanding source mapping fields:**
> - `source_id`: The data source ID from Step 1. This is how the source mapping connects to your data source.
> - `id_path`: [JSONPath](https://jsonpath.com/) to the unique identifier field in your record (e.g., `$['id']`). This tells Klaviyo which field uniquely identifies each record, so it can group properties from the same record together. It's the same across all mappings for a given data source.
> - `data_path`: JSONPath to the specific field value for this property (e.g., `$['name']`).
> - `type`: The mapping type. Use `"simple"` for direct field-to-property mapping.
> - `relationship_id`: The ULID from the Step 3 response. This links the mapping to the profile relationship on the schema.
> - `identifier_type`: How to match to a Klaviyo profile. Accepted values: `email`, `phone`, `external-id`, `klaviyo-id`.

### Step 5: Ingest your data

Send your records using the [Bulk Create Data Source Records](https://developers.klaviyo.com/en/reference/bulk_create_data_source_records.md) endpoint. Each pet is a separate record:

```curl Request
curl --request POST \
     --url https://a.klaviyo.com/api/data-source-record-bulk-create-jobs \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'content-type: application/vnd.api+json' \
     --header 'revision: 2026-07-15' \
     --data '
{
    "data": {
        "type": "data-source-record-bulk-create-job",
        "attributes": {
            "data-source-records": {
                "data": [
                    {
                        "type": "data-source-record",
                        "attributes": {
                            "record": {"id": 1, "name": "Buddy", "type": "dog", "breed": "Golden Retriever", "age": 3, "birth_datetime": "2023-03-15T00:00:00Z", "email": "amy.smith@klaviyo.com", "subscription_id": "sub-001"}
                        }
                    },
                    {
                        "type": "data-source-record",
                        "attributes": {
                            "record": {"id": 2, "name": "Whiskers", "type": "cat", "breed": "Siamese", "age": 2, "birth_datetime": "2024-06-01T00:00:00Z", "email": "amy.smith@klaviyo.com", "subscription_id": "sub-001"}
                        }
                    },
                    {
                        "type": "data-source-record",
                        "attributes": {
                            "record": {"id": 3, "name": "Nibbles", "type": "rabbit", "breed": "Holland Lop", "age": 1, "birth_datetime": "2025-01-10T00:00:00Z", "email": "jon.jacobson@klaviyo.com", "subscription_id": "sub-002"}
                        }
                    }
                ]
            }
        },
        "relationships": {
            "data-source": {
                "data": {
                    "type": "data-source",
                    "id": "<DATA_SOURCE_ID>"
                }
            }
        }
    }
}
'
```

> [!WARNING]
> This endpoint creates data source records asynchronously, so it may be up to ~15 minutes before records appear in your account.

### Step 6: Activate the schema

Once everything is configured, activate the schema:

```curl Request
curl --request PATCH \
     --url https://a.klaviyo.com/api/object-schemas/<DRAFT_SCHEMA_ID> \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'content-type: application/vnd.api+json' \
     --header 'revision: 2026-07-15' \
     --data '
{
    "data": {
        "type": "object-schema",
        "id": "<DRAFT_SCHEMA_ID>",
        "attributes": {
            "status": "active"
        }
    }
}
'
```

The response will show status `publishing` while records are being processed — this typically transitions to `active` within a few minutes.

Activation validates your entire configuration. If validation fails, the schema remains in `draft` status so you can make corrections and try again. See [Troubleshooting](#troubleshooting) for common errors.

**That's it.** After activation, Buddy, Whiskers, and Nibbles will appear as separate custom object records linked to their owners' profiles and their subscriptions. You can now use this data in [templates](https://help.klaviyo.com/hc/en-us/articles/35146367972763), [flows](https://help.klaviyo.com/hc/en-us/articles/35146374047515), and [segments](https://help.klaviyo.com/hc/en-us/articles/35146339009691).

> [!NOTE]
> **Moving to production?** The quick start above uses flat records for simplicity. For production workloads — especially when an object can be linked to multiple profiles (many-to-many) — consider [separating object data from relationship identifiers](#separating-object-data-from-profile-identifiers) in your record structure. This pattern makes it easier to update properties and profile links independently and supports linking a single object record to multiple profiles.

## Working with nested data

The quick start above uses flat records where each record maps directly to one object. But your source data doesn't need to be flat — source mappings support [JSONPath](https://jsonpath.com/) expressions that can reach into nested objects and arrays.

For example, instead of sending three separate pet records, you could send a single record containing an owner and an array of pets:

```json
{
    "owner": {
        "email": "amy.smith@klaviyo.com"
    },
    "pets": [
        {"id": 1, "name": "Buddy", "type": "dog", "breed": "Golden Retriever", "age": 3, "birth_datetime": "2023-03-15T00:00:00Z"},
        {"id": 2, "name": "Whiskers", "type": "cat", "breed": "Siamese", "age": 2, "birth_datetime": "2024-06-01T00:00:00Z"},
        {"id": 3, "name": "Nibbles", "type": "rabbit", "breed": "Holland Lop", "age": 1, "birth_datetime": "2025-01-10T00:00:00Z"}
    ]
}
```

The only difference is in the source mapping. Use array wildcards (`[*]`) to extract each item from the `pets` array, and nested paths to reach the owner's email:

```json
{
    "data": {
        "type": "source-mapping",
        "id": "<DRAFT_SCHEMA_ID>",
        "attributes": {
            "property_mappings": [
                {"id": 1, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['pets'][*]['id']", "data_path": "$['pets'][*]['name']"}},
                {"id": 2, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['pets'][*]['id']", "data_path": "$['pets'][*]['type']"}},
                {"id": 3, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['pets'][*]['id']", "data_path": "$['pets'][*]['breed']"}},
                {"id": 4, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['pets'][*]['id']", "data_path": "$['pets'][*]['age']"}},
                {"id": 5, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['pets'][*]['id']", "data_path": "$['pets'][*]['birth_datetime']"}}
            ],
            "relationship_mappings": [
                {
                    "relationship_id": "<RELATIONSHIP_ID>",
                    "type": "simple",
                    "source": {
                        "source_id": "<DATA_SOURCE_ID>",
                        "id_path": "$['pets'][*]['id']",
                        "type": "profile",
                        "related_id_paths": [
                            {
                                "identifier_type": "email",
                                "path": "$['owner']['email']"
                            }
                        ]
                    }
                }
            ]
        }
    }
}
```

You then pass the entire nested structure as a single data source record — no flattening or preprocessing needed. Klaviyo extracts three pet objects from the single record, each linked to the owner's profile.

## Common patterns

### Flat data — one object type

If your data is flat (one record per object, profile identifier at the top level), a single object type is all you need. This covers use cases like coupon codes, reservations, or product records where each record is self-contained. Follow the [Quick start](#quick-start) directly.

### Parent-child data — two object types, shared data source

If your data has a parent entity with child items (e.g., a Subscription with Line Items, or an Order with Order Items), model these as two separate object types. You can use the same data source for both — each object type has its own source mapping that extracts different fields from the same data source records. When you ingest a single data source record, every object type whose source mapping references that data source will independently process the record.

Follow the Quick start once for the parent object type and once for the child, reusing the same data source from Step 1. Specifically: run Steps 2-4 for the parent, then Steps 2-4 for the child, then ingest your data in Step 5, then activate both schemas in Step 6. Activation order does not matter — you can activate the parent and child schemas in any order.

You can use [object-to-object relationships](#step-3b-create-an-object-to-object-relationship-optional) to formally link the child to the parent (e.g., linking each Line Item to its Subscription). Alternatively, you can store the parent's ID as a string property on the child object type (e.g., a `subscription_id` property on each line item) for simpler cross-referencing.

Here is an example using a Subscription (parent) with Line Items (child). The source data looks like:

```json
{
    "subscription_id": "sub_123",
    "status": "active",
    "next_billing_date": "2026-03-01T00:00:00Z",
    "email": "customer@example.com",
    "line_items": [
        {"id": "li_001", "product_id": "prod_001", "price": 29.99, "quantity": 2, "subscription_id": "sub_123"},
        {"id": "li_002", "product_id": "prod_002", "price": 15.00, "quantity": 1, "subscription_id": "sub_123"}
    ]
}
```

**Parent source mapping (Subscription):** Uses top-level JSONPaths. The `id_path` is `$['subscription_id']`.

```json
"property_mappings": [
    {"id": 1, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['subscription_id']", "data_path": "$['status']"}},
    {"id": 2, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['subscription_id']", "data_path": "$['next_billing_date']"}}
]
```

**Child source mapping (Line Item):** Uses array wildcards for `id_path` and `data_path`. Note that `subscription_id` (property id `3`) uses a **top-level** `data_path` (`$['subscription_id']`) paired with an array-based `id_path` — the top-level value is applied to every record extracted from the array. This works in both property mappings and relationship mappings.

```json
"property_mappings": [
    {"id": 1, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['line_items'][*]['id']", "data_path": "$['line_items'][*]['product_id']"}},
    {"id": 2, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['line_items'][*]['id']", "data_path": "$['line_items'][*]['price']"}},
    {"id": 3, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['line_items'][*]['id']", "data_path": "$['subscription_id']"}},
    {"id": 4, "type": "simple", "source": {"source_id": "<DATA_SOURCE_ID>", "id_path": "$['line_items'][*]['id']", "data_path": "$['line_items'][*]['quantity']"}}
],
"relationship_mappings": [
    {
        "relationship_id": "<RELATIONSHIP_ID>",
        "type": "simple",
        "source": {
            "source_id": "<DATA_SOURCE_ID>",
            "id_path": "$['line_items'][*]['id']",
            "type": "profile",
            "related_id_paths": [
                {"identifier_type": "email", "path": "$['email']"}
            ]
        }
    }
]
```

Both object types reference the same `<DATA_SOURCE_ID>`. You ingest the full nested payload as a single data source record, and Klaviyo extracts one Subscription record and two Line Item records from it.

## Configure search and display (beta)

Every object schema has a `configuration` that controls which properties Klaviyo indexes for full-text search and how object records appear in Klaviyo (e.g., the record title, images, and the columns shown in the record explorer). Klaviyo creates a default configuration when you create an object type. You can read and update it on the object schema endpoints.

> [!WARNING]
> **Beta:** The `configuration` attribute and the `search` query parameter are available in the beta revision only. Use the revision header `revision: 2026-07-15.pre` for the requests in this section. Beta revisions may change before general availability.

### Configuration fields

The `configuration` attribute contains the following fields. Every field references a property by its numeric property `id` from the schema. Property ID `0` is the built-in `id` property.

- `searchable_property_ids`: Up to 3 property IDs whose values are indexed for full-text search. Defaults to `[0]`, so records are searchable by their `id` value until you change it.
- `title_property_id`: The property whose value is used as the record's title in Klaviyo. Defaults to `0`.
- `primary_image_url_property_id`: Optional. A `string` property whose value is an image URL, used as the primary image for the record. Set to `null` if your object has no image.
- `thumbnail_image_url_property_id`: Optional. A `string` property whose value is an image URL, used as the record thumbnail. Set to `null` if your object has no image.
- `record_explorer_display_property_ids`: An ordered list of property IDs to display as columns in the record explorer.

### Update the configuration

Update the configuration with the [Update Object Schema](https://developers.klaviyo.com/en/reference/update_object_schema.md) endpoint. Unlike other object schema attributes, you can update `configuration` on an `active` schema without creating a new draft schema. The `configuration` attribute is replaced in full, so include every field in the request.

> [!WARNING]
> Send `configuration` as the only attribute in the request. If the same request also changes `title`, `properties`, `description`, `status`, or `required`, it takes the draft-only path and fails on an `active` schema, and the configuration is not applied. Update those attributes on a draft schema separately.

This example configures the Pet object from the [Quick start](#quick-start) so that records are searchable by `name` (property `1`) and `breed` (property `3`), titled by `name`, and displayed with four columns in the record explorer:

```curl Request
curl --request PATCH \
     --url https://a.klaviyo.com/api/object-schemas/<SCHEMA_ID> \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'content-type: application/vnd.api+json' \
     --header 'revision: 2026-07-15.pre' \
     --data '
{
    "data": {
        "type": "object-schema",
        "id": "<SCHEMA_ID>",
        "attributes": {
            "configuration": {
                "searchable_property_ids": [1, 3],
                "title_property_id": 1,
                "primary_image_url_property_id": null,
                "thumbnail_image_url_property_id": null,
                "record_explorer_display_property_ids": [1, 2, 3, 4]
            }
        }
    }
}
'
```

The response includes the updated `configuration` alongside the other schema attributes. [Get Object Schema](https://developers.klaviyo.com/en/reference/get_object_schema.md) also returns `configuration` when you use the beta revision.

### Search index status

When you change `searchable_property_ids` on an `active` schema, Klaviyo rebuilds the search index for the affected properties asynchronously. Existing records become searchable by a newly added property once the backfill completes. New records are indexed as they are ingested.

Track backfill progress with two fields on the object type, returned by [Get Object Type](https://developers.klaviyo.com/en/reference/get_object_type.md) in the beta revision:

- `search_indexed_property_ids`: Property IDs that are fully indexed for all records.
- `search_indexing_property_ids`: Property IDs with a backfill in progress.

Together, these two lists always equal the schema's `searchable_property_ids`.

These fields track newly added properties. If you only *remove* a property from `searchable_property_ids`, `search_indexing_property_ids` stays empty even though Klaviyo is still rebuilding the index — records can continue to match on the removed property's values until that rebuild completes.

### Search object records

Use the `search` query parameter on the [Get Records for Object Type](https://developers.klaviyo.com/en/reference/get_records_for_object_type.md) endpoint to find records by the values of their searchable properties:

```curl Request
curl --request GET \
     --url 'https://a.klaviyo.com/api/object-types/<OBJECT_TYPE_ID>/object-records?search=golden%20retriever&page%5Bsize%5D=20' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'revision: 2026-07-15.pre'
```

Search is case insensitive and matches substrings. The query is split on whitespace, and every term must match somewhere in the record's searchable property values. For example, `search=golden retriever` matches a pet whose `breed` is `Golden Retriever`, and `search=bud` matches a pet named `Buddy`. Results are paginated in the same way as an unfiltered request.

## UI-based setup

If you prefer using the UI instead of the API:

1. Navigate to the [Object Manager](https://www.klaviyo.com/objects/create) to create a new data source and object.
2. Give your object a unique name and either select an existing data source or create a new one.
3. Define the object's schema and relationships using the Object Manager. For more information, check out [Getting started with custom objects](https://help.klaviyo.com/hc/en-us/articles/35105337172123).
4. Use the provided sample payload to begin ingesting records with the [Bulk Create Data Source Records](https://developers.klaviyo.com/en/reference/bulk_create_data_source_records.md) endpoint.

## API reference

### Create Data Source Record

Use the [Create Data Source Record](https://developers.klaviyo.com/en/reference/create_data_source_record.md) endpoint to ingest records one at a time. Ideal for real-time or event-driven workloads such as processing webhooks. The request body uses the same `record` structure as the bulk endpoint — wrap your JSON payload inside a single `data-source-record` object with a `data-source` relationship.

**Rate limits and throughput:**
- **Rate limit tier:** LARGE (75 requests/second burst, 750 requests/minute steady)
- **Throughput:** Up to 75 records/second and 750 records/minute

### Bulk Create Data Source Records

Use the [Bulk Create Data Source Records](https://developers.klaviyo.com/en/reference/bulk_create_data_source_records.md) endpoint for batch imports.

**Rate limits and throughput:**
- **Rate limit:** 3 requests/second burst, 15 requests/minute steady
- **Throughput:** Up to ~1,500 records/second in bursts and 7,500 records/minute steady (with 500 records per request)
- **Records per request:** Up to 500 records

> [!NOTE]
> **Choosing between single and bulk endpoints:**
>
> - Use the **single record endpoint** for real-time, event-driven ingestion where you need to process records individually as they arrive.
> - Use the **bulk endpoint** for batch imports where you can group multiple records together. While it has a lower rate limit, it supports much higher overall throughput when batching up to 500 records per request.

### Get Object Records

Use the [Get Records for Object Type](https://developers.klaviyo.com/en/reference/get_records_for_object_type.md) endpoint to retrieve paginated object records for a given object type. This is useful for verifying ingested data or syncing records to an external system.

```curl Request
curl --request GET \
     --url 'https://a.klaviyo.com/api/object-types/<OBJECT_TYPE_ID>/object-records?page%5Bsize%5D=20' \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'accept: application/vnd.api+json' \
     --header 'revision: 2026-07-15'
```

**Key details:**
- **Scope:** `custom-objects:read`
- **Rate limit tier:** SMALL (3 requests/second burst, 60 requests/minute steady)
- **Pagination:** Cursor-based. Use `page[cursor]` with the cursor from the previous response to fetch the next page. `page[size]` controls records per page (default 20, max 100).
- **Search (beta):** With the `revision: 2026-07-15.pre` header, add the `search` query parameter to filter records by the values of their searchable properties. See [Search object records](#search-object-records).

> [!NOTE]
> **Object record ID format (compound ID)**
>
> Object record IDs use a compound format: `<object_type_id>:::<object_record_id>`, where `object_type_id` is the ULID of the object type and `object_record_id` is the value extracted by `id_path` in your source mapping. For example: `01K8XV2MM6RFVZT8W61K6CR3ER:::external-id-1`. Use these compound IDs when referencing specific object records in API calls (e.g., bulk delete).

> [!NOTE]
> **Retrieving object records by profile:** There is currently no endpoint to filter object records by a specific profile. To find all records linked to a given profile, retrieve all records for the object type using the endpoint above and filter client-side, or use Klaviyo's segmentation to identify profiles by their object record properties.

### Bulk Delete Object Records

Use the [Bulk Delete Object Records](https://developers.klaviyo.com/en/reference/bulk_delete_object_records.md) endpoint to delete up to 500 object records in a single request. This is useful for removing stale or incorrect records.

```curl Request
curl --request POST \
     --url https://a.klaviyo.com/api/object-record-bulk-delete-jobs \
     --header 'Authorization: Klaviyo-API-Key your-private-api-key' \
     --header 'content-type: application/vnd.api+json' \
     --header 'revision: 2026-07-15' \
     --data '
{
    "data": {
        "type": "object-record-bulk-delete-job",
        "relationships": {
            "object-records": {
                "data": [
                    {"type": "object-record", "id": "<OBJECT_TYPE_ID>:::<RECORD_ID_1>"},
                    {"type": "object-record", "id": "<OBJECT_TYPE_ID>:::<RECORD_ID_2>"}
                ]
            }
        }
    }
}
'
```

**Key details:**
- **Scope:** `custom-objects:write`
- **Rate limit tier:** SMALL (3 requests/second burst, 60 requests/minute steady)
- **Records per request:** Up to 500 object record IDs. All record IDs must belong to the same object type.
- **Max payload size:** 5 MB
- **Response:** `202 Accepted` — deletion is processed asynchronously.

> [!NOTE]
> This endpoint deletes **object records**, not data source records. The underlying data source records are unaffected. Deletions are preserved across schema migrations. However, if a new data source record is ingested that matches the same `id_path` value, the object record will be recreated.

### Separating object data from profile identifiers

For production workloads, we recommend separating object properties from relationship identifiers within each record. This structure makes it explicit which fields are object data and which are used for linking, and supports many-to-many profile relationships where a single object record is linked to multiple profiles.

#### Basic separation

At its simplest, move object properties under `object_record` and profile identifiers under `relationships`:

```json
{
    "type": "data-source-record",
    "attributes": {
        "record": {
            "object_record": {
                "id": 1,
                "name": "Buddy",
                "type": "dog",
                "breed": "Golden Retriever",
                "age": 3,
                "birth_datetime": "2023-03-15T00:00:00Z"
            },
            "relationships": {
                "email": "amy.smith@klaviyo.com"
            }
        }
    }
}
```

With this structure, your source mapping property paths would use `$['object_record']['id']`, `$['object_record']['name']`, etc., and the profile identifier path would use `$['relationships']['email']`. This makes it easier to update object record attributes independent of profile links.

#### Many-to-many profile relationships

If an object record can be linked to multiple profiles (e.g., a pet with two owners), use an array in the `relationships` section and [wildcard expansion](#jsonpath-reference) in the source mapping to create a link for each entry:

```json
{
    "type": "data-source-record",
    "attributes": {
        "record": {
            "object_record": {
                "id": 1,
                "name": "Buddy",
                "type": "dog",
                "breed": "Golden Retriever",
                "age": 3,
                "birth_datetime": "2023-03-15T00:00:00Z",
                "subscription_id": "sub-001"
            },
            "relationships": {
                "owners": [
                    {"id": 1, "email": "amy.smith@klaviyo.com", "phone": "+15550001000"},
                    {"id": 1, "email": "pat.jones@klaviyo.com", "phone": "+15550001001"}
                ]
            }
        }
    }
}
```

Each entry in the `owners` array includes an `id` that matches the object record's identifier, plus one or more profile identifiers. The source mapping uses wildcards to expand each entry into a separate profile link:

```json
"relationship_mappings": [
    {
        "relationship_id": "<RELATIONSHIP_ID>",
        "type": "simple",
        "source": {
            "source_id": "<DATA_SOURCE_ID>",
            "id_path": "$['relationships']['owners'][*]['id']",
            "type": "profile",
            "related_id_paths": [
                {"identifier_type": "email", "path": "$['relationships']['owners'][*]['email']"},
                {"identifier_type": "phone", "path": "$['relationships']['owners'][*]['phone']"}
            ]
        }
    }
]
```

This creates two profile links for Buddy — one for Amy and one for Pat — each identified by both email and phone. The property mappings remain unchanged, referencing `$['object_record']['id']` and `$['object_record']['name']` as before.

> [!NOTE]
> When providing multiple identifier types (e.g., both email and phone), Klaviyo uses all provided identifiers to match or create the profile. If only one identifier is available for a given profile, set the others to `null` — this will not overwrite existing values on the profile.

### Payload limits

**Bulk Create Data Source Records:**
- Max payload size — 4 MB
- Max records per request — 500 records

**All custom object records:**
- Max object record size — 8 KB
- Max object property size — 2 KB

> [!NOTE]
> [Learn more about rate limits](https://developers.klaviyo.com/en/docs/rate_limits_and_error_handling.md).

## Troubleshooting

### Schema activation errors

When activating a schema, the API validates your entire configuration. If validation fails, the schema remains in `draft` status so you can fix the issue and retry.

| Error | Cause | Fix |
| :---- | :---- | :-- |
| Property IDs do not match | Schema properties don't have a 1:1 match with source mapping properties. | Ensure every schema property (except the built-in `id` at ID 0) has exactly one corresponding property mapping, and vice versa. |
| Relationship IDs do not match | Schema relationships don't match source mapping relationships. | Ensure the `relationship_id` in each relationship mapping matches a relationship on the schema. Retrieve relationship IDs from the schema's relationships endpoints (e.g., `GET /api/object-schemas/{id}/relationships/profile-object-schemas`) — each item in the response includes a `meta` object containing the `relationship_id`. |
| Schema not in draft | The schema is not in `draft` status. | Only draft schemas can be activated. To modify an active schema's properties or relationships, create a new draft version first. The [configuration](#configure-search-and-display-beta) can be updated on an active schema. |
| Data source not found | A source mapping references a data source ID that doesn't exist. | Create the data source first, or correct the `source_id` in your source mapping. |

### Data ingestion errors

| Status code | Reasons |
| :---------- | :------ |
| 400 | Number of records exceeded the limit (>500), or a data source identifier was not provided. |
| 413 | Request payload size is too large (>4 MB). |
| 429 | Rate limit exceeded. [Learn more](https://developers.klaviyo.com/en/docs/rate_limits_and_error_handling.md). |

### Profile relationship errors

| Error | Cause | Fix |
| :---- | :---- | :-- |
| 400: Relationship must include meta | The `meta` field is required when creating a profile relationship. | Include a `meta` object with at least a `name` field. |
| 400: Invalid type | Wrong `type` value. | Use `"profile-object-schema"`, not `"object-schema"`. |
| 400: Invalid ULID | A `relationship_id` was provided in an invalid format. | Relationship IDs must be ULIDs (26-character strings, e.g., `01K5YKKQKM819VVGCPZZKGE6D4`). When creating a new relationship, omit `relationship_id` — it is server-generated. |

## Additional resources

- [Getting started with custom objects](https://help.klaviyo.com/hc/en-us/articles/35105337172123-Getting-started-with-custom-objects)
- [How to use custom objects in templates](https://help.klaviyo.com/hc/en-us/articles/35146367972763)
- [How to use custom objects in flows](https://help.klaviyo.com/hc/en-us/articles/35146374047515)
- [How to use custom objects in segments](https://help.klaviyo.com/hc/en-us/articles/35146339009691)
- [Use Klaviyo's Postman collections](https://developers.klaviyo.com/en/docs/use_klaviyos_postman_collections.md)

> [!NOTE]
> If you have feedback or encounter issues using this API, please let us know using [this form](https://docs.google.com/forms/d/e/1FAIpQLSd16WzxOJlKtmaVmv2Qwyooq26nKw5a7CuJqS08bI-VJf_WEw/viewform).

## Endpoints

- [Get Data Sources](https://developers.klaviyo.com/en/v2026-01-15/reference/get_data_sources.md): `GET /api/data-sources`
- [Get Data Source](https://developers.klaviyo.com/en/v2026-01-15/reference/get_data_source.md): `GET /api/data-sources/{id}`
- [Create Data Source](https://developers.klaviyo.com/en/v2026-01-15/reference/create_data_source.md): `POST /api/data-sources`
- [Delete Data Source](https://developers.klaviyo.com/en/v2026-01-15/reference/delete_data_source.md): `DELETE /api/data-sources/{id}`
- [Bulk Create Data Source Records](https://developers.klaviyo.com/en/v2026-01-15/reference/bulk_create_data_source_records.md): `POST /api/data-source-record-bulk-create-jobs`
- [Create Data Source Record](https://developers.klaviyo.com/en/v2026-01-15/reference/create_data_source_record.md): `POST /api/data-source-record-create-jobs`
