How to use the Public API?
Last updated
Last updated
Our public API documentation is driven by Swagger and can be accessed here.
You need to have a valid Keyword Insights subscription in order to use the public API.
Before using the public API, you need to acquire a bearer token for authentication so that our servers can verify who you are and that you have permission to use the API.
In order to use swagger, you need to be authenticated. See instructions below to do a proper authentication and retrieving a "bearer token".
Once you are authenticated, you can "try out" all available endpoints by inputting the "bearer token" and all required arguments.
This approach is for users who have signed up with email and password instead of Google Sign Up. If you have signed up via "Create with Google" please find instructions in the next section: How to authenticate with the public API and retrieve a bearer token? (Google Sign In Approach)
When you first open the API documentation, scroll to the bottom of the page and locate "Authentication".
Alternatively, you can click this link to get taken directly to the authentication section.
You should see a screen similar to this, on which you need to click the "Try it out" button.
Next, the text field below becomes editable.
Enter your valid email address and password, just like you would on the website app.keywordinsights.ai.
Click the large blue "Execute" button below the text field.
If your email and password are correct, you should see a response with a code = 200 and a JSON response object called "result".
From here, copy the value of the "access_token". In the example below, the copied value starts with "eyJ0...." and ends with "...Mokg". You will need this "token" for the next step.
In a text-editor of your choice, paste the copied access token and write the word "Bearer" (with a capital B) in front of the access token, separated with a space. So your complete string should look like this:
This token is needed to make requests to any endpoint. Some endpoints require additional arguments like "order_id" which you will need to grab from the application. Typically, you can find these IDs in the URL of the respective endpoint.
Validate your Bearer Token. Please go to the section Validate your Bearer Token to check if you have followed the steps above correctly.
This approach is for users who have signed up via "Create with Google" instead of typing an email and password into the form during sign up.
If you have signed up "manually" with an email and password, please find instructions in the previous section: How to authenticate with the public API and retrieve a bearer token? (Email and password approach)
In your browser of choice (we use Chrome in this example), open a new tab, and open the "Network" tab in the developer tools.
In the URL bar, type app.keywordinsights.ai, press enter and before logging in, click the clear button in the Network traffic tab.
Click "LOG IN WITH GOOGLE" and follow the prompts in the pop-up window as you normally would when signing in the application.
Once you are logged in, back in the Network tab, scroll up/down until you find a successful request. (We are choosing the /user request, but any other request will also do) Select the request, make sure the "Headers" section on the right-hand panel is selected, and scroll down until you find the "Authorization" section. From here, grab the "Bearer Token". Make sure to copy the entire String, including the word "Bearer".
Validate your bearer token. Please go to the section: Validate your Bearer Token to make sure you copied it correctly.
To easily validate if your "Bearer Token" is valid, scroll up to the "User" endpoint and try it out.
Click "Try it out" to make the text field editable.
Copy and paste the bearer token from the step above into the text field
Click the large, blue "Execute" button
If the bearer token was created correctly, you should see a response with a 200 response code and your user object.
Congratulations, you have successfully authenticated with our public API. All endpoints that are documented in the documentation can now be tried out.