Octolens Feedback API

The Feedback API from Octolens — 2 operation(s) for feedback.

GitHub OpenAPI

Operations 3

POST /api/v2/feedback Submit relevance feedback #
DELETE /api/v2/feedback Remove relevance feedback #
GET /api/v2/feedback/stats Get feedback stats #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/octolens-com:octolens-com-feedback-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

octolens-com-feedback-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Octolens Feedback API
  version: 2.0.0
  description: 'The Octolens API lets you query mentions, manage keywords, and configure feeds programmatically. Every action available in the Octolens UI is available here. ### Authentication


    Public v2 endpoints require an API key. Create one in **Settings > API** and pass it as `Authorization: Bearer `. Keys are scoped to the organization they were minted in; you cannot access another org''s data. Internal UI endpoints (`x-internal: true`) require a member session in the active workspace instead, and a trusted browser origin for writes. API keys carry a scope — `read`, `write` (implies read), or `admin` (implies write). Each endpoint documents the scope it needs via the `x-required-scope` OpenAPI extension and the scope badge in the docs surface. ### Rate limiting


    The v2 API is rate-limited at **500 requests per hour per organization**, across all keys for that org. The limit resets at the top of each clock hour (fixed hourly window — the counter is keyed by the UTC hour bucket, not a rolling trailing hour). Every 2xx response carries three headers so clients can pace themselves:

    * `X-RateLimit-Limit` — the hourly cap (500)

    * `X-RateLimit-Remaining` — requests left in the current window

    * `X-RateLimit-Reset` — Unix timestamp (seconds) when the window resets


    When the cap is hit, the endpoint returns **429 Rate Limited** with an additional `Retry-After` header (seconds until the next window). The response body is the standard `ErrorResponse` with `code: "RATE_LIMITED"`. `POST /api/v2/mentions/export` additionally has its own, stricter limits — **5 exports per hour and 2 concurrent exports per organization** — because a single export fans out into up to 500 backing queries. See that endpoint''s description; prefer one filtered export over polling exports on a schedule. ### Response timing


    Every response also carries a standard `Server-Timing` header with the server-side breakdown of that request — `auth` (credential verification, plan gate and rate limiting), `handler` (the endpoint''s own work) and `total`, in milliseconds. Use it to tell whether a slow call was spent in the API''s request pipeline, in the query behind the endpoint, or on the network in between; browsers surface it automatically in devtools. Responses rejected before the endpoint ran carry `auth` and `total` only, and an endpoint may publish extra metrics of its own alongside these three — parse the header as a list, not as a fixed triple. ### Error handling


    All non-2xx responses share the same `ErrorResponse` envelope: `{ error: { code, message, status, details? } }`. The `code` field is a stable `ApiErrorCode` enum — branch on it programmatically instead of parsing `message`. See the `ApiErrorCode` schema for the full catalog grouped by category. `VALIDATION_ERROR` (400) responses include a `details` array with per-field Zod issues — inspect `details[i].path` to pinpoint which input was rejected. Unknown paths under `/api/v2/` (including the bare `/api/v2` root) answer **404** with the same envelope (`code: "NOT_FOUND"`) and a message pointing back at this spec — never an HTML error page. Legacy `/api/v1/` paths behave the same with v1''s lowercase-code envelope (`code: "not_found"`). ### Discovery


    Machine-readable entry points, for agents and tooling:

    * `GET /api/v2/openapi.json` — this document (also mirrored at `https://octolens.com/openapi.json`)

    * `GET /api/v2/docs` — human-readable reference rendered from it

    * `GET /.well-known/oauth-protected-resource/api/v2` — RFC 9728 protected-resource metadata for this API, declaring `scopes_supported: [read, write, admin]`

    * `GET /.well-known/oauth-protected-resource` — the same metadata for the MCP server (`/api/mcp/v2`, OAuth)


    ### Building filter bodies


    Endpoints that accept `simpleFilters` / `advancedFilters` (e.g. `POST /api/v2/mentions`, `PATCH /api/v2/feeds/{id}`) take a structured object that can be tricky to hand-craft.'
servers:
- url: https://app.octolens.com
  description: Production
- url: http://localhost:3000
  description: Local development
security:
- ApiKey:
  - read
