“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)

#EndpointDescription
1GET /keyword-clustering/creditsAPI credit balance.
2GET /keyword-clustering/requestsLists the account’s jobs.
3GET /keyword-clustering/requests/{id}Job status, download link and remaining balance.
4POST /keyword-clustering/requestsCreates a job from a CSV.
5GET /keyword-clustering/requests/{id}/downloadDownloads 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 sheetOne row represents
Groups, the firstA cluster: main keyword, volumes, secondary keywords and most frequent URLs.
Keywords, the secondA 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

ParameterTypeRequiredDefaultDescription
page*integer*No1Page, starting at 1.
per_page*integer*No20Jobs 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

ParameterTypeRequiredDefaultDescription
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*No0Index of the keyword column, starting at 0.
volume_column*integer*No1Index of the search volume column, starting at 0.
location*string*NoColombiaSERP location.
language*string*NoEspanol (Latinoamerica)SERP language.
device*string*NodesktopQuery device.
os*string*NowindowsQuery 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.

HTTPcodeWhen it happens
402INSUFFICIENT_CREDITSThe balance doesn’t cover the keywords in the CSV. The response includes required and balance.
404NOT_FOUNDThe job doesn’t exist in the account.
404FILE_NOT_FOUNDThe job shows as completed, but the Excel file isn’t available.
409NOT_READYThe download was requested before the job was completed.
413FILE_TOO_LARGEThe CSV exceeds 10 MB.
422INVALID_FILE_TYPEThe file isn’t .csv.
422EMPTY_FILEThe CSV is empty.
422NO_KEYWORDSThe keyword column has no rows with a value.
422INVALID_REQUEST_NAMEMissing request_name.
422INVALID_CSVThe file couldn’t be read as a CSV.