Skip to content

Adding to the allow list

Privy allows you to easily add a user's email address, phone number, or wallet address to the allow list for your app.

Using @privy-io/server-auth

Use the PrivyClient's inviteToAllowlist method to add a user to your allow list.

tsx
const allowlistEntry = await privy.inviteToAllowlist({
  type: 'email',
  value: '[email protected]',
});

As a parameter to the method, pass an AllowlistEntryInput object with the following fields:

FieldTypeDescription
type'email' | 'phone' | 'wallet'The type of account to add to the allow list.
valuestringThe identifier of the account to add to the allow list. Should be the corresponding email address, phone number, or wallet address.

If the invitation is successful, the method will return an AllowlistEntryResponse. If the invitation fails, the method will throw an error.

Using the REST API

Make a POST request to:

sh
https://auth.privy.io/api/v1/apps/<your-privy-app-id>/allowlist

In the body of the request, include the following fields:

FieldTypeDescription
type'email' | 'phone' | 'wallet'The type of account to add to the allow list.
valuestringThe identifier of the account to add to the allow list. Should be the corresponding email address, phone number, or wallet address.

Below is a sample cURL command for adding an email to the allow list:

bash
curl --request POST 'https://auth.privy.io/api/v1/apps/<your-privy-app-id>/allowlist' \
-u "<your-privy-app-id>:<your-privy-app-secret>" \
-H "privy-app-id: <your-privy-app-id>" \
-H 'Content-Type: application/json' \
--data-raw '{
    "type": "email",
    "value": "[email protected]"
}'

A successful response will include the new allow list entry, like below

json
{
    "id": "allowlist-entry-ID",
    "type": "wallet",
    "value": "0xab5801a7d398351b8be11c439e05c5b3259aec9b",
    "appId": "your-privy-app-ID"
},