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: March 13, 2025

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
Before making your first request, check your API unit balance to ensure it's sufficient for your use case.

Construct your API call

Review request example

All API methods include request examples, providing a great starting point for your requests.

Request example

Domain Overview request example

https://api.semrush.com/?key=API_KEY&type=domain_ranks&export_columns=Db,Dn,Rk,Or,Ot,Oc,Ad,At,Ac,Sh,Sv&domain=apple.com&database=us

Construct your API call

  1. Start with the base URL. For example, in the Domain Overview request, it's https://api.semrush.com/.
  2. Add ? to add request parameters.
  3. Enter the API key parameter: key=API_KEY. Replace API_KEY with your API key.
  4. Use & to separate parameters. You'll need to add & after each parameter.
  5. Enter the required parameters:
    1. Specify the report type: type=domain_ranks
    2. Provide the domain name: domain=apple.com
  6. Include any additional request parameters as needed. For example:
    1. Specify the database: database=us
    2. List the columns you want to retrieve: export_columns=Db,Dn,Rk,Or,Ot,Oc,Ad,At,Ac,Sh,Sv
  7. Put together the full request URL.
Note that the URL format may vary depending on the product and report. Refer to the .Trends API docs for the .Trends API request example.

Use display_limit to save API units

Certain types of reports within Semrush API support the display_limit parameter. Use it to limit the number of lines returned in a response to save on API units.

For 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 (for example, as Filters) are:

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

Test your API call

This step is optional. Be aware that test calls to the Semrush API will consume your API units.

Before integrating the Semrush API into your workflow, test your API request using Postman or cURL to ensure it returns the expected data.

  1. Verify authentication: Ensure the request includes the correct API credentials.
  2. Request only relevant data: Optimize performance by using filters and query parameters.
  3. Review API response: Confirm that the structure and content match your expectations.

Retrieve and process data

To automate data retrieval from the Semrush API, create a script in your preferred programming language that handles API calls, data processing, storage, and integration with BI tools or other platforms.

Key steps:

  1. Fetching data from the API: Ensure the script handles authentication, respects rate limits, and fetches only relevant data.
  2. Handling errors: Implement error handling with logging and retry mechanisms for failed or incomplete requests. For a list of possible API errors, refer to the Analytics API errors and Projects API errors.
  3. Processing the response: Convert or parse the response into your chosen format.
  4. Storing or transferring the data: Save the file locally or transfer the data to an external system such as an SFTP server, cloud storage, or a database.
  5. Integrating with BI and analytics tools: Load the processed data into dashboard systems such as Power BI, Tableau, or Salesforce for visualization and real-time insights.
  6. Automating recurring data updates: Schedule the script at predefined intervals using Task Scheduler (Windows) or cron jobs (Linux/macOS) to keep data fresh without manual effort.