Overview

The Create Alias endpoint allows you to create or update an alias for the user identified via their Subscription ID.


How to Use this API

This endpoint performs an upsert—if the user already has an alias with the specified alias label, it gets updated; otherwise, a new alias will be created.

The request body must include an identity object containing one or more aliases to be created or updated.

The OneSignal ID is read-only and used only for fetching.

Aliases are updated immediately upon request.

Examples

Give the user identified via subscription a new Alias

curl -X "PATCH" "https://api.onesignal.com/apps/<APP_ID>/subscriptions/<SUBSCRIPTION ID | PLAYER ID>/user/identity" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "identity": {
    "<NEW_ALIAS_LABEL>": "<NEW_ID>"
  }
}'


Path Parameters

subscription_id

Description

The unique identifier that represents a subscription in our system. The owner of the subscription will be returned if it matches.

Guidance

  • You may use the Player ID since it's equivalent to a subscription.

Language