Open Endpoints [BETA]
The Open Endpoints in the are designed for simplified use of the SaaSquatch REST API functionality in client applications like the Mobile widget and SDK.
The primary use case for the Open Endpoints is in client-server interactions like the Mobile Widget and Mobile SDK. These actions typically involve looking up information about a referred user or who referred them.
Some examples include:
- Lookup a referral code after app install to display a dialog about who referred them
- Register a new user in the referral program
- Lookup share links to display a custom sharing dialog
- Lookup referrals to display a list of referred friends
The Open Enpoints provide flexible authentication options:
- Authenticated - For Open Endpoint calls that reqire authentication there are two options:
- JWT - JWTs can be used for requests that require authentication.
- API Key - Your tenant's API key can also be used for requests that require authentication.
- Unauthenticated - Some Open Endpoints do not require any form of authentication.
For security purposes there are limits on the number of requests that can be made using unauthenticated, and JWT authenticated, requests on your live tenant. Requests made using your API key, and any request made on your Test tenant, are not rate limited.
This functionallity is desiged such that only your backend system (as part of server-server communcation authenticated with your API key) can make a large number of requests. Individual client devices are only able to make a limited number of requests.
If the Open Endpoints are used correctly (mainly that server-server authentication is being done with your API key) these limitations should never be encountered.
Authentication Requirements by Method
The following table summarizes the Open Endpoint methods that are available for use, their required authentication, and the rate limits that apply when using unauthenitcated calls or those authenticated with JWTs:
|Open Endpoint method||Authentication required||Rate limits|
|Create a user||Requires Write Token or API key||Limited to 50 per day per IP|
|Upsert a user||Requires Write Token or API key||Limited to 50 per day per IP|
|Create a cookie user||No authentication required.||Limited to 50 per day per IP|
|Lookup a user||Requires Read Token or API key||Limited to 100 per hour per IP|
|Lookup a user by referral code||No authentication required.||Limited to 100 per hour per IP|
|Lookup a referral code||No authentication required.||Limited to 100 per hour per IP|
|Apply a referral code||Requires Write Token or API key.||Limited to 100 per hour per IP|
|List referrals||Requires Read Token or API key.||Limited to 100 per hour per IP|
Authentication with JWT
Authentication with JWTs should be used in client <-> server, not server <-> server, communication.
The Referral SaaSquatch API accepts two types of JWTs: read tokens, and write tokens. Read tokens are intended to validate a request to lookup information about an existing user/account while write tokens are intended to be used when adding or updating information about a user/account.
The format of the JWT payloads required for read and write tokens are outlined below:
|Read Token Payload||Write Token Payload|
The payload of a read token is based on the
The payload of a write token can contain the complete user object:
Building the JWT
The process for building the JWT is outlined on our JSON Web Tokens page.
Make sure you that you are trying to sign the correct format of the payload (Read Token vs Write Token) for your specific Open Endpoint API call.
Authentication with API Key
Authenticaion with your API key should be done when conducting server-server communication.
Authenticating Open Endpoint calls with an API key is done in the same way as with our standard API calls, details for which can be found in API Authentication.