contacts

Telephone

United States

dropdown button

United States

Canada

United Kingdom

Spain

France

Italy

Germany

Australia

+1 (800) 815 - 9959

10:00 AM - 5:00 PM (EST/EDT)

Monday - Friday

mobile-menu

Get started

Basic docs divider Last updated: April 30, 2024

Get API key

Your API key lets you send requests through the Semrush API.

To get your key:

  1. Click the icon at the top right of the Semrush interface to access your account.
  2. Select Subscription info and go to the API Units tab.
  3. Copy your API key.
copy-api-key.png

Check your balance

When running an API request, each particular line will cost API unit*.
The total amount of units that you will need to spend per request will depend on the exact number of lines in the report.

Make sure that you have a sufficient number of API units: within the Subscription info tab or via API request (Check API unit balance).

*Billing Traffic analytics API works differently, read more here.

Break down your API calls in a text editor

Each report type provides an example of a request. This is a great starting point for your own requests.

request

1) Begin with the base URL. It depends on the product

endpoint

2) Enter ?key followed by you API key

3) Enter report type

report-type

4) Enter request parameters

5) Enter the domain name

6) Enter the database

Use display_limit to save API units

Certain types of reports within Semrush API have “display_limit”. Display limits are used when the report you are pulling data from analyzes data in specific order

Use display_limit to limit the amount of lines to save API units

Example:

Adding “&display_limit=10” will limit your request to the top 10 results.

Encode special characters

When making API requests, parameter values containing special characters must be converted to URL-encoded strings. To simplify the process, you can use a URL encoder.

The characters typically used in Semrush API calls are:

Character Encoded
# %23
& %26
* %2A
+ %2B
- %2D
: %3A
| %7C
% %25
/ %2F
Show all

Handle the errors

If you recive an error code saying there was a problem within your API request, refer to the Error page to view description that will help to fix the problem.