Every API here is available over the APIs.io API and to AI agents over MCP.
openapi: 3.2.0
info:
title: Mencoro Organizations 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: Organizations
description: Organizations
paths:
/api/v1/organizations/{organizationId}/entitlements:
get:
tags:
- Organizations
summary: Get an organization's plan allowance and consumption
description: 'Minimum role: owner. Returns what the current plan allows, how much of it has been consumed and when the allowance next resets, taken from the most recent subscription contract whether it is running or cancelled. An organization that has never subscribed answers `status: "none"` with every budget and consumption field null — null means "no plan on file, so not known", which is deliberately distinct from a budget or a consumption of zero. Commercial and provider details (prices, Stripe identifiers, internal tier codes) are not part of this contract.'
operationId: getEntitlements
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: The organization's allowance and consumption
content:
application/json:
schema:
$ref: '#/components/schemas/EntitlementsResource'
'401':
description: Missing or invalid API key
'403':
description: The key lacks the read capability
'404':
description: No organization the caller owns under this id
/api/v1/organizations/{organizationId}/archive:
post:
tags:
- Organizations
summary: Archive an organization
description: 'Minimum role: owner. Archiving also archives the active projects of the organization, cancels its pending invitations and cancels its subscription at the end of the current billing period. Those effects are applied by background subscribers, so a 200 means the organization was archived, not that every effect has finished. Preview it first to see exactly what will be touched.'
operationId: archiveOrganization
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
- name: X-Mencoro-Confirmation
in: header
description: 'The `confirmation.token` returned by POST /api/v1/organization-operation-previews for this exact action, organization and body. Single use, valid for five minutes, and bound to the effects the preview declared: if the organization gained a project or lost an invitation in between, it is refused with 409 rather than doing more than was agreed. Without it the call answers 428.'
required: true
schema:
type: string
example: mencoro_conf_VmajQznkILZjvFf63JexmT1AKX7iYZjOGSrBZYxlUTk
- name: Idempotency-Key
in: header
description: Repeat it to retry a lost response. The replay is answered from the record without claiming the confirmation again, so a retry is never refused for presenting a confirmation the first attempt already spent.
required: true
schema:
type: string
maxLength: 255
minLength: 8
example: 5c1b8e42-0d7f-4a93-8c61-9b2e4d0a7f38
responses:
'200':
description: The organization in its new state
content:
application/json:
schema:
$ref: '#/components/schemas/OrganizationResource'
examples:
archived:
summary: 'Call two of two: the confirmed write, answered with the organization re-read after the command'
description: 'Sent as POST with the preview token in X-Mencoro-Confirmation and an Idempotency-Key, and no body. The organization is re-read after the command rather than echoed, so `status` is what was actually stored. `role` is the caller''s own role, resolved live for this request. A 200 means the organization was archived, not that every effect has finished: the projects, the invitations and the subscription are handled by background subscribers, exactly as the preview warned.'
value:
id: 0193c4f0-11aa-7b22-9d33-4e5f60718293
name: Acme GmbH
description: Brand monitoring for the Acme group.
status: archived
imageUrl: null
contactEmail: ops@acme.example
role: owner
createdAt: '2026-01-08T07:45:11+00:00'
'401':
description: Missing or invalid API key
'403':
description: The key lacks the organization:manage capability
'404':
description: No organization the caller can access under this id
'409':
description: The confirmation is invalid, expired, already used, or its declared effects changed; or the status transition is not allowed
'428':
description: No confirmation was sent; preview the operation first
/api/v1/organizations:
get:
tags:
- Organizations
summary: List accessible organizations
description: 'Returns the organizations the key''s owner is an active member of, narrowed to the key''s scope. A key scoped to all organizations also sees organizations joined after it was created.Send `Accept: text/csv` to receive the same page as a CSV download instead of JSON: same filters, same authorization, same page window and the same maximum of 100 rows — it is this page in another format, not a bulk export, so a whole collection is still read by paging. The CSV carries no `total`, because a table whose every row is a record has nowhere to put one; read it from the JSON representation of the same request. Cells beginning with `=`, `+`, `-` or `@` are prefixed with an apostrophe so a spreadsheet treats them as text rather than running them as formulas.'
operationId: listOrganizations
parameters:
- name: limit
in: query
schema:
type: integer
default: 20
maximum: 100
minimum: 1
- name: offset
in: query
schema:
type: integer
default: 0
minimum: 0
- name: search
in: query
schema:
type: string
maxLength: 100
- name: status
in: query
schema:
type: string
enum:
- active
- archived
- name: sortBy
in: query
schema:
type: string
default: createdAt
enum:
- createdAt
- name
- name: sortOrder
in: query
schema:
type: string
default: desc
enum:
- asc
- desc
responses:
'200':
description: Accessible organizations
content:
application/json:
schema:
properties:
items:
type: array
items:
$ref: '#/components/schemas/OrganizationResource'
total:
type: integer
type: object
text/csv:
schema:
type: string
example: 'id,name
b3f1...,Acme
'
'401':
description: Missing or invalid API key
'403':
description: The key lacks the read capability
post:
tags:
- Organizations
summary: Create an organization
description: 'Requires a key scoped to all organizations and the "organization:manage" capability: a key limited to named organizations cannot widen its own reach by creating one. Preview it first and send the confirmation in X-Mencoro-Confirmation together with an Idempotency-Key.'
operationId: createOrganization
parameters:
- name: X-Mencoro-Confirmation
in: header
required: true
schema:
type: string
- name: Idempotency-Key
in: header
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
properties:
name:
type: string
maxLength: 100
minLength: 3
type: object
responses:
'201':
description: Organization created. Your owner membership follows asynchronously, so a read immediately afterwards can answer 404 until it lands.
content:
application/json:
schema:
properties:
id:
type: string
format: uuid
name:
type: string
status:
description: Always active on creation.
type: string
type: object
'401':
description: Missing or invalid API key
'403':
description: The key is not scoped to all organizations, or lacks "organization:manage"
'409':
description: The confirmation is invalid, expired, already used, or its effects changed
'428':
description: No confirmation was sent; preview the operation first
/api/v1/organizations/{organizationId}/restore:
post:
tags:
- Organizations
summary: Restore an archived organization
description: 'Minimum role: owner. Restoring reinstates the projects that were archived as part of archiving this organization - projects archived on their own stay archived - and aborts a pending subscription cancellation. Invitations cancelled by the archive are not reinstated. Preview it first to see which effects are reversible.'
operationId: restoreOrganization
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
- name: X-Mencoro-Confirmation
in: header
required: true
schema:
type: string
- name: Idempotency-Key
in: header
required: true
schema:
type: string
responses:
'200':
description: The organization in its new state
content:
application/json:
schema:
$ref: '#/components/schemas/OrganizationResource'
'401':
description: Missing or invalid API key
'403':
description: The key lacks the organization:manage capability
'404':
description: No organization the caller can access under this id
'409':
description: The confirmation is invalid, expired, already used, or its declared effects changed; or the status transition is not allowed
'428':
description: No confirmation was sent; preview the operation first
/api/v1/organizations/{organizationId}:
get:
tags:
- Organizations
summary: Get an organization
description: 'Minimum role: viewer. An organization outside the key''s scope, or one the caller is not an active member of, answers 404 - the API never confirms that an inaccessible organization exists.'
operationId: getOrganization
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: The organization
content:
application/json:
schema:
$ref: '#/components/schemas/OrganizationResource'
'401':
description: Missing or invalid API key
'403':
description: The key lacks the read capability
'404':
description: No organization the caller can access under this id
patch:
tags:
- Organizations
summary: Update an organization profile
description: 'Minimum role: owner. A partial update: omit a field to leave it alone, send it as null to clear it. Preview it first; the confirmation is bound to the current values, so an edit made by somebody else in between invalidates it rather than being silently overwritten. The organization image is deliberately NOT writable here, although the Mencoro app accepts one in the equivalent call: a published JSON API is the wrong place to carry a 10MB base64 blob in a body that also has to be fingerprinted for idempotency and digested for the confirmation. The image stays readable as `imageUrl`; changing it is done in the app.'
operationId: updateOrganization
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
- name: X-Mencoro-Confirmation
in: header
required: true
schema:
type: string
- name: Idempotency-Key
in: header
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
properties:
name:
type: string
maxLength: 100
minLength: 3
description:
type:
- string
- 'null'
contactEmail:
type:
- string
- 'null'
format: email
type: object
responses:
'200':
description: The updated organization
content:
application/json:
schema:
$ref: '#/components/schemas/OrganizationResource'
'401':
description: Missing or invalid API key
'403':
description: The key lacks the organization:manage capability
'404':
description: No organization the caller can access under this id
'409':
description: The confirmation is invalid, expired, already used, or the organization changed since the preview
'428':
description: No confirmation was sent; preview the operation first
/api/v1/organizations/{organizationId}/membership-stats:
get:
tags:
- Organizations
summary: Membership, project and invitation counts for an organization
description: 'Minimum role: owner. Pre-computed counts of the organization''s members, projects and outstanding invitations, read from a materialized view that is refreshed periodically — `computedAt` says when the snapshot was taken, so a member added since the last refresh is not counted yet. Every count is always an integer and a zero means zero; an organization whose row has not been computed yet answers 404 with code `organization_membership_stats_not_found`, never a body of zeros, so "none" and "not known yet" are never confused. Counts cover the whole organization, active and inactive alike: `totalMembersCount` includes suspended members, and `totalProjectsCount` includes archived projects. `pendingInvitationsCount` counts only invitations that are still pending and not yet expired.'
operationId: getMembershipStats
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: The organization's membership snapshot
content:
application/json:
schema:
properties:
activeMembersCount:
description: Members in the active state.
type: integer
minimum: 0
example: 85
suspendedMembersCount:
description: Members in the suspended state.
type: integer
minimum: 0
example: 3
totalMembersCount:
description: Every membership record, suspended ones included.
type: integer
minimum: 0
example: 88
activeProjectsCount:
description: Projects in the active state.
type: integer
minimum: 0
example: 18
totalProjectsCount:
description: Every project, archived ones included.
type: integer
minimum: 0
example: 25
pendingInvitationsCount:
description: Invitations still pending and not yet expired.
type: integer
minimum: 0
example: 5
computedAt:
description: When the snapshot was computed. A database timestamp, not an ISO-8601 instant.
type: string
example: '2026-02-12 10:30:00'
type: object
'401':
description: Missing or invalid API key
'403':
description: The key lacks the read capability
'404':
description: No organization the caller owns under this id (code `organization_not_found`), or the snapshot has not been computed for it yet (code `organization_membership_stats_not_found`)
/api/v1/organizations/{organizationId}/stats:
get:
tags:
- Organizations
summary: Headline counts for an organization
description: 'Minimum role: viewer. Active members, projects (total and active) and pending invitations, in one call. Every value is a count and is always known: 0 means the organization really has none of that thing, and no field is ever null. `members.total` counts ACTIVE memberships only, so a suspended member is not included; `projects.total` counts every project including archived ones, and `projects.active` the non-archived subset. This is a current-state snapshot and takes no date window.'
operationId: getOrganizationStats
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: The organization counts
content:
application/json:
schema:
properties:
members:
properties:
total:
description: Active memberships. Suspended members are excluded.
type: integer
minimum: 0
example: 12
type: object
projects:
properties:
total:
description: Every project in the organization, archived ones included.
type: integer
minimum: 0
example: 25
active:
description: Projects that are not archived; never greater than `total`.
type: integer
minimum: 0
example: 18
type: object
invitations:
properties:
pending:
description: Invitations still awaiting an answer. Accepted, cancelled and expired ones are excluded.
type: integer
minimum: 0
example: 3
type: object
type: object
'401':
description: Missing or invalid API key
'403':
description: The key lacks the read capability
'404':
description: No organization the caller can access under this id
/api/v1/organizations/{organizationId}/usage/tracked-queries:
get:
tags:
- Organizations
summary: Count the tracked queries an organization has configured
description: 'Minimum role: viewer. How many tracked queries the organization has configured, counted live in PostgreSQL — the write model — over EVERY project it owns, archived projects included, and over every tracked query in them, active and paused alike. It is deliberately a DIFFERENT number from `aggregate.totalTrackedQueries` in getOrganizationOverview: that one sums a per-project copy held in the Elasticsearch read model and covers ACTIVE projects only, so it excludes archived projects and can lag behind a change that already shows here. Expect the two to disagree and do not treat either as wrong. This figure does reconcile exactly with countTrackedQueries, which counts one project through the same counter in the same store: sum its unfiltered `count` over every project, archived included, and you get this number. For the ACTIVE subset and what it will consume, call getOrganizationProjectedMonthlyChecks, which ranges over the same projects. Do NOT derive the paused count by subtracting one from the other: this number is read live from Postgres while that one is served from a cache invalidated by background subscribers, so the two can disagree while that invalidation catches up and the difference is then a count of nothing. For how many projects this ranges over, read `projects.total` and `projects.active` from getOrganizationStats. The value is never null: 0 means none are configured. This operation takes no query parameters — the population is fixed, and a parameter it cannot honour is rejected with 400 rather than silently ignored.'
operationId: countOrganizationTrackedQueries
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: The organization's tracked-query count
content:
application/json:
schema:
$ref: '#/components/schemas/TrackedQueryUsageResource'
'400':
description: A query parameter was sent to an operation that accepts none; the details name it
'401':
description: Missing or invalid API key
'403':
description: The key lacks the read capability
'404':
description: No organization the caller can access under this id
/api/v1/organizations/{organizationId}/usage/projected-monthly-checks:
get:
tags:
- Organizations
summary: Project a month of check consumption from the current tracking configuration
description: 'Minimum role: viewer. What the organization''s current configuration would consume in a month, in checks — the same unit `checkBudget` and `checksAvailable` are counted in by the entitlements operation — so the two are directly comparable when sizing a plan. The arithmetic is published so it can be reproduced rather than trusted: for each ACTIVE tracked query, runs per month (daily 30, weekly 4, monthly 1) multiplied by its nPasses and engine weight, summed. Claude uses five checks per pass; every other engine uses one. A weekly query runs 4 times per month, not 4.345: a month is modelled as 30 days and 4 weeks, a planning convention rather than a calendar. Take `checkFrequency`, `nPasses` and `engine` from the tracked-query listing and the arithmetic will match — though the two sides are read from different places and settle at different times: this figure is computed in the Postgres write model and served from a cache that background subscribers invalidate, while that listing reads an Elasticsearch projection. Immediately after a write the two can disagree; neither is wrong, they are catching up. PAUSED queries are excluded from both figures; archived PROJECTS are not — archiving a project does not pause its tracked queries, so they still count here, exactly as they do in countOrganizationTrackedQueries. `activeTrackedQueryCount` describes the same population as that count, minus the paused queries — but do not compute the difference to learn how many are paused: THIS OPERATION IS CACHED and that one is read live, so the two can disagree while the cache is invalidated in the background. This is a projection of the configuration, not a forecast of what will actually be spent: it does not look at the remaining plan budget, does not know which checks will be skipped or retried, and reserves and debits nothing. It is also not the `checkCost` of countTrackedQueries, which prices one round over one project rather than a month over the organization. Both values are never null: 0 means nothing is scheduled. This operation takes no query parameters — the population is fixed, and a parameter it cannot honour is rejected with 400 rather than silently ignored.'
operationId: getOrganizationProjectedMonthlyChecks
parameters:
- name: organizationId
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: The projected monthly checks and the active tracked queries behind them
content:
application/json:
schema:
$ref: '#/components/schemas/ProjectedMonthlyChecksResource'
'400':
description: A query parameter was sent to an operation that accepts none; the details name it
'401':
description: Missing or invalid API key
'403':
description: The key lacks the read capability
'404':
description: No organization the caller can access under this id
components:
schemas:
EntitlementsResource:
description: What an organization's plan allows and what it has consumed
required:
- status
- isEntitled
properties:
status:
description: '"none" when the organization has never had a subscription contract.'
type: string
enum:
- active
- inactive
- none
isEntitled:
description: 'Whether the organization may use paid features right now: an active contract, or a cancelled one still inside its paid grace window.'
type: boolean
checkBudget:
description: Checks the current cycle allows. Null when there is no plan on file, which is not the same as a budget of zero.
type:
- integer
- 'null'
checksConsumed:
description: Checks consumed so far in the current cycle. Null when there is no plan on file.
type:
- integer
- 'null'
checksAvailable:
description: Checks left in the current cycle. Null when there is no plan on file.
type:
- integer
- 'null'
billingCycleType:
description: How often the allowance renews. Null when there is no plan on file.
type:
- string
- 'null'
enum:
- monthly
- yearly
- null
billingCycleAnchor:
description: Start of the current cycle. Null when there is no plan on file.
type:
- string
- 'null'
format: date-time
nextResetAt:
description: When the check budget next resets. Null when there is no plan on file.
type:
- string
- 'null'
format: date-time
cancelledAt:
description: When the subscription was terminally cancelled. Null while it has not been.
type:
- string
- 'null'
format: date-time
scheduledToCancelAt:
description: When a scheduled cancellation takes effect, while the subscription is still running. Null when none is scheduled.
type:
- string
- 'null'
format: date-time
gracePeriodEndsAt:
description: When paid access ends after a cancellation. Null when the subscription has not been cancelled.
type:
- string
- 'null'
format: date-time
type: object
TrackedQueryUsageResource:
description: How many tracked queries an organization has configured
required:
- trackedQueryCount
properties:
trackedQueryCount:
description: Tracked queries across every project of the organization, archived projects included, counting active and paused queries alike. Never null; 0 means none are configured.
type: integer
minimum: 0
example: 124
type: object
ProjectedMonthlyChecksResource:
description: What an organization's current tracking configuration would consume in a month
required:
- projectedMonthlyChecks
- activeTrackedQueryCount
properties:
projectedMonthlyChecks:
description: 'Checks a month of the current configuration would consume: for each ACTIVE tracked query, its runs per month (daily 30, weekly 4, monthly 1) multiplied by its nPasses and engine weight, summed. Claude uses five checks per pass; every other engine uses one. Never null.'
type: integer
minimum: 0
example: 720
activeTrackedQueryCount:
description: Active tracked queries the projection was summed over, across every project of the organization, archived projects included. Paused queries are excluded from both figures. Never null.
type: integer
minimum: 0
example: 24
type: object
OrganizationResource:
description: An organization the caller is a member of
required:
- id
- name
- status
- role
- createdAt
properties:
id:
type: string
format: uuid
name:
type: string
description:
type:
- string
- 'null'
status:
type: string
enum:
- active
- archived
imageUrl:
type:
- string
- 'null'
format: uri
contactEmail:
type:
- string
- 'null'
format: email
role:
description: The caller's current role in this organization
type: string
enum:
- owner
- manager
- viewer
createdAt:
type: string
format: date-time
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