Create or update an alias for a user using a known alias.

Overview

Use this API to add or update aliases associated with a user when you know at least one of those aliases like the external_id, onesignal_id, or a custom alias. 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.

This is similar to the Create user API but only updates the identity object.

If you only know a subscription_id associated with the user, use the Create alias (by subscription) API.

For details on OneSignal ID and External ID, see Users. For custom aliases, see Aliases.

To remove an alias, see Delete alias API.


How to use this API

In most cases, you will set the user's external_id as the alias_label and the value of that ID in the alias_id. You can also use onesignal_id or custom Aliases in the path parameters.

It is recommended that you set the external_id with our frontend SDK login method as users identify themselves in your app or website. The External ID is how OneSignal associates your user's push, email, and sms Subscriptions with a user. See Users for details.

The request body must include an identity object containing one or more aliases to be created or updated. You can use this API to update external_id if needed.

Aliases are updated immediately upon request.


Language