
<div style='background-color: #f0f4f8; border-left: 4px solid #007acc; padding: 15px 20px; font-family: Arial, sans-serif; font-size: 20px; color: #333;'>
  <strong>7th June 2025 - All API methods are now available for all subscription plans, including the Bronze.</strong>
</div>
<p>&nbsp;</p>

# Get Related Keywords


?> **POST** `{{{v1.server}}}/get_related_keywords`


Obtain a list of related keywords based on your provided seed keyword.

**Note:** Each keyword result retrieved through this API endpoint consumes 2 credits.


### Authorization

You need an API key to access this API endpoint. Get your API key [here](https://keywordseverywhere.com/first-install-addon.html).


### Example API Calls

<!-- tabs:start -->

#### ** Bash **

- Urlencoded version

```shell script
params=()
params+=("keyword=$(echo -e 'climate change' | iconv -t utf-8)") # For shells not using UTF-8, ensure that your input data is encoded in UTF-8.
params+=('num=5')
data=$(IFS='&' ; echo "${params[*]}")
curl -H 'Authorization: Bearer {{{v1.apiKey}}}' -H 'Accept: application/json' --data "$data" '{{{v1.server}}}/get_related_keywords'
```

- JSON version

```shell script
curl -H 'Authorization: Bearer {{{v1.apiKey}}}' -H 'Accept: application/json' -H 'Content-type: application/json' --data '{
    "keyword": "climate change",
    "num": 5
}' '{{{v1.server}}}/get_related_keywords'
```


#### ** PHP **

```php
<?php

$parameters = [
  "keyword" => mb_convert_encoding("climate change", 'UTF-8'), # Please ensure that your input data is encoded in UTF-8.
  "num" => 5
];

$query = http_build_query($parameters);

$ch = curl_init('{{{v1.server}}}/get_related_keywords');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  'Accept: application/json',
  'Authorization: Bearer {{{v1.apiKey}}}'
));

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);

$data = curl_exec($ch);
$err = curl_error($ch);
$info = curl_getinfo($ch);
curl_close($ch);

if($info['http_code'] == 200){
  echo "Success!\n\n" . $data;
} else {
  echo "An error occurred.\n\n" . $data;
}
```

#### ** Laravel **

```php
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;

/*
 * Execute this command as follows:
 *
 * php artisan get-related-keywords
 */
class GetRelatedKeywordsCommand extends Command
{

    protected $signature = 'get-related-keywords';

    public function handle()
    {
        $response = Http::withToken('{{{v1.apiKey}}}')
            ->acceptJson()
            ->asForm()
            ->post('{{{v1.server}}}/get_related_keywords', [
                "keyword" => mb_convert_encoding("climate change", 'UTF-8'), # Please ensure that your input data is encoded in UTF-8.
                "num" => 5
            ]);

        try {
            echo $response->throw()->body();
        } catch (\Exception $e) {
            echo "An error occurred.\n\n" . $e->getMessage();
        }

        return 0;
    }
}
```

#### ** Java **

```java
package org.example;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;

public class GetRelatedKeywords {

    public static void main(String[] args) throws UnirestException {
        // Unirest automatically encodes data in the standard UTF-8 format during a request.
        // However, when using HttpURLConnection or similar libraries, ensure they are set to use UTF-8 encoding.
        HttpResponse<String> response = Unirest.post("{{{v1.server}}}/get_related_keywords")
                .header("Accept", "application/json")
                .header("Authorization", "Bearer {{{v1.apiKey}}}")
                .field("keyword", "climate change")
                .field("num", 5)
                .asString();
        if (response.getStatus() == 200) {
            System.out.printf("Success.\n\n%s\n", response.getBody());
        } else {
            System.out.printf("An error occurred.\n\n%s\n", response.getBody());
        }
    }
}
```

#### ** Python **

```python
# pip install requests
import requests

my_headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer {{{v1.apiKey}}}'
}

# In Python 3, strings are inherently in UTF-8 encoding.
# Character set conversions are unnecessary unless directly dealing with byte arrays.
my_data = {
    "keyword": "climate change",
    "num": 5
}
response = requests.post('{{{v1.server}}}/get_related_keywords', data=my_data, headers=my_headers)
if response.status_code == 200:
    print('success\n\n' + response.content.decode('utf-8'))
else:
    print("An error occurred\n\n" + response.content.decode('utf-8'))
```

#### ** Ruby **

```ruby
require 'uri'
require 'net/http'
require 'openssl'

endpoint_url = URI("{{{v1.server}}}/get_related_keywords")

http = Net::HTTP.new(endpoint_url.host, endpoint_url.port)
{{^v1_ruby_disable_ssl}}
http.use_ssl = false
{{/v1_ruby_disable_ssl}}

request_params = []
request_params.append("keyword=climate change")
request_params.append("num=5")

request = Net::HTTP::Post.new(endpoint_url)
request["Accept"] = 'application/json'
request["Authorization"] = 'Bearer {{{v1.apiKey}}}'
# Ensure that your data is encoded in UTF-8 format before sending it to the API
request.body = request_params.join("&").encode(Encoding::UTF_8)
response = http.request(request)

if response.code == "200"
    puts "Success\n\n%s" % response.read_body
else
    puts "An error occurred\n\n%s" % response.read_body
end
```

#### ** NodeJs **

```js
// The Fetch API inherently supports only UTF-8 encoding, eliminating the need for character set conversions.
fetch('{{{v1.server}}}/get_related_keywords', {
    method: 'POST',
    body: new URLSearchParams([
        ["keyword", "climate change"],
        ["num", 5]
    ]),
    headers: {
        'Accept': 'application/json',
        'Authorization': `Bearer {{{v1.apiKey}}}`
    },
})
    .then((response) => response.text())
    .then((text) => console.log(text))
    .catch(error => {
        console.log(error)
    })
```

#### ** R **

```R
#install.packages(c("httr", "jsonlite"))
library(httr)
library(jsonlite)

body <- list()

body["keyword"] <- "climate change"
body["num"] <- 5

# R strings and httr requests use UTF-8 by default, removing the need for post data character set conversions.
res = POST(
    "{{{v1.server}}}/get_related_keywords",
    body = body,
    add_headers('Accept' = 'application/json',
                'Authorization' = 'Bearer {{{v1.apiKey}}}')
)
prettify(content(res, as = "text", encoding = "UTF-8"))
```

#### ** n8n (Custom Node) **



#### Workflow Diagram
![](images/n8n/custom_node/get_related_keywords.png)

#### Steps to Import the Workflow
1. If you haven't done so already, install the **[Keywords Everywhere API](https://www.npmjs.com/package/n8n-nodes-keywords-everywhere-api)** community node in your n8n instance.
2. Copy the JSON below and save it in a file.

  ```json
{{=<% %>=}}
  {
      "name": "Get Related Keywords with Keywords Everywhere API",
      "nodes": [
          {
              "parameters": [],
              "type": "n8n-nodes-base.manualTrigger",
              "typeVersion": 1,
              "position": [
                  0,
                  0
              ],
              "id": "eaf9ae45-1f57-4ab0-b409-47025435f70f",
              "name": "When clicking ‘Test workflow’"
          },
          {
              "parameters": {
                  "jsCode": "return [\n  {\n    \"keywords\": [\"climate change\", \"expired domains\"]\n  }\n];"
              },
              "type": "n8n-nodes-base.code",
              "typeVersion": 2,
              "position": [
                  220,
                  0
              ],
              "id": "b15627ae-5667-4ade-a6eb-16437a6e87db",
              "name": "Code"
          },
          {
              "parameters": {
                  "fieldToSplitOut": "keywords",
                  "options": []
              },
              "type": "n8n-nodes-base.splitOut",
              "typeVersion": 1,
              "position": [
                  440,
                  0
              ],
              "id": "017ed0d9-8c19-4c7f-9df6-da4c0c91ad10",
              "name": "Split Out"
          },
          {
              "parameters": {
                  "operation": "get_related_keywords",
                  "keyword": "={{ $json.keywords }}"
              },
              "type": "n8n-nodes-keywords-everywhere-api.keApi",
              "typeVersion": 1,
              "position": [
                  660,
                  0
              ],
              "id": "99afed01-05e4-49dc-8b92-94bb5ace88f6",
              "name": "Keywords Everywhere API",
              "credentials": {
                  "keApi": {
                      "id": "mnEzGlz9z1I4xoRi",
                      "name": "Keywords Everywhere account"
                  }
              }
          }
      ],
      "pinData": [],
      "connections": {
          "When clicking ‘Test workflow’": {
              "main": [
                  [
                      {
                          "node": "Code",
                          "type": "main",
                          "index": 0
                      }
                  ]
              ]
          },
          "Code": {
              "main": [
                  [
                      {
                          "node": "Split Out",
                          "type": "main",
                          "index": 0
                      }
                  ]
              ]
          },
          "Split Out": {
              "main": [
                  [
                      {
                          "node": "Keywords Everywhere API",
                          "type": "main",
                          "index": 0
                      }
                  ]
              ]
          }
      },
      "active": false,
      "settings": {
          "executionOrder": "v1"
      },
      "versionId": "ca79715e-a963-4527-bb31-c11fd205b107",
      "meta": {
          "templateCredsSetupCompleted": true,
          "instanceId": "966c4cf410ae6fb732aadc4c54977f525964e0daf5ee3fe3d431437b967b7ce2"
      },
      "id": "sG5tFN759rk8kBaL",
      "tags": []
  }
<%={{ }}=%>
  ```
3. In your n8n instance, click on the **&#x22EF;** menu at the top right and select the **Import from File** option.
4. Select the JSON file you saved above.
5. Adjust any necessary parameters (e.g., **Keywords Everywhere** credentials).

#### ** n8n (HTTP Request) **


#### Workflow Diagram
![](images/n8n/http_request/get_related_keywords.png)

#### Steps to Recreate the Workflow
1. Start with a **Trigger Node**: e.g., **"Trigger Manually"** to invoke the workflow.
2. Add a **"HTTP Request"** node.
   - Click **"Import cURL"** at the top right of the node editor.
   - Paste the command below and click **"Import"**.
     ```shell
     curl -H 'Authorization: Bearer {{{v1.apiKey}}}' -H 'Accept: application/json' -H 'Content-type: application/json' --data '{
         "keyword": "climate change",
         "num": 5
     }' '{{{v1.server}}}/get_related_keywords'
     ```
   - Adjust the authorization header with your **Keywords Everywhere** API key.

     ![](../_media/n8n/authorization_header.png)

3. Adjust any necessary parameters (e.g., you can rename the node to **"Get Related Keywords"**).

#### ** Make.com **

#### Scenario Diagram

![](images/make/get_related_keywords.png)

#### Steps to Recreate the Above Scenario

1. Copy the JSON blueprint below and save it as a file (for example, blueprint.json).
   ```json
   {
       "name": "Get Related Keywords - Keywords Everywhere API",
       "flow": [
           {
               "id": 4,
               "module": "app#keywords-everywhere-api:getRelatedKeywords",
               "version": 1,
               "parameters": {
                   "__IMTCONN__": 3266898
               },
               "mapper": {
                   "num": "5",
                   "keyword": "climate change"
               },
               "metadata": {
                   "designer": {
                       "x": 0,
                       "y": 0
                   },
                   "restore": {
                       "parameters": {
                           "__IMTCONN__": {
                               "data": {
                                   "scoped": "true",
                                   "connection": "app#keywords-everywhere-api-0p871s"
                               },
                               "label": "Keywords Everywhere Production"
                           }
                       }
                   },
                   "parameters": [
                       {
                           "name": "__IMTCONN__",
                           "type": "account:app#keywords-everywhere-api-0p871s",
                           "label": "Connection",
                           "required": true
                       }
                   ],
                   "expect": [
                       {
                           "name": "keyword",
                           "type": "text",
                           "label": "Keyword"
                       },
                       {
                           "name": "num",
                           "type": "number",
                           "label": "Num"
                       },
                       {
                           "name": "keyword",
                           "type": "text",
                           "label": "Keyword"
                       },
                       {
                           "name": "num",
                           "type": "number",
                           "label": "Num"
                       }
                   ]
               }
           }
       ],
       "metadata": {
           "instant": false,
           "version": 1,
           "scenario": {
               "roundtrips": 1,
               "maxErrors": 3,
               "autoCommit": true,
               "autoCommitTriggerLast": true,
               "sequential": false,
               "slots": null,
               "confidential": false,
               "dataloss": false,
               "dlq": false,
               "freshVariables": false
           },
           "designer": {
               "orphans": []
           },
           "zone": "us2.make.com",
           "notes": []
       }
   }
   ```

2. Sign in at make.com using your credentials.

3. From your dashboard, click **"Scenarios"** in the navigation menu.

4. Click the **"Create a new scenario"** button in the top right.

5. In the scenario editor, click the ellipsis (⋯) menu in the bottom left and select **"Import blueprint."**

   ![](../_media/make/import_blueprint.png)

6. When prompted, click "Browse" (or "Choose file"), then select your blueprint.json file.

7. Adjust any required parameters (such as **Keywords Everywhere** credentials) according to the blueprint.

#### Steps to Add the "Get Related Keywords" to a Pre-Existing Scenario

1. In the scenario editor, click the **"+"** or **"Add another module"** button.

2. In the search field that appears, type **"Keywords Everywhere API."**

3. Select the **"Get Related Keywords"** module from the search results.

4. Follow the on-screen prompts to configure the module with your desired parameters or credentials.

5. Confirm to add the module. It will append to your current scenario without overwriting existing modules.


<!-- tabs:end -->

### Request Body Parameters

<table>
    <thead>
    <tr>
        <th>Name</th>
        <th>Description</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>
            <strong>
                <code>keyword</code>
            </strong>
        </td>
        <td>
            <p>
              <strong>Type:</strong>
              <code>string</code>
            </p>
            <div><strong>Examples:</strong></div>
            <ul>
              <li><em>climate change</em></li>
              <li><em>best keyword tool</em></li>
            </ul>
            <p>A UTF-8 encoded keyword to get data for.</p>
        </td>
    </tr>
    <tr>
        <td>
            <strong>
                <code>num</code>
            </strong>
        </td>
        <td>
            <p>
              <strong>Type:</strong>
              <code>integer</code>
            </p>
            <p>
              <strong>Range:</strong>
              1 to 10,000
              <br>       
            </p>
            <div><strong>Examples:</strong></div>
            <ul>
              <li><em>5</em></li>
              <li><em>100</em></li>
              <li><em>10000</em></li>
            </ul>
            <p>Specifies the maximum number of results to return.</p>
        </td>
    </tr>
    </tbody>
</table>


### Response HTTP Status Codes

| Status Code | Description                                                 |
|-------------|-------------------------------------------------------------|
| `200`       | A successful request                                        |
| `400`       | Submitted request data is invalid                           |
| `401`       | API key is missing or is invalid                            |
| `402`       | Account has an invalid subscription or insufficient credits |


### Success Response Fields

<table>
    <thead>
    <tr>
        <th>Name</th>
        <th>Description</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>
            <code>data</code>
        </td>
        <td>
            <strong>Type:</strong> <code>array</code><br>
            The related keywords data
        </td>
    </tr>
    <tr>
        <td>
            <code>data.#</code>
        </td>
        <td>
            <strong>Type:</strong> <code>string</code><br>
            <strong>Example:</strong> <em>climate change consequences</em><br>
            A related keyword result.
        </td>
    </tr>
    <tr>
        <td>
            <code>credits_consumed</code>
        </td>
        <td>
            <strong>Type:</strong> <code>integer</code><br>
            <strong>Example:</strong> <em>10</em><br>
            Amount of credits consumed by the request.
        </td>
    </tr>
    <tr>
        <td>
            <code>time_taken</code>
        </td>
        <td>
            <strong>Type:</strong> <code>float</code><br>
            <strong>Example:</strong> <em>0.01</em><br>
            The time it took to execute the request in seconds.
        </td>
    </tr>
    </tbody>
</table>


### Sample Success Response

```json
{
    "data": [
        "climate change consequences",
        "climate change simple definition",
        "climate change pdf",
        "climate change definition pdf",
        "climate change traduction"
    ],
    "credits_consumed": 10,
    "time_taken": 0.01
}
```


### Sample Unauthorized Response

```json
{
    "message": "401 Missing Or Invalid API Key"
}
```

### Sample Subscription Required Response

```json
{
  "message": "402 Subscription Required",
  "description": "A valid subscription is required to access this resource."
}
```


### Sample Insufficient Credits Response

```json
{
  "message": "402 Insufficient Credits",
  "description": "You do not have sufficient credits to complete this request."
}
```


