You can manage your user base programmatically through our API. Below are the details of the API routes available for adding and removing users from your white-labeled site.
Prerequisites
1. Enable the API:
Before using the API routes, you need to enable the API in your White Label settings. You can do this by navigating to White Label Settings.
2. Obtain Your API Key:
When calling any of the API routes, you must include your API Key in the request header. You can retrieve or reset your API key from your account settings at the bottom of the page here.
Example Request Header:
{
"Deal-AI-API-Key": "<api key goes here>"
}
Adding a User
To add a user to your white-labeled site, use the following API route:
Endpoint:
POST https://api.marketing.deal.ai/api/2024-01/whitelabel/users
Request Body Parameters:
`firstName` (required): The first name of the user.
`lastName` (optional): The last name of the user.
`email` (required): The email address of the user.
`password` (optional): The password for the user. If not provided, a random password will be generated.
`sendInviteEmail` (optional, defaults to "no"): Determines whether an invitation email is sent to the user. Set to `"yes"` to send the invite.
`role` (optional): Sets a pre-defined role for the user, as configured in your White Label settings
Example Request:
{
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"password": "securePassword123",
"sendInviteEmail": "yes",
"role": "Premium Plan"
}
Response:
200 OK: The user was successfully added.
>= 400 Error: An error occurred during the process. Check the response for specific error details.
Removing a User
To remove a user from your white-labeled site, use the following API route:
Endpoint:
DELETE https://api.marketing.deal.ai/api/2024-01/whitelabel/users
Request Body Parameters:
`email` (required): The email address of the user to be removed.
Example Request:
{
"email": "[email protected]"
}
Response:
200 OK: The user was successfully removed.
>= 400 Error: An error occurred during the process. Check the response for specific error details.
Updating a User's Role
To update or remove a role for a user in your white-labeled site, use the following API route:
Endpoint:
PATCH https://api.marketing.deal.ai/api/2024-01/whitelabel/users/role
Request Body Parameters:
`email` (required): The email address of the user to update.
`role` (optional): Sets a pre-defined role for the user, as configured in your White Label settings, or, if empty or undefined, removes the user's current role, giving them the Default Role
Example Request:
{
"email": "[email protected]",
"role": "Basic Plan"
}
Response:
200 OK: The user was successfully updated.
>= 400 Error: An error occurred during the process. Check the response for specific error details.
Important Notes
Ensure that all required fields are populated before making the API requests.
If you do not provide a password when adding a user, a random password will be generated and used by default.
The `sendInviteEmail` parameter allows you to control whether an invitation email is sent to the user upon creation.
Remember to enable the API in your White Label settings before attempting to use these routes.
Always include your API Key in the request header when calling these API routes.
Zapier
To learn how to set up Zapier to use the API, check out this article.
These API routes provide a flexible way to manage your users, especially when you need to automate user management tasks within your white-labeled site. If you encounter any issues or have further questions, please contact our support team.