---
title: "Insert or update existing user attributes"
method: PATCH
path: "/v1/users/{id}/attributes"
tags: ["Users"]
---

# Insert or update existing user attributes

`PATCH /v1/users/{id}/attributes`

## Request

- Base URL: `https://api.capacity.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.capacity.com/v1/users/{id}/attributes`
- Auth: one of:
  - API key in header `x-capacity-id`
  - HTTP bearer

For each key in the `attributes` dictionary argument, if the user already has an attribute with that key, the value will be replaced with the new value provided. If the user doesn't already have an attribute with the given key, a new attribute will be created with the given key and value. If no user is found with the given `uuid`, a 404 error will be returned.

## Path parameters

- `id` string, required

## Request body

- UserAttributePatchSchema
  - `attributes` object: Dictionary of keys and values to insert/update the user's attributes

## Response `200`

The user and their updated attributes

- object
  - `body` object: Json body data in the request
  - `parameters` object: Query parameters in the request
  - `id` string
  - `first_name` string
  - `last_name` string
  - `email` string
  - `is_deleted` unknown
  - `custom1` string, nullable
  - `custom2` string, nullable
  - `groups` GroupGetSchema[]
    - `id` string: ID of a group record
    - `name` string: The group's name
  - `attributes` UserAttributeGetSchema[]
    - `key` string: Attribute key
    - `value` string: Attribute value

## Other responses

- `400`: The request contains malformed data or violates data integrity
- `404`: The requested resource could not be found

---

[API](https://skmtc.dev/capacity/apis/capacity-api-docs.md) - [All operations](https://skmtc.dev/capacity/apis/capacity-api-docs/llms.txt) - [OpenAPI document](https://skmtc.dev/capacity/apis/capacity-api-docs/revisions/74c85bb61004?raw)
