> For the complete documentation index, see [llms.txt](https://docs.userlane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.userlane.com/developers/core-api/getting-started-with-attribute-import.md). Agents can also search and read this documentation through its [MCP server](https://docs.userlane.com/~gitbook/mcp).

# Getting started with Attribute import

The Attribute Import API lets you push user attributes into Userlane from your own systems (a data warehouse, an internal service, or a scheduled job) without a native connector. You send attribute definitions and per-user values in one request; Userlane creates or updates the definitions, applies the values to matching users, and reports the result per row: `200` means every row was applied, and `207` means some rows were rejected. Rejected rows are listed in `errors[]` with the `section` (`attributes` or `userProfiles`), the row `index`, the `publicId` and `attributeKey` where they apply, and a `reason`. Treat a `207` as a partial failure, not as success. It's the write counterpart to the read-only EndUser and HEART APIs, using the same credential.

## What you can do

The API accepts two kinds of rows in a single request:

* **Attribute definitions**: create or update the attribute keys themselves (name, type, description).
* **User profile values**: set per-user values for those attributes, keyed by your own user ID (`publicId`). This is the same value the Enduser data API returns as `userlaneId`: the ID you pass to the snippet when you identify the user.

You can send definitions only, values only, or both together. Definitions in a request are available to the value rows in the same request.

## Choosing the right endpoint

The two endpoints below take an identical request and response shape. They differ only in scope:

* **Bulk upload company-scoped**: the attribute applies across the whole company.

  `POST https://api.userlane.com/v3/companies/{company_id}/attributes/bulk-upload`
* **Bulk upload property-scoped**: the attribute belongs to one property. Users resolve by `(parent company, publicId)`: any user in the property's parent company is a valid target, even one never seen on that property.

  `POST https://api.userlane.com/v3/properties/{property_id}/attributes/bulk-upload`

Attribute keys are always filtered to the scope you post to, so a cross-scope write cannot happen.

## Authentication

Authenticate with your API token as described in [Authentication](https://docs.userlane.com/developers/authentication.md), and send `Content-Type: application/json` with every request.

The token's Userlane Manager must be a **company admin** or a **portfolio owner**. Other tokens are rejected with `403` on upload.

## How attribute matching works

Attributes are matched on **`key`**, not on the display name. The `key` is unique within the scope.

* If the `key` already exists, the definition is **updated**.
* If the `key` is new, a **new attribute is created**.

There is no confirmation step. A key you haven't used before creates a new attribute silently, so a typo (`subscription_plan` vs. `subscriptionPlan`) produces a second attribute rather than an error. Keep your keys consistent across uploads to avoid accumulating duplicates.

`displayName` is only a label. It defaults to the `key` and is not used for matching.

## How values are formatted

A request has two lists: `attributes` holds the attribute definitions, and `userProfiles` holds the users and their values. A user's values go in `userProfiles[].profile.attributes`:

```json
{
  "attributes": [{ "key": "plan", "type": "string" }],
  "userProfiles": [
    {
      "publicId": "user-123",
      "profile": { "attributes": { "plan": { "value": "enterprise" } } }
    }
  ],
  "idempotent": false
}
```

Each attribute value is wrapped in an object with a `value` field: `"plan": { "value": "enterprise" }`, not `"plan": "enterprise"`. What goes inside `value` depends on the attribute's `type`:

| Type       | Example `value`          |
| ---------- | ------------------------ |
| `string`   | `"enterprise"`           |
| `number`   | `50`                     |
| `boolean`  | `true`                   |
| `array`    | `["admin", "billing"]`   |
| `datetime` | `"2026-06-08T00:00:00Z"` |

## Additive merge vs. full replace

The `idempotent` flag controls what happens to a user's existing values that are *not* in your request.

* **`false` (default)**: additive merge. Values in the request are written (see the source order note below); existing values are left untouched.
* **`true`**: full replace within scope. Values in the request are written (see the source order note below), and any of the targeted user's values *not* in the request are **removed**.

If your company has a source order for attribute values, company-scoped values that came from a source ranked above this API are protected in both modes. A request value for such an attribute is not written. The response counts it in `valuesSkippedDueToLowerPriority`, and it is not an error. With `idempotent: true`, such values are also kept rather than removed, and these are not counted.

Use `idempotent: true` only when the request is the complete, authoritative set of values for the users it targets. When in doubt, leave it `false`.

## Limitations

* Up to 1,000 attribute definitions and 1,000 user profile rows per request. Split larger data sets across multiple requests.
* `key` and `publicId` are each 1–255 characters. `displayName` and `description` are optional and up to 255 characters.
* Rate limit: 5 requests per minute per client IP, shared by the company and property endpoints, with short bursts of up to 10. Over the limit, the API returns `429`. When you split a large data set, send batches about 12 seconds apart.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.userlane.com/developers/core-api/getting-started-with-attribute-import.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