tags:
- name: Feedback
paths:
  /api/v2/feedback:
    post:
      operationId: submitFeedback
      summary: Submit relevance feedback
      description: Submit thumbs-up / thumbs-down feedback on a mention. Updates Tinybird and adjusts relevance + tags so the feed reflects user intent immediately.
      tags:
      - Feedback
      x-required-scope: write
      security:
      - ApiKey:
        - write
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitFeedbackRequest'
      responses:
        '200':
          description: 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeedbackRecord'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden (insufficient plan or permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
    delete:
      operationId: removeFeedback
      summary: Remove relevance feedback
      description: Remove a stored feedback record by mention key. Always succeeds; `removed` reports whether a record actually existed (`false` = nothing was stored — a harmless no-op).
      tags:
      - Feedback
      x-required-scope: write
      security:
      - ApiKey:
        - write
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RemoveFeedbackRequest'
      responses:
        '200':
          description: 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RemoveFeedbackResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden (insufficient plan or permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /api/v2/feedback/stats:
    get:
      operationId: getFeedbackStats
      summary: Get feedback stats
      description: 'Aggregated relevance-feedback totals for the workspace: how many mentions were marked `RELEVANT` vs `NOT_RELEVANT`, and the resulting false-positive rate. Pass `keywordId` to narrow the stats to a single keyword.'
      tags:
      - Feedback
      x-required-scope: read
      security:
      - ApiKey:
        - read
      parameters:
      - in: query
        name: keywordId
        schema:
          description: Narrow stats to one keyword. Omit for org-wide totals.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        description: Narrow stats to one keyword. Omit for org-wide totals.
      responses:
        '200':
          description: 200 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeedbackStats'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid authentication
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden (insufficient plan or permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitFeedbackRequest:
      description: Submit or upsert a relevance feedback record for a mention.
      type: object
      properties:
        sourceId:
          description: Mention's `sourceId` (e.g. `reddit_t3_1abc234`).
          example: reddit_t3_1abc234
          type: string
        timestamp:
          description: Mention's timestamp, copied verbatim from the list/export response. Tinybird-style format (`YYYY-MM-DD HH:mm:ss.SSS`, UTC, no `Z` suffix); ISO 8601 also accepted. Required to uniquely key the feedback row.
          example: '2026-05-06 13:35:37.000'
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$
        postId:
          description: Optional internal post id for extra joinability.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        keywordId:
          description: ID of the keyword the mention matched (from `Keyword.id`).
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        source:
          description: Platform source (e.g. `reddit`, `twitter`).
          example: reddit
          type: string
          minLength: 1
          maxLength: 64
        feedbackType:
          $ref: '#/components/schemas/FeedbackType'
        feedbackReason:
          description: Optional free-text reason shown to the relevance agent as extra context.
          type: string
          maxLength: 4000
        feedbackSource:
          default: API
          $ref: '#/components/schemas/FeedbackSource'
        originalRelevanceScore:
          description: What the AI originally scored the mention (0=high, 1=medium, 2=low). Captured for analytics.
          type: number
      required:
      - sourceId
      - timestamp
      - keywordId
      - source
      - feedbackType
    RemoveFeedbackResponse:
      description: Confirmation of a feedback removal. `removed` distinguishes a real deletion from a no-op on a mention that had no stored feedback.
      type: object
      properties:
        success:
          type: boolean
          const: true
        removed:
          description: '`true` when a stored feedback record was deleted; `false` when no feedback existed for that mention key (the request is a harmless no-op either way).'
          type: boolean
      required:
      - success
      - removed
      additionalProperties: false
    FeedbackRecord:
      description: A persisted feedback record.
      type: object
      properties:
        id:
          description: Feedback record id.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        sourceId:
          description: Mention key.
          type: string
        timestamp:
          description: Mention timestamp, echoed back as submitted (Tinybird-style `YYYY-MM-DD HH:mm:ss.SSS` or ISO 8601).
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$
        organizationId:
          description: Workspace id that owns this record.
          type: string
        postId:
          description: Linked internal post id, when known.
          anyOf:
          - type: integer
            minimum: -9007199254740991
            maximum: 9007199254740991
          - type: 'null'
        keywordId:
          description: Keyword id this feedback is about.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        source:
          description: Platform source.
          type: string
        feedbackType:
          $ref: '#/components/schemas/FeedbackType'
        feedbackReason:
          description: Free-text reason, if provided.
          anyOf:
          - type: string
          - type: 'null'
        feedbackSource:
          $ref: '#/components/schemas/FeedbackSource'
        originalRelevanceScore:
          anyOf:
          - type: number
          - type: 'null'
        createdBy:
          description: User id of the submitter, if known.
          anyOf:
          - type: string
          - type: 'null'
        createdAt:
          type: string
          format: date-time
          pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
      required:
      - id
      - sourceId
      - timestamp
      - organizationId
      - postId
      - keywordId
      - source
      - feedbackType
      - feedbackReason
      - feedbackSource
      - originalRelevanceScore
      - createdBy
      - createdAt
      additionalProperties: false
    ApiErrorCode:
      description: 'Stable, machine-readable error code. Grouped as follows:


        **Auth / request shape** — `UNAUTHORIZED` (401), `FORBIDDEN` (403), `RATE_LIMITED` (429), `VALIDATION_ERROR` (400 — response carries a `details` array with Zod issues), `INTERNAL_ERROR` (500).


        **Agency master-key org selection** — `ORGANIZATION_REQUIRED` (400 — an agency master key must pass the `x-octolens-organization-id` header to select a target workspace), `FORBIDDEN_ORGANIZATION` (403 — the requested organization does not belong to the key''s agency).


        **Plan / quota walls** — `UPGRADE_REQUIRED` (403 — an Agents-plan wall: a cap was hit (the lifetime search allowance or the monthly mention quota), or the endpoint is not part of the Agents plan at all — on that plan only search, org/usage/auth introspection, the upgrade link and monitoring recommendations are available, and every other endpoint answers this code before validating input; the envelope carries two ADDITIVE fields alongside the standard three, `upgradeUrl` (the upgrade page) and `upgradeCommand` (`octolens upgrade`, which mints a single-use authenticated link into that page), so an agent gets an actionable next step, not just prose), `QUOTA_EXCEEDED` (402 — the monthly mention quota is exhausted on a non-Agents plan; enable flex pricing or upgrade). The search routes also send `X-Octolens-Searches-Remaining` / `X-Octolens-Mentions-Remaining` response headers on success so clients can self-throttle before either wall.


        **Manual workspace review** — `WORKSPACE_PENDING_REVIEW` (403 — the workspace is waiting for a review by the Octolens team; every endpoint except `GET /api/v2/auth` answers this code until it is approved, and the very next request after approval succeeds; retry later).


        **Not found (404)** — generic `NOT_FOUND` plus domain-specific variants: `FEED_NOT_FOUND`, `KEYWORD_NOT_FOUND`, `KEYWORDS_NOT_FOUND`, `POST_NOT_FOUND`, `MENTION_NOT_FOUND`, `SUMMARY_NOT_FOUND`, `SEARCH_NOT_FOUND`, `SUGGESTION_NOT_FOUND`, `COMPANY_NOT_FOUND`, `ORG_NOT_FOUND`, `SETTINGS_NOT_FOUND`, `NOTIFICATION_NOT_FOUND`, `VIEW_NOT_FOUND`, `ALERT_NOT_FOUND`, `ATTENTION_ITEM_NOT_FOUND`. A resource id that exists but belongs to another workspace answers the SAME not-found as an unused id — existence is never leaked across tenants. `FEATURE_DISABLED` (404) — the endpoint is behind a feature flag (beta) that is off for this workspace.


        **Authorization (403)** — generic `FORBIDDEN` (the caller is not permitted to perform the operation, e.g. insufficient API-key scope). There are deliberately NO per-resource 403 codes: cross-workspace access reads as the resource''s 404. `WEB_SOURCE_UNAVAILABLE`, `INSTAGRAM_SOURCE_UNAVAILABLE`, `FACEBOOK_SOURCE_UNAVAILABLE`, `DISCORD_SOURCE_UNAVAILABLE`, `THREADS_SOURCE_UNAVAILABLE` (403) — a keyword or workspace `platforms` write newly enables a source that is still rolling out and not available to this workspace; drop that platform and retry.


        **Discord servers and watch monitors (`/integrations/discord/*`)** — `DISCORD_SOURCE_UNAVAILABLE` (403) also answers every write there while Discord is not enabled for the workspace (a disconnect excepted), `DISCORD_ADMIN_ONLY` (403 — the caller is not an admin: a member, or a key without the `admin` scope; also answered by `PATCH` / `DELETE /keywords/{id}`, `POST /keywords/{id}/pause` and author excludes on a whole-server Discord keyword), `DISCORD_LINK_NOT_FOUND` / `DISCORD_MONITOR_NOT_FOUND` (404), `DISCORD_CHANNEL_INVALID` (400 — a channel id is not a readable channel of the server, or is outside its channel scope; the envelope adds `invalidChannelIds`), `DISCORD_MONITOR_KEYWORD_OWNED` (409 — the monitor is a whole-server keyword''s binding; delete the keyword instead), `DISCORD_LINK_BUSY` / `DISCORD_MONITOR_BUSY` (409 — it kept changing concurrently; retry).


        **Business-rule violations (400)** — `INVALID_INPUT` (semantically invalid arguments), `KEYWORD_LIMIT_EXCEEDED` (plan cap hit), `KEYWORD_SOURCE_MANAGED` (a whole-server Discord keyword''s platforms, terms and exclusions cannot change), `KEYWORD_OPERATOR_SYNTAX` (the keyword carries search-operator syntax — quotes, a leading `+`, a `-term`, `AND`/`OR`, a mid-string `*` — which is matched literally and would never hit; the envelope adds `suggestion`, the stripped string to track instead, plus `alternatives` and `excludeWords`), `LAST_ADMIN` (refuses to remove the only admin), `ITEM_EXISTS` (duplicate), `INVALID_DOMAIN`, `INVALID_TIMEZONE`, `SLACK_NOT_CONNECTED` / `SLACK_CHANNEL_NOT_FOUND` / `SLACK_CHANNEL_REQUIRED` (Slack destination validation), `WEBHOOK_URL_INVALID` (webhook URL rejected), `NO_DESTINATIONS` / `NO_SAMPLE_MENTION` (notification test delivery preconditions), `INVALID_DESTINATION` (a destination is missing/mismatched its type-specific sub-object, or two share a type) / `DESTINATION_INDEX_OUT_OF_RANGE` (feed destination index), `FILTER_LIMIT_EXCEEDED` (the effective mention query has more than 50 caller-authored conditions), `FILTER_CONDITION_LIMIT_EXCEEDED` (a saved feed would have more than 50 conditions across both filter sides), `ENGAGEMENT_METRICS_DISABLED` (engagement filtering is unavailable in this deployment), and `ATTENTION_ACTION_NOT_APPLY` (the attention item''s action is not an `apply`).


        **Conflict (409)** — `FEED_FILTER_WRITE_CONFLICT` means another writer changed the saved feed after it was read; fetch the latest feed and retry the filter update. `SETUP_DECISION_PENDING` means the onboarding mentions step is still removing the noise; step 3 removes it automatically, so try again in a few seconds.


        **Onboarding (`/api/v2/onboarding/*`)** — `MENTIONS_PREVIEW_NOT_READY` (400, poll), `MENTIONS_NOT_VIEWED` (409), `KEYWORDS_STEP_INVALID` (400), `ONBOARDING_STEP_NOT_CURRENT` (409), `ONBOARDING_REVISION_CHANGED` (409), `ONBOARDING_IN_PROGRESS` (409, retry in 5 s), `SETUP_DRAFT_NOT_FOUND` (404), `PAYWALL` / `SANDBOX_WORKSPACE` / `SECOND_FREE_TRIAL_FORBIDDEN` (403, with `upgradeUrl`), `AUTH_LOOKUP_UNAVAILABLE` (503, retry), `FEED_NOT_ONBOARDING` (400 — a Slack route for a feed the setup did not make) and `NOT_IMPLEMENTED` (501 — the route is not live yet).


        **Operation failures (500)** — `ENGAGE_FAILED` / `RELEVANCE_UPDATE_FAILED` carry a specific code so clients can distinguish a failed mutation from a generic `INTERNAL_ERROR`.'
      type: string
      enum:
      - UNAUTHORIZED
      - FORBIDDEN
      - RATE_LIMITED
      - VALIDATION_ERROR
      - INTERNAL_ERROR
      - MEMBER_REQUIRED
      - BRIEF_DISABLED
      - INVALID_BRIEF_LINK
      - PREFERENCE_CHANGED
      - BRIEF_NOT_FOUND
      - INVALID_BRIEF_WINDOW
      - INVALID_RECIPIENT_COUNT
      - ORGANIZATION_REQUIRED
      - FORBIDDEN_ORGANIZATION
      - MASTER_KEY_REQUIRED
      - AGENCY_INACTIVE
      - NOT_AN_AGENCY_WORKSPACE
      - AGENCY_NOT_FOUND
      - WORKSPACE_NOT_IN_AGENCY
      - ANCHOR_WORKSPACE
      - AGENCY_WORKSPACE_LIMIT
      - INVITE_FANOUT_TOO_LARGE
      - SUPERADMIN_REMOVE_FORBIDDEN
      - USER_REQUIRED
      - FLEX_REQUIRES_CAP
      - FLEX_REQUIRES_BUDGET
      - AGENCY_BILLING_NOT_CONFIGURED
      - WORKSPACE_CREATE_FAILED
      - WORKSPACE_SETUP_FAILED
      - WORKSPACE_ACCESS_FAILED
      - UPGRADE_REQUIRED
      - QUOTA_EXCEEDED
      - WORKSPACE_PENDING_REVIEW
      - SETUP_DECISION_PENDING
      - MENTIONS_PREVIEW_NOT_READY
      - MENTIONS_NOT_VIEWED
      - KEYWORDS_STEP_INVALID
      - ONBOARDING_STEP_NOT_CURRENT
      - ONBOARDING_REVISION_CHANGED
      - ONBOARDING_IN_PROGRESS
      - SETUP_DRAFT_NOT_FOUND
      - PAYWALL
      - SANDBOX_WORKSPACE
      - SECOND_FREE_TRIAL_FORBIDDEN
      - AUTH_LOOKUP_UNAVAILABLE
      - NOT_IMPLEMENTED
      - FEED_NOT_ONBOARDING
      - NOT_FOUND
      - FEED_NOT_FOUND
      - KEYWORD_NOT_FOUND
      - KEYWORDS_NOT_FOUND
      - POST_NOT_FOUND
      - MENTION_NOT_FOUND
      - SUMMARY_NOT_FOUND
      - SEARCH_NOT_FOUND
      - SUGGESTION_NOT_FOUND
      - COMPANY_NOT_FOUND
      - ORG_NOT_FOUND
      - SETTINGS_NOT_FOUND
      - NOTIFICATION_NOT_FOUND
      - VIEW_NOT_FOUND
      - ALERT_NOT_FOUND
      - ATTENTION_ITEM_NOT_FOUND
      - FEATURE_DISABLED
      - MENTION_KEYWORD_UNKNOWN
      - EXPORT_LINK_UNAVAILABLE
      - INVALID_INPUT
      - KEYWORD_LIMIT_EXCEEDED
      - KEYWORD_SOURCE_MANAGED
      - KEYWORD_OPERATOR_SYNTAX
      - LAST_ADMIN
      - ITEM_EXISTS
      - INVALID_DOMAIN
      - INVALID_TIMEZONE
      - SLACK_NOT_CONNECTED
      - SLACK_CHANNEL_NOT_FOUND
      - SLACK_CHANNEL_REQUIRED
      - WEBHOOK_URL_INVALID
      - NO_DESTINATIONS
      - NO_SAMPLE_MENTION
      - INVALID_DESTINATION
      - DESTINATION_INDEX_OUT_OF_RANGE
      - FILTER_LIMIT_EXCEEDED
      - FILTER_CONDITION_LIMIT_EXCEEDED
      - ENGAGEMENT_METRICS_DISABLED
      - ATTENTION_ACTION_NOT_APPLY
      - WEB_SOURCE_UNAVAILABLE
      - INSTAGRAM_SOURCE_UNAVAILABLE
      - FACEBOOK_SOURCE_UNAVAILABLE
      - DISCORD_SOURCE_UNAVAILABLE
      - THREADS_SOURCE_UNAVAILABLE
      - DISCORD_ADMIN_ONLY
      - DISCORD_LINK_NOT_FOUND
      - DISCORD_MONITOR_NOT_FOUND
      - DISCORD_CHANNEL_INVALID
      - DISCORD_MONITOR_KEYWORD_OWNED
      - DISCORD_LINK_BUSY
      - DISCORD_MONITOR_BUSY
      - FEED_FILTER_WRITE_CONFLICT
      - ENGAGE_FAILED
      - RELEVANCE_UPDATE_FAILED
    RemoveFeedbackRequest:
      description: Remove an existing feedback record by mention key.
      type: object
      properties:
        sourceId:
          description: Mention's `sourceId`.
          type: string
        timestamp:
          description: Mention's timestamp — composite key with `sourceId`. Pass the value as returned by the list endpoint (Tinybird-style `YYYY-MM-DD HH:mm:ss.SSS`); ISO 8601 also accepted.
          example: '2026-05-06 13:35:37.000'
          type: string
          pattern: ^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$
      required:
      - sourceId
      - timestamp
    FeedbackType:
      description: The user's verdict on the mention. `RELEVANT` = the mention matters, `NOT_RELEVANT` = it's noise.
      type: string
      enum:
      - RELEVANT
      - NOT_RELEVANT
    ErrorResponse:
      description: Standard error envelope returned for all non-2xx responses. The `code` field is stable — safe to branch on programmatically. `code`, `message` and `status` are always present; anything else is additive and per-code (`details` on `VALIDATION_ERROR`, `upgradeUrl`/`upgradeCommand` on `UPGRADE_REQUIRED`).
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              description: Machine-readable error code. See `ApiErrorCode` for the full list.
              example: NOT_FOUND
              $ref: '#/components/schemas/ApiErrorCode'
            message:
              description: Human-readable error message.
              example: Resource not found
              type: string
            status:
              description: HTTP status code — always matches the response status.
              example: 404
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            details:
              description: Present on `VALIDATION_ERROR` responses. Contains Zod issues describing each failing field (path, code, message).
              type: array
              items: {}
            upgradeUrl:
              description: 'Present on `UPGRADE_REQUIRED` responses (additive — see `ApiErrorCode`): the URL of the upgrade page for this workspace.'
              example: https://app.octolens.com/me/upgrade?src=agents
              type: string
            upgradeCommand:
              description: 'Present on `UPGRADE_REQUIRED` responses (additive): the CLI command that mints a single-use, already-authenticated link into the upgrade page.'
              example: octolens upgrade
              type: string
          required:
          - code
          - message
          - status
          additionalProperties: false
      required:
      - error
      additionalProperties: false
    FeedbackSource:
      description: Where the feedback came from. `WEB` = app UI, `SLACK` = Slack notification buttons, `API` = programmatic (REST v2). Must match the `FeedbackSource` enum in the database.
      example: API
      type: string
      enum:
      - WEB
      - SLACK
      - API
    FeedbackStats:
      type: object
      properties:
        totalFeedback:
          description: Total feedback records.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        relevantCount:
          description: Records marked `RELEVANT`.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        notRelevantCount:
          description: Records marked `NOT_RELEVANT`.
          type: integer
          minimum: -9007199254740991
          maximum: 9007199254740991
        falsePositiveRate:
          description: Fraction (0–1) of all feedback records marked `NOT_RELEVANT` (`notRelevantCount / totalFeedback`). Higher = AI over-reports. `0` when the org has no feedback.
          type: number
      required:
      - totalFeedback
      - relevantCount
      - notRelevantCount
      - falsePositiveRate
      additionalProperties: false
  securitySchemes:
    ClerkSession:
      type: apiKey
      in: cookie
      name: __session
      description: Verified Clerk member session in the active workspace. Internal UI endpoints only; writes require a trusted browser Origin header.
    ApiKey:
      type: http
      scheme: bearer
      description: 'Clerk API key. Create one in Settings → API Keys. Pass as `Authorization: Bearer <key>`. Keys carry a scope — `read`, `write` (implies read) or `admin` (implies write) — chosen when the key is minted. Each operation''s `security` requirement (and its `x-required-scope` extension) names the minimum scope it needs; request the least-privileged key that covers the operations you call.'
      x-key-scopes:
        read: 'Read-only access: list/query mentions, keywords, feeds, analytics, org metadata.'
        write: 'Read plus mutations: create/update/delete keywords, feeds, tags, filters, notifications. Implies `read`.'
        admin: 'Write plus org administration: member management, invitations, agency workspaces. Implies `write`.'