Adding an API

This page will guide you on how to add an API to your Bearer account.

Adding a pre-configured API is a 3-steps process:

1. Select an API to add

To select an API to add, follow these steps:

  1. Click on "Add an API", select the API you want to use;

  2. After selection, click on the "Add" button.

Adding the GitHub API

For this guide, we will select the GitHub API as an example. Of course, the following steps are very similar for all APIs available on our Hub.

Not finding the API you want to add? We might have not yet register it on the API Hub. To add it anyway, have a look on how to add a custom API.

2. Setup the API

All APIs on the Hub are pre-configured to work with the Bearer platform. So you can focus on consuming endpoints - and not on dealing with authentication, base URL, etc.

Setting up an API on Bearer is a two steps process:

  1. Creating an account or an application on the API provider website

  2. Providing your API credentials to Bearer

2.1. Creating an account or an app on the provider website

To create an OAuth application on GitHub, follow these steps:

  1. Log in to https://github.com

  2. Access the developer settings page and register for a new OAuth application

  3. Fill the new application form with the following information:

Adding another API that uses OAuth2 or OAuth1? Make sure to configure the application using the following authorization callback URL:

https://int.bearer.sh/v2/auth/callback

This is a required step to allow Bearer handling the OAuth flow for you.

2.2. Providing your API credentials

To let Bearer performs authenticated requests to the API on your behalf, you need to provide your API credentials on the Instructions page.

With the GitHub API, right after registering a new OAuth application, Github will give you the necessary Client ID and Client Secret credentials.

Use them on the Instructions page of the Dashboard:

Save your GitHub credentials through the dashboard

Retrieving API credentials depends on each API provider. We know it sometimes hard to find API credentials, so you've sometimes a video to explain it or a link directly.

Otherwise, you should generally find the credentials on your account settings page, after logging in into the API developer website. In case you can't find them, feel free to ask us through the Slack community.

3. Try it out!

You are close to the end 🙌 Let's just confirm that everything is all set.

3.1. Generate an user identity

If the API you are adding doesn't rely on OAuth2 or OAuth1, you can skip this step.

Right from the Bearer's dashboard, on the Instructions page, you can generate a new identity by connecting yourself to an API using OAuth2 or OAuth1.

As we are trying to add the GitHub API, let's connect ourself with our GitHub account:

Click on "Connect to GitHub" and trigger an OAuth dance

The OAuth authentication uses your own credentials, that you just provided before. After granting access, on success, the "Connect" button will be replaced by an authId .

3.2. Test with an API call

Each APIs from the Hub provides a safe endpoint to let you try in seconds that everything is well configured. Just follow the steps from the Bearer's dashboard, depending on the API clients you want to use:

Making request to the GitHub API, using the Node.js client

FAQ

How many APIs can I add to my Bearer account?

You can add as much APIs as you want.

I'm looking for an API but I can't find it in Bearer's list

You can still add it to your Bearer account. Just follow the guide on how to add a custom API. Also feel free to reach us so that we can add this API in priority. We are adding new ones every week.

How to save multiple credentials for the same API?

You can save multiple credentials to the same API several times using the setup component. This is pretty useful if you are looking for retrieving the credentials of your own customers (e.g. to create a marketplace of integrations on your own service).

Troubleshooting

If your test request returned an error, first look at the logs in the Logs page. You will find useful information to help you debugging. For notice, most common errors are:

  • the API credentials aren't the right ones;

  • for OAuth2 and OAuth1 APIs only:

    • the authentication flow doesn't use the Bearer callback URL which is : https://int.bearer.sh/v2/auth/callback

    • the user identity hasn't been generated. Remind to click on the connect button to trigger the OAuth dance.

If you just can't make it, feel free to reach us in the #troubleshooting channel of the Bearer community. We're here to help! - Not part of our Slack? Click here to join it.