---
title: "Set or remove attributes on channels"
method: POST
path: "/api/channels/attributes"
tags: ["Channels"]
---

# Set or remove attributes on channels

`POST /api/channels/attributes`

## Request

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

Set or remove attributes on a channel. Aside from Airship's [default attributes](/reference/data-collection/attributes/#default-attributes), you must [define attributes in the Airship dashboard](/guides/audience/attributes/adding/) before you can set them on channels.

## Request body

- object: Include an audience object and an array of attributes objects in your request.
  - `attributes` AttributesObject, required
    - `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
              - …
        - 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.
  - `audience` object, required: The channel(s) you want to set or remove attributes for.
    - `amazon_channel` AmazonChannel: The unique channel identifier used to target a Fire OS device.
      - `amazon_channel` union, required
        - string, uuid
        - string[]
    - `android_channel` AndroidChannel: The unique channel identifier used to target an Android device.
      - `android_channel` union, required
        - string, uuid
        - string[]
    - `channel` Channel: The unique channel identifier used to target an open channel device or web device, i.e., web browser.
      - `channel` union, required
        - string, uuid
        - string[]
    - `email_address` string[]
    - `ios_channel` IosChannel: The unique channel identifier used to target an iOS device.
      - `ios_channel` union, required
        - string, uuid
        - string[]
    - `sms_id` SmsId: Selects a single SMS device. The `msisdn` must be `opted_in` to receive notifications.
      - `msisdn` string, required: The recipient phone number.
      - `sender` string, required: The sender that the app is configured to send SMS messages from.
    - `web_channel` string[]

## Response `200`

The operation was successful.

- object
  - `ok` boolean: If true, your request was successful.
  - `warning` string: Alerts you if your request could not be processed. You may receive a 200 with a warning if you provide a `value` that does not match your attribute type. For example, an attribute that expects a numeric value will allow a value of "25" but fail if you input "twenty-five".

## 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.
- `401`: Authentication information (the app key and secret or bearer token) was either incorrect or missing.

## Changes

- **2026-06-24** `38241778b0c1`: 5 breaking, 5 info
  - removed `subschema #2` from the `audience/amazon_channel/amazon_channel` request property `oneOf` list
  - removed `subschema #2` from the `audience/android_channel/android_channel` request property `oneOf` list
  - removed `subschema #2` from the `audience/channel/channel` request property `oneOf` list
  - removed `subschema #2` from the `audience/ios_channel/ios_channel` request property `oneOf` list
  - …6 more
  - …this revision’s changelog is incomplete
- **2025-08-28** `3304568aaadc`: 1 breaking
  - removed `subschema #1: Set Attribute, subschema #2: Remove Attribute` from the `attributes/attributes/items/` request property `oneOf` list
  - …this revision’s changelog is incomplete
- **2022-03-24** `ca569bd1394d`: 3 breaking, 1 warning
  - added the new required request property `attributes`
  - added the new required request property `audience`
  - the request's body type changed from no type to `object`
  - removed `#/components/schemas/audienceSelector, subschema #2: Array of Attributes Objects` from the request body `allOf` list

[Operation history](https://skmtc.dev/airship/apis/airship-api/changes/api/channels/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)
