Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Mencoro Clusters API
description: 'Public API for Mencoro customers. Authenticate with an API key: `Authorization: Bearer mencoro_sk_...`.'
termsOfService: https://mencoro.com/legal/
contact:
name: Mencoro Support
url: https://mencoro.com/contact/
email: support@mencoro.com
license:
name: Proprietary
url: https://mencoro.com/legal/
version: 1.0.0
servers:
- url: https://api.mencoro.com
description: Production
security:
- ApiKey: []
tags:
- name: Clusters
description: Clusters
paths:
/api/v1/organizations/{organizationId}/projects/{projectId}/clusters/jobs/{jobId}/apply:
post:
tags:
- Clusters
summary: Apply the result of a clustering job
description: 'Minimum role: manager. Writes a completed clustering job onto the tracked queries it was computed for: it creates the clusters the job proposed that the project does not have yet, then assigns each tracked query according to the merge mode the job was started with — fill_gaps leaves already grouped queries alone, add_on_top only adds, full_regroup replaces a query''s clusters with the proposed set and therefore REMOVES clusters that are not in it — but only for a tracked query the job actually returned an assignment for. A tracked query the job was started over and produced no assignment for is listed under `unassigned` and left exactly as it was, under every mode; it is not treated as "belongs to no cluster" and is never stripped. That matters most with restrictToExistingClusters, where the model is expected to return nothing for queries that fit no existing cluster. The body must be empty: the assignments, the target tracked queries and the mode all come from the job, so this call cannot apply something the job did not produce. Synchronous and partially successful — always 200, with each tracked query under `successful` or `failed`, and nothing rolled back because one failed. A job that is not completed, or one that produced no assignments, is refused with 409. Requires the write capability and an Idempotency-Key header; repeating the key returns the first answer rather than applying twice.'
operationId: applyClusteringJob
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
- name: projectId
in: path
required: true
schema:
type: string
format: uuid
- name: jobId
in: path
description: Must be a clustering job started for this organization and project.
required: true
schema:
type: string
format: uuid
- name: Idempotency-Key
in: header
description: Repeat it to retry a lost response without applying the job twice.
required: true
schema:
type: string
responses:
'200':
description: What was written; read `failed` rather than inferring success from the status
content:
application/json:
schema:
$ref: '#/components/schemas/ApplyClusteringJobOutcome'
'400':
description: A body was sent, or the Idempotency-Key header is missing; the details name the field
'401':
description: Missing or invalid API key
'403':
description: The key lacks the write capability
'404':
description: No organization, project or clustering job the caller can access under these ids
'409':
description: The job is not completed, produced nothing that can be applied, the organization is archived, the project is archived, or the idempotency key was reused for a different request, a concurrent request with the same key is still running, or a previous attempt with it ended without a known outcome
/api/v1/organizations/{organizationId}/projects/{projectId}/clusters/batch:
post:
tags:
- Clusters
summary: Create several keyword clusters at once
description: 'Minimum role: manager. Creates up to 100 empty keyword clusters in one call. Names are trimmed and lower-cased and repeated names in the body are collapsed before anything is written. Partial success: the answer is always 200 and reports every name under `successful` or under `failed` — a name already taken in the project fails with query_cluster_name_already_exists and is NOT resolved to the existing cluster, while the other names are still created. Nothing is rolled back because one name failed. The clusters are created empty; no tracked query is assigned to them. The organization must not be archived; an archived project IS refused with 409, stricter than the Mencoro app, which lets cluster writes into one. Requires the write capability and an Idempotency-Key header.'
operationId: batchCreateQueryClusters
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
- name: projectId
in: path
required: true
schema:
type: string
format: uuid
- name: Idempotency-Key
in: header
description: Repeat it to retry a lost response without creating the batch twice.
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCreateQueryClustersRequestData'
responses:
'200':
description: Per-name results; read `failed` rather than inferring success from the status
content:
application/json:
schema:
$ref: '#/components/schemas/BatchCreateQueryClustersOutcome'
'400':
description: The body was rejected, or the Idempotency-Key header is missing; the details name the field
'401':
description: Missing or invalid API key
'403':
description: The key lacks the write capability
'404':
description: No organization or project the caller can access under these ids
'409':
description: The organization is archived, or the idempotency key was reused for a different request, a concurrent request with the same key is still running, or a previous attempt with it ended without a known outcome
/api/v1/organizations/{organizationId}/projects/{projectId}/clusters:
post:
tags:
- Clusters
summary: Create a keyword cluster
description: 'Minimum role: manager. Creates one empty keyword cluster in the project. The name is trimmed and lower-cased before it is stored, and it must be unique within the project: a name that already exists is refused with 409 and nothing is merged into the existing cluster. The cluster starts with no tracked queries in it — this operation does not assign anything to it. The organization must not be archived; an archived project IS refused with 409, stricter than the Mencoro app, which lets cluster writes into one. Requires the write capability and an Idempotency-Key header.'
operationId: createQueryCluster
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
- name: projectId
in: path
required: true
schema:
type: string
format: uuid
- name: Idempotency-Key
in: header
description: 'A token you choose per operation, 8 to 255 printable ASCII characters with no spaces; a UUID is the obvious choice. Repeat it to retry a lost response without creating a second cluster. The key is scoped to your API key, and it is bound to the method, the path and the body of the first attempt: repeating it with anything else changed is refused with 409 rather than replayed.'
required: true
schema:
type: string
maxLength: 255
minLength: 8
example: 3f9d2c18-6b4a-4c77-9f10-6f2d5a7c8e21
requestBody:
required: true
content:
application/json:
schema:
properties:
name:
description: Stored trimmed and lower-cased. Unique within the project.
type: string
maxLength: 200
type: object
example:
name: Agencia SEO
responses:
'201':
description: The cluster that was created
content:
application/json:
schema:
$ref: '#/components/schemas/QueryClusterResource'
examples:
createdOrReplayed:
summary: The created cluster - and byte for byte what a retry with the same Idempotency-Key gets back
description: 'A retry carrying the same Idempotency-Key and the same body does not create a second cluster: the recorded response is replayed, with the same 201 and the same `id`. That is what makes a lost response safe to retry. `name` comes back lower-cased because that is how the domain stores it, so "Agencia SEO" is answered as "agencia seo".'
value:
id: 0193c4f4-01c9-7d18-8a52-7b3e9f04a1d7
projectId: 0193c4f1-8e2a-7c31-9d40-5b6f1a2c3d4e
name: agencia seo
'400':
description: The body was rejected, or the Idempotency-Key header is missing; the details name the field
'401':
description: Missing or invalid API key
'403':
description: The key lacks the write capability
'404':
description: No organization or project the caller can access under these ids
'409':
description: A cluster with this name already exists in the project, the organization is archived, the project is archived, or the idempotency key was reused for a different request, a concurrent request with the same key is still running, or a previous attempt with it ended without a known outcome
content:
application/json:
schema:
properties:
code:
type: string
message:
type: string
requestId:
type: string
format: uuid
type: object
examples:
idempotencyKeyReused:
summary: The same Idempotency-Key sent with a different request
description: 'The key was already spent on another operation, so replaying it would answer the wrong one and running it would perform a second operation under an authorisation meant for the first. Use a fresh key for a new operation; reuse one only to retry the identical request. The fingerprint covers the method, the path and the body exactly as sent, so the same call written with a differently-cased UUID in the path is a different request and lands here too. Two neighbouring cases carry their own codes: `operation_already_in_progress` while a concurrent request holds the key, and `operation_outcome_uncertain` when an earlier attempt failed without a known outcome - that one is never retried automatically, so check whether it took effect before using a new key.'
value:
code: idempotency_key_reused
message: This idempotency key was already used for a different request. Use a new key for a new operation.
requestId: 0193c4f4-3d60-7a0b-9e77-1c5482af6390
/api/v1/organizations/{organizationId}/projects/{projectId}/clusters/{clusterId}:
get:
tags:
- Clusters
summary: Get one of a project's keyword clusters
description: 'Minimum role: viewer. Returns a single keyword cluster of the project, the same projection the cluster listing returns for each of its rows. A cluster belonging to another project answers 404, the same answer an unknown id and a malformed one get, so the API never confirms that a cluster the caller cannot reach exists.'
operationId: getQueryCluster
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
- name: projectId
in: path
description: Must belong to the organization in the path.
required: true
schema:
type: string
format: uuid
- name: clusterId
in: path
description: Must be a cluster of the project in the path.
required: true
schema:
type: string
format: uuid
responses:
'200':
description: The keyword cluster
content:
application/json:
schema:
$ref: '#/components/schemas/QueryClusterResource'
'401':
description: Missing or invalid API key
'403':
description: The key lacks the read capability
'404':
description: No organization, project or cluster the caller can access under these ids
delete:
tags:
- Clusters
summary: Delete a keyword cluster
description: 'Minimum role: manager. Deletes one keyword cluster. The tracked queries that were in it are NOT deleted: they are unassigned from this cluster and keep every other cluster they belong to. Analytics filtered by this cluster id return nothing afterwards, including for dates before the deletion, because that filter reads current membership. This cannot be undone — recreating a cluster with the same name produces a new id and an empty cluster. The organization must not be archived, and neither must the project: an archived project IS refused with 409, stricter than the Mencoro app, which lets cluster writes into one. Requires the write capability and an Idempotency-Key header.'
operationId: deleteQueryCluster
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
- name: projectId
in: path
required: true
schema:
type: string
format: uuid
- name: clusterId
in: path
description: Must be a cluster of the project in the path.
required: true
schema:
type: string
format: uuid
- name: Idempotency-Key
in: header
description: Repeat it to retry a lost response; a fresh key answers 404 once the cluster is gone.
required: true
schema:
type: string
responses:
'200':
description: The cluster was deleted
content:
application/json:
schema:
properties:
id:
description: The cluster that was deleted
type: string
format: uuid
name:
description: Its name at the moment it was deleted
type: string
deleted:
description: Always true; present so the body is self-describing
type: boolean
type: object
'400':
description: A body was sent, or the Idempotency-Key header is missing; the details name the field
'401':
description: Missing or invalid API key
'403':
description: The key lacks the write capability
'404':
description: No organization, project or cluster the caller can access under these ids
'409':
description: The organization is archived, or the idempotency key was reused for a different request, a concurrent request with the same key is still running, or a previous attempt with it ended without a known outcome
patch:
tags:
- Clusters
summary: Rename a keyword cluster
description: 'Minimum role: manager. Changes the name of one keyword cluster and nothing else: the tracked queries assigned to it are untouched, and its id does not change, so nothing a client stored breaks. The new name is trimmed and lower-cased and must be unique within the project; a collision is refused with 409. Renaming to the name the cluster already has is accepted and is a no-op. The organization must not be archived; an archived project IS refused with 409, stricter than the Mencoro app, which lets cluster writes into one. Requires the write capability and an Idempotency-Key header.'
operationId: renameQueryCluster
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
- name: projectId
in: path
required: true
schema:
type: string
format: uuid
- name: clusterId
in: path
description: Must be a cluster of the project in the path.
required: true
schema:
type: string
format: uuid
- name: Idempotency-Key
in: header
description: Repeat it to retry a lost response without renaming twice.
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
properties:
name:
description: Stored trimmed and lower-cased. Unique within the project.
type: string
maxLength: 200
type: object
responses:
'200':
description: The cluster in its new state
content:
application/json:
schema:
$ref: '#/components/schemas/QueryClusterResource'
'400':
description: The body was rejected, or the Idempotency-Key header is missing; the details name the field
'401':
description: Missing or invalid API key
'403':
description: The key lacks the write capability
'404':
description: No organization, project or cluster the caller can access under these ids
'409':
description: Another cluster in the project already has this name, the organization is archived, the project is archived, or the idempotency key was reused for a different request, a concurrent request with the same key is still running, or a previous attempt with it ended without a known outcome
/api/v1/organizations/{organizationId}/projects/{projectId}/clusters/jobs:
post:
tags:
- Clusters
summary: Start a keyword clustering job
description: 'Minimum role: manager. Asks the clustering service to propose keyword clusters for up to 500 tracked queries of the project, and answers 202 with the job to poll — the work runs in the background and a 202 says it was accepted, never that it succeeded. THE JOB WRITES NOTHING: it produces a proposal, and nothing changes until it is applied through the apply operation, which is a separate call. Duplicate query texts within the selection are sent once. Requires an entitled subscription (402 otherwise) and the organization must be active and the project not archived. Rate limited to 10 starts per minute per organization, shared with the same operation in the web application. Requires the write capability and an Idempotency-Key header; repeating the key returns the first job rather than starting a second.'
operationId: startClusteringJob
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
- name: projectId
in: path
required: true
schema:
type: string
format: uuid
- name: Idempotency-Key
in: header
description: Repeat it to retry a lost response without starting a second job.
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/StartClusteringJobRequestData'
responses:
'202':
description: The job was accepted; poll trackingUrl until its status is terminal
content:
application/json:
schema:
$ref: '#/components/schemas/AcceptedJobResource'
'400':
description: The body was rejected, or the Idempotency-Key header is missing; the details name the field
'401':
description: Missing or invalid API key
'402':
description: The organization has no entitled subscription
'403':
description: The key lacks the write capability
'404':
description: No organization, project or tracked query the caller can access under these ids
'409':
description: The organization is archived, the project is archived, there is nothing to cluster, or the idempotency key was reused for a different request, a concurrent request with the same key is still running, or a previous attempt with it ended without a known outcome
'429':
description: More than 10 clustering starts in a minute for this organization; Retry-After says when to try again
components:
schemas:
BatchCreateQueryClustersRequestData:
description: The cluster names a batch create asks for
required:
- names
properties:
names:
description: Cluster names to create, already trimmed and lower-cased on the server. Duplicates are collapsed.
type: array
items:
type: string
maxLength: 200
maxItems: 100
minItems: 1
type: object
QueryClusterResource:
description: A keyword cluster of a project
required:
- id
- projectId
- name
properties:
id:
description: Pass this value in the queryClusterIds filter of the analytics operations
type: string
format: uuid
projectId:
description: The project this cluster belongs to
type: string
format: uuid
name:
description: Unique within the project, stored lower-cased
type: string
maxLength: 200
type: object
ApplyClusteringJobOutcome:
description: Per-tracked-query results of applying a clustering job
properties:
successful:
description: Tracked queries written, each with the cluster ids it ended up with - the resulting state, not the delta.
type: array
items:
properties:
trackedQueryId:
type: string
format: uuid
queryClusterIds:
type: array
items:
type: string
format: uuid
type: object
failed:
description: 'Always present, empty list included: read it rather than inferring success from the status code.'
type: array
items:
properties:
trackedQueryId:
type: string
format: uuid
errorCode:
type: string
errorMessage:
type: string
type: object
clusters:
description: Every cluster the assignments referred to, and whether this call created it.
type: array
items:
properties:
id:
type: string
format: uuid
name:
type: string
created:
type: boolean
type: object
skippedClusters:
description: Proposed names the store cannot hold. A tracked query whose proposed cluster was skipped ends up with fewer clusters than the proposal showed.
type: array
items:
properties:
name:
type: string
reason:
type: string
type: object
unassigned:
description: Tracked queries the job produced no assignment for. Nothing was written for them and they keep the clusters they already had, under every merge mode.
type: array
items:
type: string
format: uuid
type: object
BatchCreateQueryClustersOutcome:
description: Per-name results of creating clusters in bulk
properties:
successful:
description: Clusters created by this call.
type: array
items:
properties:
name:
type: string
id:
type: string
format: uuid
type: object
failed:
description: 'Always present, empty list included: read it rather than inferring success from the status code.'
type: array
items:
properties:
name:
type: string
errorCode:
type: string
errorMessage:
type: string
type: object
type: object
AcceptedJobResource:
description: Background work accepted for processing
required:
- jobId
- deduplicated
- trackingUrl
properties:
jobId:
description: The job to poll. May name a job started by an earlier, equivalent request.
type: string
format: uuid
deduplicated:
description: Whether this call started the job, or joined one that was already running
type: boolean
trackingUrl:
description: Poll this until the job reaches a terminal status
type: string
format: uri
type: object
StartClusteringJobRequestData:
description: What a clustering job should group, and how
required:
- trackedQueryIds
- mode
properties:
trackedQueryIds:
description: The tracked queries to cluster. Duplicates are collapsed.
type: array
items:
type: string
format: uuid
maxItems: 500
minItems: 1
mode:
description: fill_gaps groups only tracked queries that belong to no cluster; add_on_top adds the new clusters to whatever each query already has; full_regroup replaces the current clusters with the job's.
type: string
enum:
- fill_gaps
- full_regroup
- add_on_top
restrictToExistingClusters:
description: When true the job may only use clusters the project already has, and leaves a query ungrouped rather than inventing a name for it.
type: boolean
default: false
type: object
securitySchemes:
ApiKey:
type: http
description: 'A Mencoro API key, created from the app under API keys in the user menu. The plaintext key is shown once, at creation, and never again. A key only ever RESTRICTS: it never grants more than its owner''s live membership and role already allow, and every request re-checks those.'
scheme: bearer