API Open Endpoints
Open Endpoints are API calls designed for simplified use of the REST API functionality. The primary use case for the Open Endpoints is in client-server interactions, such as through a mobile app. These actions typically involve looking up information about an advocate or whom they’ve referred.
Some examples include:
Look up a referral code after app install to display a dialog about who referred them
Register a new user in the referral program
Look up share links to display a custom sharing dialog
Look up referrals to display a list of referred friends
Authentication options
Authentication via JSON Web Token (JWT) - JWTs can be used for requests that require authentication. The process for building JWTs is outlined in our JSON Web Tokens documentation. Use for client-server communication.
Authentication via API Key - Your API key can also be used for requests that require authentication. Use for server-server communication.
Unauthenticated - Some Open Endpoints do not require any form of authentication.
Authentication Requirements by Method
The following table summarizes the Open Endpoint methods that are available for use, and their required level of authentication:
Write Token or API key
Write Token or API key
Read Token or API key
No authentication required
No authentication required
Write Token or API key
Read Token or API key
Authentication with JWT
Authentication with JWTs should be used in client-server, not server-server communication.
The Advocate 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
The payload of a read token is based on the user id and account id:
Write Token Payload
The payload of a write token can contain the complete user object:
Note: The following fields are optional: lastName, locale, referralCode, imageUrl, and exp (expiry date in seconds since the epoch).
Building the JWT
Tip: The process for building the JWT is outlined on our JSON Web Tokens page.
Make sure 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
Authentication with your API key should be done when conducting server-server communication.
Tip: 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.
Last updated
