HomeGuidesAPI ReferenceAPI Changelog
Log In
API Reference

Create a user and account

This method creates a user and an account and returns the user object representing that newly created user/account.

You can provide vanity referral codes and sharelinks when creating a user and account. Make sure to check the tenant setting allowReferralCodeEditOnUserUpsert, if it is set to FALSE then referral codes added when using this method on an existing user will be ignored. New sharelinks and referral codes will be set as primary for the given user. If a referral code is passed without an associated sharelink for that program, then one will be generated and vice versa for sharelinks.

Because this call creates a user, it requires either a write token or an API key.

Path Params
string
required

The account to create

string
required

The user to create

string
required

Tenant being referenced. E.g. "aboih12h16t" or "test_abo912126tastastt"

Query Params
string
Defaults to null

The fields to be included in the response. Cannot coexist with extraFields. E.g. "firstName,lastName,dateBlocked"

string
Defaults to null

The fields to be included in the response in addition to all the default fields. To select from default fields, use fields. Cannot coexist with fields. E.g. "firstName,lastName,dateBlocked"

Body Params
string
required

The unique identifier provided for this user.

string
required

The unique identifier of the Account that this user belongs to.

string

The user's first name

string

The user's last name

string

The email address provided for the user. Advocate uses this to notify someone when they have a successful referral.

boolean

Flag used by Advocate to determine whether a user is able to be referred.

string

The referral code used for sharing by this user

referralCodes
object of strings

The primary custom referral codes for different programs.

string

The paymentProviderId is either the Stripe Customer ID, the Recurly Account ID, the Braintree Account ID or the Zuora Account ID. This field cannot be updated. Do not include this arguement on an API-only program, or unless looking to set it.

string

The user's locale, used for Internationalization. The locale must be of the format language_COUNTRY where the language code must be lowercase and the country code must be uppercase. The separator must be an underscore.

string

The user's ISO 3166-1 Alpha-2 country code. For example, "CA" for Canada and "ES" for Spain.

integer

The timestamp of when a users W-9 tax form was submitted.

referredBy
object

An object containing information about who referred this user.

referredByCodes
array of strings

An array of referral codes used to refer this account.

referredByCodes
string

The Base64URL encoded attribution cookie values. When decoded, the schema will resemble the following:

{"app.referralsaasquatch.com": {"tenantAlias_CODE": {"codes": {"program1": "CODE1"},"codesExp": {"CODE1": 1234567}}}}

string

Optionally used in widgets, emails, and themes. If you provide a absolute profile image URL the minimum image size is 80px x 80px.

segments
array of strings

A list of operations for adding and removing a user from segments.

Details about the supported operators and operations for adding and removing users from a segment can be found in our User Segmentation article.

segments
shareLinks
object of strings
customFields
object

An object containing the custom fields for this user.

Learn more about the available custom field functionality in our Custom Fields guide.

Responses

Language
Credentials
:
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json