“API: Keyword Clustering”
The Keyword Clustering module groups a keyword CSV when keywords share organic URLs in Google and gets the result ready to download as an Excel file. Everything is done from the Ranki app or with the HTTP API.
- Base REST endpoint:
https://api.ranki.co/v1/keyword-clustering - Usage: creating a job deducts 1 API credit per keyword in the CSV, taken from your API credit balance. Checking jobs and downloading the Excel file don’t deduct credits.
- Refund: if the job ends in
failed, the deducted credits are returned. - MCP: Keyword Clustering isn’t a tool in the Ranki MCP server. Use it from the app or with HTTP requests to the API, as described below.
Endpoint summary (5)
| # | Endpoint | Description |
|---|---|---|
| 1 | GET /keyword-clustering/credits | API credit balance. |
| 2 | GET /keyword-clustering/requests | Lists the account’s jobs. |
| 3 | GET /keyword-clustering/requests/{id} | Job status, download link and remaining balance. |
| 4 | POST /keyword-clustering/requests | Creates a job from a CSV. |
| 5 | GET /keyword-clustering/requests/{id}/download | Downloads the Excel file with the clusters. |
Statuses and sheets
A job goes through processing, completed or failed. Download is only available when the status is completed.
The Excel file has two sheets:
| Excel sheet | One row represents |
|---|---|
| Groups, the first | A cluster: main keyword, volumes, secondary keywords and most frequent URLs. |
| Keywords, the second | A secondary keyword, with its main keyword and search volume. |
1. Credit balance: GET /keyword-clustering/credits
Checks the authenticated account’s API credit balance.
REST endpoint
GET https://api.ranki.co/v1/keyword-clustering/credits
Authorization: Bearer rk_TU_CLAVE
Example with curl
curl -s \
-H "Authorization: Bearer rk_TU_CLAVE" \
"https://api.ranki.co/v1/keyword-clustering/credits"
Sample response
{
"balance": 500
}
2. List jobs: GET /keyword-clustering/requests
Lists the account’s clustering jobs.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
page | *integer* | No | 1 | Page, starting at 1. |
per_page | *integer* | No | 20 | Jobs per page. Maximum 100. |
REST endpoint
GET https://api.ranki.co/v1/keyword-clustering/requests?page=1&per_page=20
Authorization: Bearer rk_TU_CLAVE
Sample response
{
"page": 1,
"per_page": 20,
"total": 1,
"requests": [
{
"id": 42,
"request_name": "Keywords Colombia",
"status": "completed",
"total_keywords": 120,
"request_date": "2026-09-29 16:40:00",
"download_url": "/v1/keyword-clustering/requests/42/download"
}
]
}
download_url is null while the job isn’t completed. Paths are relative to https://api.ranki.co.
3. Job status: GET /keyword-clustering/requests/{id}
Returns a job’s status and the API credit balance.
REST endpoint
GET https://api.ranki.co/v1/keyword-clustering/requests/42
Authorization: Bearer rk_TU_CLAVE
The response uses the same fields as each item in requests, plus credits_remaining.
4. Create a job: POST /keyword-clustering/requests
Creates a job. The request is multipart/form-data. Returns 202 when the job is queued. The cost is 1 API credit per keyword with a value in the specified column. The first row of the CSV is treated as a header and isn’t counted.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
request_name | *string* | Yes | — | Job name. Maximum 255 characters. |
csv_file | *file* | Yes | — | CSV up to 10 MB. The delimiter can be a comma, semicolon or tab. |
keyword_column | *integer* | No | 0 | Index of the keyword column, starting at 0. |
volume_column | *integer* | No | 1 | Index of the search volume column, starting at 0. |
location | *string* | No | Colombia | SERP location. |
language | *string* | No | Espanol (Latinoamerica) | SERP language. |
device | *string* | No | desktop | Query device. |
os | *string* | No | windows | Query operating system. |
REST endpoint
curl -s -X POST \
-H "Authorization: Bearer rk_TU_CLAVE" \
-F "request_name=Keywords Colombia" \
-F "csv_file=@keywords.csv" \
-F "location=Colombia" \
-F "language=Espanol (Latinoamerica)" \
"https://api.ranki.co/v1/keyword-clustering/requests"
Sample response
{
"request_id": 42,
"status": "processing",
"total_keywords": 120,
"credits_deducted": 120,
"credits_remaining": 380,
"message": "Clustering job started"
}
Poll the job with GET /keyword-clustering/requests/{id} until status is completed.
5. Download the Excel file: GET /keyword-clustering/requests/{id}/download
Downloads the Excel file for the completed job, with the Groups and Keywords sheets.
REST endpoint
curl -L \
-H "Authorization: Bearer rk_TU_CLAVE" \
-o clusters.xlsx \
"https://api.ranki.co/v1/keyword-clustering/requests/42/download"
The response is a .xlsx (application/vnd.openxmlformats-officedocument.spreadsheetml.sheet).
Errors in this module
The error body uses detail.code and detail.message.
| HTTP | code | When it happens |
|---|---|---|
| 402 | INSUFFICIENT_CREDITS | The balance doesn’t cover the keywords in the CSV. The response includes required and balance. |
| 404 | NOT_FOUND | The job doesn’t exist in the account. |
| 404 | FILE_NOT_FOUND | The job shows as completed, but the Excel file isn’t available. |
| 409 | NOT_READY | The download was requested before the job was completed. |
| 413 | FILE_TOO_LARGE | The CSV exceeds 10 MB. |
| 422 | INVALID_FILE_TYPE | The file isn’t .csv. |
| 422 | EMPTY_FILE | The CSV is empty. |
| 422 | NO_KEYWORDS | The keyword column has no rows with a value. |
| 422 | INVALID_REQUEST_NAME | Missing request_name. |
| 422 | INVALID_CSV | The file couldn’t be read as a CSV. |