cover
API
Bearn API Quickstart Guide
General API Information
The Bearn platform is supported by the Bearn APIs. These APIs can be used to create custom flows in other products and to provide useful integration points for our partners and our own internal tooling. These APIs follow the REST convention where requests are made against resources using an http method to infer an action on that resource:
Http MethodResourceBehavior
POST/offer/jsonCreate an offer
GET/offer/jsonRetrieve an offer
PATCH/offer/jsonUpdate an offer
DELETE/offer/jsonRemove an offer
API Endpoints
Bearn provides two API endpoints, one for preproduction environments and one for production:
EnvironmentEndpoint
Preproduction
Production
All examples in this document will use the preproduction endpoint, however both environments are virtually identical with the exception of which version of the API is running on the environment.
API Documentation
API documentation can be found here:
Please register with a new user and verify your email address.
Authorized Credentials
When you are ready to make requests directly from your application, please make an subject: Authorized Credentials Request to our API support team [email protected] Make sure the subject is "Authorized Credentials Request" and provide the following in the body of the email:
*The permissions can be found at the heading of each api listing in our apidoc: (example) partner. Create. Links
Your company's name
Your name
Your email
Your contact phone number
How you intend to use our API ➅ What permissions you require*
By default, your client credentials can be used to make requests against the API for resources and HTTP methods which do not require any permissions. If you are accessing a resource and HTTP method that requires permissions, and your credentials do not have the appropriate permission, you will receive an HTTP 403 Forbidden. Please make a request to [email protected] to add the appropriate permissions
To authenticate, you will first need to generate a JWT token by using the appropriate token endpoint:
curl --request POST \
 --url 'https://auth.beta.bearnit.com/oauth/token' \
 --header 'content-type: application/x-www-form-urlencoded' \
 --data grant_type=client_credentials \
 --data 'client_id=YOUR_CLIENT_ID' \
 --data client_secret=YOUR_CLIENT_SECRET \
 --data audience=http://beta.bearnit.com
The response will be similar to:
{
 "access_token": "<JWT.TOKEN>",
 "expires_in": 86400,
 "token_type": "Bearer"
}
Where <JWT.TOKEN> is a JWT token that (when decoded) stores information similar to:
{
 "iss": "https://auth.beta.bearnit.com/",
 "sub": "1Dwq9VDQG9eKOP5G7IUnKvUUHSH2qqqK@clients",
 "aud": "http://beta.bearnit.com",
 "iat": 1594770529,
 "exp": 1594856929,
 "azp": "1Dwq9VDQG9eKOP5G7IUnKvUUHSH2qqqK",
 "gty": "client-credentials",
}
You can use jwt.io to both preview and verify the token. Note the 86400 expiration is in seconds and equates to 24 hours. THIS VALUE MAY VARY as changes to our platform are made so please track the expiration and make a new request for a token appropriately. Please DO NOT make a request for a token for every call. We will both save money on our bandwidth and reduce unnecessary overhead and reduced security if you follow oauth2 client-credentials conventions.
Now that you have a JWT token, you can add the appropriate header to your client and make API calls as a partner application:
curl -H'Authorization: Bearer <JWT.TOKEN>'https://api.beta.bearnit.com/offer/json
For non curl clients, you will need to add a request header Authorization with value Bearer <JWT.TOKEN> making sure to replace <JWT.TOKEN> with the token from the authorization response you received in the prior step.Now that you have a JWT token, you can add the appropriate header to your client and make API calls as a partner application:
General API Information
When you bring a user to the Bearn platform, you may want to track and mark that user as your user on Bearn. We provide a series of APIs that provide link generation, tagging, and tracking for our partners.
If you are just interested in basic links to the Apple App and Google Play stores, and do not wish to interact with the APIs, please email [email protected] with subject: Bearn Partner Links and provide the following information in the body:
Your company's name
Your name
Your email
Your contact phone number
We will respond with two links, one for the Apple Store and one for the Google Play Store which you can send to your users. When a user clicks one of the links, we will attribute the user in our platform to you as a partner.
More Control
You can control the link generation and tagging process yourself by using our APIs. The following API generates two links, one for the Apple App Store and one for the Google Play Store: https://api.beta.bearnit.com/apidoc/#api-Partner.
The API endpoint requires the partner/advertiser ID, if you do not know what this ID is, please email [email protected] with subject Partner ID and body:
Your company's name
Your name
Your email
Your contact phone number
And we will reply with your partner ID.
You can also pass arbitrary tags in with your link for your own purposes. These tags are available when running conversion or partner user reports.
docs
Apple and Google Branding
When sharing these links out, you could and probably should use both Apple's and Google's general guidelines for linking to their stores:
The API endpoint requires the partner/advertiser ID, if you do not know what this ID is, please email [email protected] with subject Partner ID and body:
Your company's name
Your name
Your email
Your contact phone number
And we will reply with your partner ID.
You can also pass arbitrary tags in with your link for your own purposes. These tags are available when running conversion or partner user reports.
docs
Download the Bean App today and start earning by burning calories!
Get it on Google Play
Download on the App Store
Partner User Reporting
We provide an API for our partners to track conversion of generated links to user signups. Please review the following API: