> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markifact.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Tracked Keywords

> Add keywords to an Ahrefs Rank Tracker project (per country, optional city or region location and language, with tags), remove them, or add, replace and remove their tags

Add keywords to an Ahrefs Rank Tracker project (per country, optional city or region location and language, with tags), remove them, or add, replace and remove their tags. Free: does not consume API units, but tracked keywords count against the Ahrefs plan's Rank Tracker quota. Use ahrefs\_get\_locations for location IDs and language codes.

|                       |                                  |
| --------------------- | -------------------------------- |
| **App**               | Ahrefs                           |
| **Operation ID**      | `ahrefs_manage_tracked_keywords` |
| **Type**              | Action                           |
| **Connection**        | `ahrefs` (required)              |
| **Credits per run**   | Free                             |
| **Agent / MCP tool**  | Yes                              |
| **Requires approval** | Yes (write operation)            |

## Inputs

| Field         | Type                       | Required | Default | Description                                                                                                                                                                                                                                          |
| ------------- | -------------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `project_id`  | string or SelectItem       | Yes      | -       | The Rank Tracker project (numeric ID from the Ahrefs project URL). Use ahrefs\_list\_projects to find it.                                                                                                                                            |
| `action`      | string or SelectableOption | No       | `add`   | 'add' (default) starts tracking the keywords in the given country/location/language; 'remove' stops tracking them; 'add\_tags' appends tags to the keywords; 'replace\_tags' overwrites their tags; 'remove\_tags' removes the given tags from them. |
| `keywords`    | array of string or string  | Yes      | -       | Keywords to act on. Accepts a list or a newline/comma-separated string.                                                                                                                                                                              |
| `country`     | string or SelectableOption | No       | `us`    | Two-letter country code the keywords are (or will be) tracked in. Defaults to us.                                                                                                                                                                    |
| `location_id` | integer                    | No       | -       | Track at city or region level instead of the whole country: a location ID from ahrefs\_get\_locations. Leave empty for the country.                                                                                                                  |
| `language`    | string                     | No       | -       | Language code (e.g. en, de) from ahrefs\_get\_locations. Leave empty for the project's default.                                                                                                                                                      |
| `tags`        | string or array of string  | No       | -       | Tags: assigned to the keywords on 'add', and required for the tag actions. Accepts a list or a comma-separated string.                                                                                                                               |

### SelectItem

| Field   | Type   | Required | Default | Description                                                                                          |
| ------- | ------ | -------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `value` | string | Yes      | -       | The value of the selectable item.                                                                    |
| `label` | string | Yes      | -       | The label of the selectable item, used for display purposes. If not provided, defaults to the value. |

### SelectableOption

| Field   | Type   | Required | Default | Description |
| ------- | ------ | -------- | ------- | ----------- |
| `value` | string | Yes      | -       |             |
| `label` | string | Yes      | -       |             |

## Output

**Type**: `List[Dict]`

Returns the tracked keywords of the project after the change, as Ahrefs reports them (empty after removing the last ones): keyword, location, location\_id, language, language\_code, tags (comma-separated).

**Fields**: `keyword`, `location`, `location_id`, `language`, `language_code`, `tags`

**Example**:

```json theme={"dark"}
[
  {
    "keyword": "seo audit tool",
    "location": "United States",
    "location_id": 2840,
    "language": "English",
    "language_code": "en",
    "tags": "tools"
  }
]
```
