---
title: "Set or remove attributes on named users"
method: POST
path: "/api/named_users/{named_user_id}/attributes"
tags: ["Named Users"]
---

# Set or remove attributes on named users

`POST /api/named_users/{named_user_id}/attributes`

## Request

- Base URL: `https://go.urbanairship.com`
- URL: `https://go.urbanairship.com/api/named_users/{named_user_id}/attributes`
- Auth: one of:
  - HTTP basic
  - HTTP basic
  - HTTP bearer
  - OAuth 2
    - Client credentials
    - Token URL: `http://oauth2.{domain}.com/token` scopes: `nu`
- TypeScript: <https://skmtc.dev/airship/apis/airship-api/docs/api/named_users/:named_user_id/attributes/post.ts> (a function with typed inputs; its response is checked against the schema)

Set or remove attributes on a named user.

A single request body may contain a `set` or `remove` field, or both, or a single `set` field. If both `set` and `remove` fields are present and the intersection of the attributes in these fields is not empty, then a `400` will be returned.

If an attribute request is partially valid, i.e., at least one attribute exists, Airship returns a `200` with a warning about the attributes that failed to update.
The attributes listed in the `warnings` string will be in CSV format.

## Path parameters

- `named_user_id` string, required

## Request body

- AttributesObject[]: Include an array of attributes objects in your request.
  - `attributes` union[], required: The attributes that you want to set for, or remove from, your `audience`. You can have both `set` and `remove` actions in the same request.
    - union
      - SetAttributeObject: Add a new attribute, or edit the value of an existing attribute, for the audience.
        - `action` 'set', required: Indicate that you want to `set` an attribute on the audience.
        - `key` string, required: The attribute ID for the attribute you want to set. JSON attribute key values must be in format `<attribute_ID>#<instance_ID>`. See [JSON attributes](/guides/audience/attributes/about/#json-attributes) in *About attributes*.
        - `timestamp` string, date-time: The [date-time](/developer/rest-api/ua/introduction/#date-time-format) when the attribute changed. If you don't enter a timestamp, Airship uses the current time.
        - `value` union, required: The value that you want to set for an attribute. Accepts numbers and strings for integer/number type attributes, but your string must be convertible to a number or the request will fail. You can also set an object, which must be valid JSON or the request will fail.
          - string
          - number
          - AttributesValueObject
            - `exp` number: The JSON attribute expiration date, set as the number of seconds since the epoch (January 1st, 1970). After expiration, Airship ignores the attribute where used in segmentation and personalization. If omitted, Airship automatically sets a value of 90 days from the current date and time. The maximum expiry delay for a JSON attribute is 731 days.
      - RemoveAttributeObject: Remove an existing attribute from the audience.
        - `action` 'remove', required: Indicate that you want to `remove` an attribute from the audience.
        - `key` string, required: The attribute ID for the attribute you want to set. JSON attribute key values must be in format `<attribute_ID>#<instance_ID>`. See [JSON attributes](/guides/audience/attributes/about/#json-attributes) in *About attributes*.
        - `timestamp` string, date-time: The [date-time](/developer/rest-api/ua/introduction/#date-time-format) when the attribute changed. If you don't enter a timestamp, Airship uses the current time.

## Response `200`

Success. If an attribute request is partially valid, i.e., at least one attribute exists,
Airship returns a `200` with a warning string containing a CSV list of attributes that failed to update. Airship also returns a `200` with a warning if you attempt to set attributes on a `named_user`, even if the `named_user` does not exist.

- NamedUserAttributesModificationResponse: Body may contain warnings about portions of the request which were not processed.
  - `ok` boolean: Set to `true` when status code is `200`.
  - `warnings` string: Warnings encountered when updating named user attributes.

## Other responses

- `400`: There was a parsing or validation error in the request. Bad Request errors typically include `path` and `location` in the response to help you find the cause of the error.

## Changes

- **2026-06-24** `38241778b0c1`: 1 breaking, 1 info
  - removed `subschema #3` from the `items/attributes/items/oneOf[subschema #1: Set Attribute]/value` request property `oneOf` list
  - added `#/components/schemas/attributesValueObject` to the `items/attributes/items/oneOf[subschema #1: Set Attribute]/value` request property `oneOf` list
  - …this revision’s changelog is incomplete
- **2025-08-28** `3304568aaadc`: 2 breaking
  - removed `subschema #1: Set Attribute, subschema #2: Remove Attribute` from the `items/attributes/items/` request property `oneOf` list
  - the response property `ok` became optional for the status `200`
  - …this revision’s changelog is incomplete

[Operation history](https://skmtc.dev/airship/apis/airship-api/changes/api/named_users/:named_user_id/attributes/post.md)

---

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