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

Copy code

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.

Semrush API FAQ

What’s my Semrush API key? Where do I get it?

The Semrush API key is an identification key assigned to you after subscribing to Semrush. You'll find it in Subscription info > API units.

Can I update my API key?

Since it’s sensitive information, you can’t do it by yourself. If you suspect that your API key may be compromised, contact Semrush Tech Support. They will update the API key for you.

What can I use the Semrush API for? Which API do I need?

The Semrush API can address many business needs, from optimizing SEO/PPC ROI to enhancing your market strategy.

To pick the right API type and methods for you, check out the most common Semrush API use cases.

How is unit consumption calculated?

Semrush API generally charges units in one of two ways:

  • Per request
  • Per line of data in the response

Note that all requests to the Listing Management API and Map Rank Tracker API don’t spend API units.

For details on how many units each request can consume, check the prices on the method pages. To learn how to calculate costs and optimize your API requests, refer to Limit consumption.

How can I know how many units I’ve used and how many I have left?

You can check your remaining API unit balance using a free API call or through the Semrush UI:

What support does Semrush offer for API calls?

Semrush provides elaborate API documentation that walks you through finding the right methods for your use case and creating calls. You can browse through the API methods available and check out the Get started guide.

If you have any questions, feel free to contact Semrush Tech Support.

What if I get stuck or want to build my own API calls?

If you need help with troubleshooting, get in touch with Semrush Tech Support.

What countries does the Semrush API data cover?

The data you can access depends on the tool you’re requesting it from. To learn what countries are available in the Semrush API, refer to Stats. Check the information for the corresponding Semrush tools and reports.

Does the Semrush API have rate or usage limits?

There are rate and usage limits in place, depending on the API. To review the rate and usage limits, refer to API usage restrictions.

Will Semrush notify me about changes in the API?

If major changes are made, Semrush will let you know about them with reasonable advance notice. For minor changes, review the API documentation. For specific inquiries, contact Semrush Tech Support or your account representative.

Related articles