Rest API Reference
The SaaSquatch API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients. JSON will be returned in all responses from the API, including errors.
To make the SaaSquatch API as explorable as possible, accounts have test-mode API keys as well as live-mode API keys. These keys are both active at the same time. Data created with test-mode credentials will use your payment system's respective test mode.
Authentication Summary
API methods may be used with one or several authentication schemes as defined in this table:
- APIKey
Authorize your requests using a tenant's API Key. Use this method of security only in server-to-server interactions.
- UserJWT
Authorize your requests using a JWT (JSON Web Token) for a given user. Useful for client-server authorization, such as the Mobile and Web SDKs. Used in Open Endpoints.
- Unauthenticated
- Does not require any type of authentication to make this API call.
Methods Summary
No ClassicMethod | Route | Description | Auth | Tags | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
get | /api/v1/{tenant_alias}/account/{accountId}/user/{userId}/pii | Lookup a user PII | APIKey | User | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/open/account/{accountId}/user/{userId}/events | Track User Event | APIKeyUserJWT | User EventOpen EndpointModern Only | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/account/{accountId}/user/{userId}/shareurls | Lookup a user's share URLs | APIKey | Share Links | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/account/{accountId}/user/{userId}/block | Block user | APIKey | User | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/account/{accountId}/user/{userId}/unblock | Unblock user | APIKey | User | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/users | List users | APIKey | User | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/code/{code} | Lookup a referral code | APIKey | Referral CodeDeprecated | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/referrals | List referrals | APIKey | Referral | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/referrals/{referralId} | Lookup a Referral | APIKey | Referral | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/reward/balance | List reward balances | APIKey | Reward Balance | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/credit/bulkredeem | Debit a reward balance | APIKey | Reward Balance | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/reward | List an account's rewards | APIKey | Reward | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/reward/{id} | Lookup a single reward | APIKey | Reward | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/credit/{id}/redeem | Redeem a single reward | APIKey | Reward | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/reward/{id}/cancel | Cancel a single reward | APIKey | Reward | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/rewards/account/{accountId}/user/{userId} | Create a single reward | APIKey | Reward | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
put | /api/v1/{tenant_alias}/open/account/{accountId}/user/{userId} | User Upsert | APIKeyUserJWT | UserOpen Endpoint | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/open/account/{accountId}/user/{userId} | Create a user and account | APIKeyUserJWT | UserOpen Endpoint | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/open/account/{accountId}/user/{userId} | Lookup a user | APIKeyUserJWT | UserOpen Endpoint | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
delete | /api/v1/{tenant_alias}/open/account/{accountId}/user/{userId} | Delete a user | APIKey | UserOpen Endpoint | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/open/account/{accountId}/user/{userId}/shareurls | Lookup a user's share URLs | APIKeyUserJWT | Share LinksOpen Endpoint | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/open/user | Get a user by a referral code | Unauthenticated | UserOpen Endpoint | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/open/code/{referral_code} | Lookup a referral code | Unauthenticated | Referral CodeOpen Endpoint | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/open/code/{code}/account/{accountId}/user/{userId} | Apply a referral code | APIKeyUserJWT | Referral CodeOpen Endpoint | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/open/referrals | List referrals | APIKeyUserJWT | ReferralOpen Endpoint | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
delete | /api/v1/{tenant_alias}/open/account/{accountId} | Delete an account | APIKey | AccountOpen Endpoint | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/subscription | Create a webhook subscription | APIKey | Webhook | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/subscription | List webhook subscriptions | APIKey | Webhook | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
delete | /api/v1/{tenant_alias}/subscription/{url} | Delete a webhook subscription | APIKey | Webhook | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/subscription/{url}/test | Test a webhook subscription | APIKey | Webhook | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
post | /api/v1/{tenant_alias}/export | Create an Export | APIKey | Export | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/export/{exportId} | Lookup an Export | APIKey | Export | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/export/{exportId}/download | Download an Export | APIKey | Export | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
get | /api/v1/{tenant_alias}/export/history/list | List Exports | APIKey | Export | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
19 hidden methods not for No Classic. Change personalization |
Account
An account is the lowest-level structure in your programs used to organize participants.
Key aspects of an account:
- Each account can only be referred once.
- Classic only The account status (TRIAL, PAID, CANCELLED) is set at the account level.
- Rewards are also earned at the account level
For information about how to structure your user and account ids read the Shared vs Solo Accounts article .
Endpoints |
---|
Delete an account |
2 endpoints hidden |
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: AccountOpen Endpoint |
Delete an account in your SaaSquatch project. This endpoint will delete the account and all users on the account. Learn more about Accounts vs. Users in our article on Account Structure.
To delete only a specific User on the Account use the Delete User endpoint.
Learn more about deleting participants within your SaaSquatch project in our article on Participant Deletion
Include the doNotTrack
query parameter as true
to indicate to the SaaSquatch system that all currently-registered Users on this Account should not be able to be re-registered on the same Account. Learn more about doNotTrack
in our article on Participant Deletion
User
Users are the people in your program. In other places a User might also be called a Contact, Lead or Participant. Users are each mapped to one specific account.
The following information is controlled at the user level:
- First and last name
- Email address
- Referral code
- Share links
For information about how to structure your user and account ids read the Shared vs Solo Accounts article .
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: User |
Returns details of the Personally identifiable information stored in the SaaSquatch system for a specific SaaSquatch user.
Warning! This method should only be used in connection with data protection and privacy compliance.
For programatically looking up information about users within your SaaSquatch project, please use the Lookup User endpoint
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: User |
Block a user from making successful referrals based upon their user and account id
.
More information about blocking users from participating in your referral program can be found in the SaaSquatch docs.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: User |
Unblock a user based upon their user and account id
.
More information about blocking users from participating in your referral program can be found in the SaaSquatch docs.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: User |
List all of the Users in your Referral SaaSquatch tenant. This method is the primary way of getting a full list of everyone that has been identified through the API, Squatch.js or mobile widgets.
This method supports pagination using the parameters for limit
and offset
to iterate through a very large list of records.
You can also search for particular users using the query
method. To find information about which users have completed referrals, use the List referrals method.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKeyUserJWT |
Tags: UserOpen Endpoint |
This method updates/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 in a user upsert. Make sure to check the tenant setting allowReferralCodeEditOnUserUpsert
, if it is set to FALSE
then referral codes added when upserting an existing user will be ignored. New sharelinks and referral codes will be set as primary for the upserted 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.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKeyUserJWT |
Tags: UserOpen Endpoint |
Create a user and account
post/api/v1/{tenant_alias}/open/account/{accountId}/user/{userId}
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.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKeyUserJWT |
Tags: UserOpen Endpoint |
Looks up a user based upon their id
and returns their personal information including sharelinks. This endpoint requires a read token or an API key.
This is an Open Endpoint and disabled by default. Contact support to enable the open endpoints.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: UserOpen Endpoint |
Delete a user in your SaaSquatch project. By default this endpoint only deletes a User on an Account (and not the Account itself). Learn more about Accounts vs. Users in our article on Account Structure.
To delete both the Account (and all the users on the account), use the Delete Account endpoint.
Learn more about deleting participants within your SaaSquatch project in our article on Participant Deletion
Include the doNotTrack
query parameter as true
to indicate to SaaSquatch that the user should not be able to be re-registered on the same account. Learn more about doNotTrack
in our article on Participant Deletion
Include the preserveEmptyAccount
query parameter as false
to indicate to SaaSquatch that the users account should be deleted if there are no other users in the account.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: Unauthenticated |
Tags: UserOpen Endpoint |
Looks up a user based upon their ReferralCode
and returns their personal information. This method is useful for retrieving the user when only the Referral Code is available, for example when a referred user enters a Referral Code during checkout and you want to find out who this Referral Code belongs to.
This is an Open Endpoint and disabled by default. Contact support to enable the open endpoints.
User Event
Any time a user interacts with your system, you would send SaaSquatch an event with details about this interaction.
Some examples of User Events to send to SaaSquatch include:
- Purchases or Transactions
- Subscription Creation/Update/Removal
- Mailing List Subscription
With each of these (and any other events you pass over), the more information you provide with the User Event, the more granual control is available in the SaaSquatch system when processing these events.
These events are then leveraged to update user information and trigger actions within your running Growth Automation programs.
Endpoints |
---|
Track User Event |
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKeyUserJWT |
Tags: User EventOpen EndpointModern Only |
Track User Event
post/api/v1/{tenant_alias}/open/account/{accountId}/user/{userId}/events
This method can be used to track when users make purchases, download items, or take other meaningful actions that you want to use to trigger your programs.
To prevent processing an event more than once, you can provide an idempotency key to achieve "at most once" processing semantics. The idempotency key uniquely identifies the event, and is generated by the caller.
The idempotency key can be any string identifier that your system associates with the event, with the following restrictions:
- It must be at least 8 characters long
- It must be no more than 64 characters long
- It can only contain alphanumerics characters, as well as the
.
,-
, or_
characters
For example, a good choice for an idempotency key is a UUID, in particular
a random version 4 UUID like ec524601-975c-458a-9948-ae4448ce8944
.
Idempotency keys are guaranteed to be stored by SaaSquatch for at least 24 hours, such that any event inputs with the same idempotency key within 24 hours will be guaranteed to process the events only once.
Subsequent attempts to process an event with an idempotency key that has already been processed once will result in an HTTP 409 Conflict response, so you will need to ensure that you are handling this status code in your request logic.
Referral Code
When a user is registered in our system they are provided a unique referral code. This code typically comes in the form of FIRSTNAMELASTNAME, such as JOHNDOE. By default the referral code is shown in the referral widget right underneath the main text.
The referral code provides a simple method for users to connect with your referral program. They are relatively short human-readable codes which users can share with their friends and family. Many people are familiar with the concept of a coupon code so using the referral codes as part of your referral program can make the process easier to understand.
A user will be provided one referral code for every referral program or partner program that you are running in your tenant.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Referral CodeDeprecated |
Looks up a referral code and the attached details. Deprecated in favour of its Open Endpoint equivalent.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: Unauthenticated |
Tags: Referral CodeOpen Endpoint |
Looks up a referral code and the details of the attached reward.
This is an Open Endpoint and disabled by default. Contact support to enable the open endpoints.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKeyUserJWT |
Tags: Referral CodeOpen Endpoint |
Apply a referral code
post/api/v1/{tenant_alias}/open/code/{code}/account/{accountId}/user/{userId}
Apply a ReferralCode
to a referred account to attribute a referral.
This endpoint requires a write token or an API key.
This is an Open Endpoint and disabled by default. Contact support to enable the open endpoints.
Referral
A Referral tracks who has referred whom.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Referral |
List all of the referrals in your Referral SaaSquatch tenant. This method is the primary way of getting a full list of everyone that has made a referral and everyone that has been referred,
and supports pagination using the parameters for limit
and offset
to iterate through a very large list of records.
You can also use the query parameters for referringAccountId
and referringUserId
to filters this list of referrals to only include those made by a given user.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Referral |
Looks up a single Referral object by it's associated id
. This method is helpful for looking into a particular referral of interest. Since it requires the id
of the referral to
be specified, it isn't applicable for querying all referrals to find those made by a particular user or account. To query for those referrals use the list referrals endpoint instead
with query parameters specified.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKeyUserJWT |
Tags: ReferralOpen Endpoint |
Lists all of the referrals involving the given user. This method is the primary way of getting a list of everyone that has made a referral and everyone that has been referred, and supports pagination using the parameters for limit
and offset
to iterate through a very large list of records.
Note: Either the referringAccountId
and referringUserId
or referredAccountId
and referredUserId
parameters are required, along with a read token for authenticaion.
This is an Open Endpoint and disabled by default. Contact support to enable the open endpoints.
Reward Balance
Reward Balances summarizes the Rewards in someone's account.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Reward Balance |
Looks up the balance for all rewards of the same type and units.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Reward Balance |
Used to redeem the credit earned from a referral program. Permanently debits an account balance. Works with: CREDIT
Reward
A Reward keeps track of a prize, discount or credit that someone has received.
All reward types other than gift card integrated rewards can be cancelled using the SaaSquatch API, or through the SaaSquatch Admin portal, if they have not already been redeemed.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Reward |
Looks up a list of single rewards
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Reward |
Used to lookup an individual reward using the ID of the reward. Works with: CREDIT
, PCT_DISCOUNT
, and FUELTANK
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Reward |
Used to redeem an individual credit earned from a referral program. Works with: CREDIT
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Reward |
Used to cancel an individual reward earned from a referral program. Works with: CREDIT
, PCT_DISCOUNT
, and FUELTANK
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Reward |
Create a single reward
post/api/v1/{tenant_alias}/rewards/account/{accountId}/user/{userId}
Used to create a reward for a specified user. Note that the reward will only be redeemed automatically if the default program supports automatic redemption for the provided reward type (see the install guides for more on automatic redemption).
Webhook
Webhooks can be used to do real time actions and data synchronization from SaaSquatch.
Webhooks let you register a URL that we will POST to anytime an event happens in your account. When the event occurs, for example when a vanity coupon code is created for a new user, SaaSquatch creates an event object. This object contains all the relevant information, including the type of event and the data associated with that event. SaaSquatch then sends an HTTP POST request with the event object to any URLs in your account's webhook settings. You can find a full list of all event types below.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Webhook |
Subscribes a URL to receive events via webhooks
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Webhook |
Lists all the URLs that are currently subscribed to receive events via webhooks
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Webhook |
Removes a URL from receiving events via webhooks
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Webhook |
Sends a test event to the specified webhook
Export
Exports are used to do bulk data dumps from your SaaSquatch account.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Export |
Creates an asynchronous request for an Exports. Depending on the size of the Export and other exports in the export pipeline, it may take awhile for an export request to complete. Once the Export is completed, it can be downloaded in the requested format (CSV or zipped XLSX) using the download url endpoint.
Here are a few ways to check for when an export is ready.
- Polling - While an export is being prepared you can check the status using the
id
. Make sure you store theid
of the export when you request it. - Webhooks - When an export is complete, a webhook event will be fired. Make sure you create a webhook endpoint subscription before you create your export.
- Listing - You can use the API to list recent exports, and check their status.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Export |
Looks up an Export to check its status. Useful when you're generating exports to check when an export is complete. When the status is no longer PENDING
so that you can begin to download the export.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Export |
The endpoint to download a completed export. This method can only be used when an export is COMPLETED
. Exports are not always immediately available to download
after they have been created, often exports are large files that take time to process and prepare. If you want to check if an export is ready to be downloaded,
use the API method to lookup an export or to list exports.
Security Details |
---|
Works for Server requests Mobile requests Browser requests |
Auth Tags: APIKey |
Tags: Export |
List all of the exports in a tenant. Useful for tracking down exports
Theme
Themes control the look and feel of your program's widgets.
Discount
Endpoints for working with discounts. Most of these are deprecated in favor of using Reward endpoints.