{
  "openapi": "3.1.0",
  "info": {
    "title": "IntentLoom Worker API",
    "description": "Machine-readable contract of the IntentLoom Worker API. Routes are documented as they migrate onto the shared Zod-driven contract pipeline (request validation, RFC 9457 problem errors, deterministic OpenAPI generation); undocumented routes join in follow-up changes.",
    "version": "1.0.0"
  },
  "x-source-sha256": "c6cad61cb4bf2bbbd0f4b633e2078a8ffac9bfd6543a6756d6bddb4d71a5619d",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "paths": {
    "/api/v1/projects/": {
      "get": {
        "operationId": "listProjects",
        "summary": "List the caller's projects (switcher summary shape).",
        "description": "Owner-scoped project summaries ordered by descending id; the response carries only the summary fields (`results[].id/.name`). Accepts a Clerk bearer token or a personal API token (`Authorization: Token <key>`); both credentials resolve to the same internal owner and no active subscription is required to read.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The caller's projects.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "product_url": {
                            "type": "string"
                          },
                          "meta_title": {
                            "type": "string"
                          },
                          "meta_description": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "product_url",
                          "meta_title",
                          "meta_description",
                          "description",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    }
                  },
                  "required": [
                    "results"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/projects/{id}/": {
      "get": {
        "operationId": "getProject",
        "summary": "Read one of the caller's projects (detail serializer).",
        "description": "Owner-scoped read with keyword rules, competitor rules, and the effective lead prompt resolution. Keyword rules (project and competitor) expose their stable MEMBERSHIP UUIDs as `id` — the addressing ids of the item maintenance APIs; the legacy read-only `keywords` string projection is preserved. Foreign or unknown ids render the non-leaking not-found problem. Accepts a Clerk bearer token or a personal API token; reads require no active subscription.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The project detail payload.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "product_url": {
                      "type": "string"
                    },
                    "meta_title": {
                      "type": "string"
                    },
                    "meta_description": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "lead_custom_prompt": {
                      "type": "string"
                    },
                    "lead_custom_prompt_effective": {
                      "type": "string"
                    },
                    "lead_custom_prompt_source": {
                      "type": "string"
                    },
                    "keywords": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "keyword_rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "target": {
                            "type": "string"
                          },
                          "match_type": {
                            "type": "string"
                          },
                          "enabled": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "value",
                          "target",
                          "match_type",
                          "enabled"
                        ]
                      }
                    },
                    "competitors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "website": {
                            "type": "string"
                          },
                          "keyword_rules": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                },
                                "target": {
                                  "type": "string"
                                },
                                "match_type": {
                                  "type": "string"
                                },
                                "enabled": {
                                  "type": [
                                    "boolean",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "value",
                                "target",
                                "match_type",
                                "enabled"
                              ]
                            }
                          }
                        },
                        "required": [
                          "id",
                          "website",
                          "keyword_rules"
                        ]
                      }
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "product_url",
                    "meta_title",
                    "meta_description",
                    "description",
                    "lead_custom_prompt",
                    "lead_custom_prompt_effective",
                    "lead_custom_prompt_source",
                    "keywords",
                    "keyword_rules",
                    "competitors",
                    "created_at",
                    "updated_at"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "id",
            "required": true
          }
        ]
      }
    },
    "/api/v1/projects/{projectId}/keywords/": {
      "get": {
        "operationId": "listProjectKeywords",
        "summary": "List the project's keyword memberships (stable ids).",
        "description": "Owner-scoped, unpaginated `{results: [...]}` envelope ordered by descending membership id. Each row carries the stable membership UUID (`id`), normalized `value`, `target`, `match_type`, and the read-only provider-observed `enabled` state. Accepts a Clerk bearer token or a personal API token; both credentials resolve to the same internal owner. Reads require no active subscription.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The project's keyword memberships.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable membership UUID (never the shared canonical keyword id)."
                          },
                          "value": {
                            "type": "string",
                            "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                          },
                          "target": {
                            "type": "string",
                            "enum": [
                              "post",
                              "comment",
                              "post_comment"
                            ],
                            "description": "Matching surface for this membership."
                          },
                          "match_type": {
                            "type": "string",
                            "enum": [
                              "all_words",
                              "exact"
                            ],
                            "description": "Matching mode for this membership."
                          },
                          "enabled": {
                            "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                            "type": [
                              "boolean",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "value",
                          "target",
                          "match_type",
                          "enabled"
                        ]
                      }
                    }
                  },
                  "required": [
                    "results"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "createProjectKeyword",
        "summary": "Add one project keyword membership.",
        "description": "Creates exactly one membership. `value` is required (nonblank, max 200, trimmed/lowercased/whitespace-collapsed); `target` defaults to `post`, `match_type` to `all_words` (JSON null means the default). A duplicate identity or a same-collection target overlap (same value+match_type with post/comment/post_comment overlap) answers 409 CONFLICT with no mutation — retrying a timed-out create must list and reconcile first (no POST replay idempotence). Writes share the website's business gates: 403 NO_ACTIVE_PLAN when billing enforcement requires an active plan, and the plan-limit problems with quota data when the shared tracked-keyword stock would exceed its cap.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "201": {
            "description": "The created membership (stable id assigned by the server).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable membership UUID (never the shared canonical keyword id)."
                    },
                    "value": {
                      "type": "string",
                      "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                    },
                    "target": {
                      "type": "string",
                      "enum": [
                        "post",
                        "comment",
                        "post_comment"
                      ],
                      "description": "Matching surface for this membership."
                    },
                    "match_type": {
                      "type": "string",
                      "enum": [
                        "all_words",
                        "exact"
                      ],
                      "description": "Matching mode for this membership."
                    },
                    "enabled": {
                      "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "value",
                    "target",
                    "match_type",
                    "enabled"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for the request body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Business denial shared with the website (NO_ACTIVE_PLAN or a plan-limit problem with quota data).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The requested keyword identity duplicates or overlaps an existing membership in the same collection.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "description": "Keyword phrase (1-200 chars after trim; lowercased, internal whitespace collapsed).",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "target": {
                    "description": "Matching surface; defaults to post. null means the default.",
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "post",
                          "comment",
                          "post_comment"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "match_type": {
                    "description": "Matching mode; defaults to all_words. null means the default.",
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "all_words",
                          "exact"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          }
        ]
      }
    },
    "/api/v1/projects/{projectId}/keywords/{keywordId}/": {
      "get": {
        "operationId": "getProjectKeyword",
        "summary": "Read one project keyword membership by stable id.",
        "description": "`keywordId` is the membership UUID. Foreign, unknown, or misnested ids answer the standard non-disclosing 404. Reads require no active subscription.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The membership.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable membership UUID (never the shared canonical keyword id)."
                    },
                    "value": {
                      "type": "string",
                      "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                    },
                    "target": {
                      "type": "string",
                      "enum": [
                        "post",
                        "comment",
                        "post_comment"
                      ],
                      "description": "Matching surface for this membership."
                    },
                    "match_type": {
                      "type": "string",
                      "enum": [
                        "all_words",
                        "exact"
                      ],
                      "description": "Matching mode for this membership."
                    },
                    "enabled": {
                      "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "value",
                    "target",
                    "match_type",
                    "enabled"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "keywordId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateProjectKeyword",
        "summary": "Repoint one project keyword membership.",
        "description": "Any nonempty subset of `value`/`target`/`match_type`; omitted fields stay unchanged (defaults apply only to POST) and the membership id never changes — the row is repointed to the ensured immutable canonical rule in one atomic batch. null values, unknown keys, and the read-only `enabled` are rejected (400). An unchanged identity is a 200 no-op. A duplicate/overlap collision answers 409 with no mutation. Writes share the website's business gates (403 NO_ACTIVE_PLAN / plan-limit quota problems); a stock-neutral repoint succeeds even at the cap.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The updated membership (same id).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable membership UUID (never the shared canonical keyword id)."
                    },
                    "value": {
                      "type": "string",
                      "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                    },
                    "target": {
                      "type": "string",
                      "enum": [
                        "post",
                        "comment",
                        "post_comment"
                      ],
                      "description": "Matching surface for this membership."
                    },
                    "match_type": {
                      "type": "string",
                      "enum": [
                        "all_words",
                        "exact"
                      ],
                      "description": "Matching mode for this membership."
                    },
                    "enabled": {
                      "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "value",
                    "target",
                    "match_type",
                    "enabled"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for the request body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Business denial shared with the website (NO_ACTIVE_PLAN or a plan-limit problem with quota data).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The requested keyword identity duplicates or overlaps an existing membership in the same collection.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "target": {
                    "type": "string",
                    "enum": [
                      "post",
                      "comment",
                      "post_comment"
                    ]
                  },
                  "match_type": {
                    "type": "string",
                    "enum": [
                      "all_words",
                      "exact"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "keywordId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteProjectKeyword",
        "summary": "Unlink one project keyword membership.",
        "description": "Removes exactly the addressed membership (204, no body); the shared canonical keyword row is never deleted and no other owner's membership changes. Repeating the delete answers the standard non-disclosing 404. Writes share the website's business gates (403 NO_ACTIVE_PLAN / plan-limit quota problems).",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "204": {
            "description": "The membership was unlinked."
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Business denial shared with the website (NO_ACTIVE_PLAN or a plan-limit problem with quota data).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "keywordId",
            "required": true
          }
        ]
      }
    },
    "/api/v1/projects/{projectId}/competitors/": {
      "get": {
        "operationId": "listProjectCompetitors",
        "summary": "List the project's competitors (stable ids).",
        "description": "Owner-scoped, unpaginated `{results: [...]}` envelope ordered by descending competitor id. Each row carries the competitor UUID, website, and its `keyword_rules` with stable membership ids. Accepts a Clerk bearer token or a personal API token; reads require no active subscription.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The project's competitors.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable competitor UUID."
                          },
                          "website": {
                            "type": "string",
                            "description": "Normalized competitor website (absolute http(s) URL, trimmed)."
                          },
                          "keyword_rules": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "description": "Stable membership UUID (never the shared canonical keyword id)."
                                },
                                "value": {
                                  "type": "string",
                                  "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                                },
                                "target": {
                                  "type": "string",
                                  "enum": [
                                    "post",
                                    "comment",
                                    "post_comment"
                                  ],
                                  "description": "Matching surface for this membership."
                                },
                                "match_type": {
                                  "type": "string",
                                  "enum": [
                                    "all_words",
                                    "exact"
                                  ],
                                  "description": "Matching mode for this membership."
                                },
                                "enabled": {
                                  "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                                  "type": [
                                    "boolean",
                                    "null"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "value",
                                "target",
                                "match_type",
                                "enabled"
                              ]
                            }
                          }
                        },
                        "required": [
                          "id",
                          "website",
                          "keyword_rules"
                        ]
                      }
                    }
                  },
                  "required": [
                    "results"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project, competitor, or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "createProjectCompetitor",
        "summary": "Add one competitor (with its derived default keyword).",
        "description": "Requires `website` (absolute http(s) URL, max 200, project-unique). The server allocates the competitor id and atomically seeds its derived default post_comment/all_words keyword membership (returned with its stable id); a failed derivation, a website collision, a default-rule collision, or any quota denial leaves NO competitor and NO membership (whole-batch rollback). Additional custom rules use the child keyword API. Writes share the website's business gates (403 NO_ACTIVE_PLAN / plan-limit quota problems for tracked competitors, tracked keywords, and the per-competitor keyword cap).",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "201": {
            "description": "The created competitor with its seeded default rule.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable competitor UUID."
                    },
                    "website": {
                      "type": "string",
                      "description": "Normalized competitor website (absolute http(s) URL, trimmed)."
                    },
                    "keyword_rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable membership UUID (never the shared canonical keyword id)."
                          },
                          "value": {
                            "type": "string",
                            "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                          },
                          "target": {
                            "type": "string",
                            "enum": [
                              "post",
                              "comment",
                              "post_comment"
                            ],
                            "description": "Matching surface for this membership."
                          },
                          "match_type": {
                            "type": "string",
                            "enum": [
                              "all_words",
                              "exact"
                            ],
                            "description": "Matching mode for this membership."
                          },
                          "enabled": {
                            "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                            "type": [
                              "boolean",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "value",
                          "target",
                          "match_type",
                          "enabled"
                        ]
                      }
                    }
                  },
                  "required": [
                    "id",
                    "website",
                    "keyword_rules"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for the request body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Business denial shared with the website (NO_ACTIVE_PLAN or a plan-limit problem with quota data).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project, competitor, or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Competitor website collision, duplicate/overlapping keyword identity, or a canonical rule already owned by another competitor in this project.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "website": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200,
                    "description": "Absolute http(s) competitor URL (1-200 chars after trim; project-unique)."
                  }
                },
                "required": [
                  "website"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          }
        ]
      }
    },
    "/api/v1/projects/{projectId}/competitors/{competitorId}/": {
      "get": {
        "operationId": "getProjectCompetitor",
        "summary": "Read one competitor by stable id.",
        "description": "Foreign, unknown, or misnested ids answer the standard non-disclosing 404. A competitor whose last keyword was deleted remains empty (no implicit reseeding). Reads require no active subscription.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The competitor with its keyword memberships.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable competitor UUID."
                    },
                    "website": {
                      "type": "string",
                      "description": "Normalized competitor website (absolute http(s) URL, trimmed)."
                    },
                    "keyword_rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable membership UUID (never the shared canonical keyword id)."
                          },
                          "value": {
                            "type": "string",
                            "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                          },
                          "target": {
                            "type": "string",
                            "enum": [
                              "post",
                              "comment",
                              "post_comment"
                            ],
                            "description": "Matching surface for this membership."
                          },
                          "match_type": {
                            "type": "string",
                            "enum": [
                              "all_words",
                              "exact"
                            ],
                            "description": "Matching mode for this membership."
                          },
                          "enabled": {
                            "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                            "type": [
                              "boolean",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "value",
                          "target",
                          "match_type",
                          "enabled"
                        ]
                      }
                    }
                  },
                  "required": [
                    "id",
                    "website",
                    "keyword_rules"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project, competitor, or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "competitorId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateProjectCompetitor",
        "summary": "Rename one competitor (website-only).",
        "description": "Accepts ONLY `website` (absolute http(s) URL, max 200, project-unique); keywords are neither regenerated nor replaced — an unchanged website is a 200 no-op and a collision answers 409. Collection replacement fields are not accepted (400 unknown-key rejection). Writes share the website's business gates.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The renamed competitor (same id, unchanged keywords).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable competitor UUID."
                    },
                    "website": {
                      "type": "string",
                      "description": "Normalized competitor website (absolute http(s) URL, trimmed)."
                    },
                    "keyword_rules": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable membership UUID (never the shared canonical keyword id)."
                          },
                          "value": {
                            "type": "string",
                            "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                          },
                          "target": {
                            "type": "string",
                            "enum": [
                              "post",
                              "comment",
                              "post_comment"
                            ],
                            "description": "Matching surface for this membership."
                          },
                          "match_type": {
                            "type": "string",
                            "enum": [
                              "all_words",
                              "exact"
                            ],
                            "description": "Matching mode for this membership."
                          },
                          "enabled": {
                            "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                            "type": [
                              "boolean",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "value",
                          "target",
                          "match_type",
                          "enabled"
                        ]
                      }
                    }
                  },
                  "required": [
                    "id",
                    "website",
                    "keyword_rules"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for the request body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Business denial shared with the website (NO_ACTIVE_PLAN or a plan-limit problem with quota data).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project, competitor, or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Competitor website collision, duplicate/overlapping keyword identity, or a canonical rule already owned by another competitor in this project.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "website": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "website"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "competitorId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteProjectCompetitor",
        "summary": "Delete one competitor and its keyword memberships.",
        "description": "Removes the competitor and cascades its keyword memberships in one atomic batch (204, no body); repeated deletes answer the standard non-disclosing 404. Writes share the website's business gates.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "204": {
            "description": "The competitor and its memberships were removed."
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Business denial shared with the website (NO_ACTIVE_PLAN or a plan-limit problem with quota data).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project, competitor, or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "competitorId",
            "required": true
          }
        ]
      }
    },
    "/api/v1/projects/{projectId}/competitors/{competitorId}/keywords/": {
      "get": {
        "operationId": "listCompetitorKeywords",
        "summary": "List one competitor's keyword memberships (stable ids).",
        "description": "Owner-scoped, unpaginated `{results: [...]}` envelope ordered by descending membership id, nested under the verified user -> project -> competitor hierarchy (a foreign or misnested competitor id answers the non-disclosing 404). Reads require no active subscription.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The competitor's keyword memberships.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable membership UUID (never the shared canonical keyword id)."
                          },
                          "value": {
                            "type": "string",
                            "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                          },
                          "target": {
                            "type": "string",
                            "enum": [
                              "post",
                              "comment",
                              "post_comment"
                            ],
                            "description": "Matching surface for this membership."
                          },
                          "match_type": {
                            "type": "string",
                            "enum": [
                              "all_words",
                              "exact"
                            ],
                            "description": "Matching mode for this membership."
                          },
                          "enabled": {
                            "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                            "type": [
                              "boolean",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "value",
                          "target",
                          "match_type",
                          "enabled"
                        ]
                      }
                    }
                  },
                  "required": [
                    "results"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project, competitor, or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "competitorId",
            "required": true
          }
        ]
      },
      "post": {
        "operationId": "createCompetitorKeyword",
        "summary": "Add one keyword membership to a competitor.",
        "description": "Creates exactly one child membership under the verified hierarchy. `value` is required; `target` defaults to `post` and `match_type` to `all_words`. The same canonical rule cannot be owned by two competitors in one project (409), and duplicate or overlapping identities within the competitor answer 409 with no mutation. Writes share the website's business gates (403 NO_ACTIVE_PLAN / plan-limit quota problems including the per-competitor keyword cap).",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "201": {
            "description": "The created membership (stable id assigned by the server).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable membership UUID (never the shared canonical keyword id)."
                    },
                    "value": {
                      "type": "string",
                      "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                    },
                    "target": {
                      "type": "string",
                      "enum": [
                        "post",
                        "comment",
                        "post_comment"
                      ],
                      "description": "Matching surface for this membership."
                    },
                    "match_type": {
                      "type": "string",
                      "enum": [
                        "all_words",
                        "exact"
                      ],
                      "description": "Matching mode for this membership."
                    },
                    "enabled": {
                      "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "value",
                    "target",
                    "match_type",
                    "enabled"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for the request body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Business denial shared with the website (NO_ACTIVE_PLAN or a plan-limit problem with quota data).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project, competitor, or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Competitor website collision, duplicate/overlapping keyword identity, or a canonical rule already owned by another competitor in this project.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "target": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "post",
                          "comment",
                          "post_comment"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "match_type": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "all_words",
                          "exact"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "value"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "competitorId",
            "required": true
          }
        ]
      }
    },
    "/api/v1/projects/{projectId}/competitors/{competitorId}/keywords/{keywordId}/": {
      "get": {
        "operationId": "getCompetitorKeyword",
        "summary": "Read one competitor keyword membership by stable id.",
        "description": "`keywordId` is the membership UUID and must nest under the addressed competitor (a membership of another competitor answers the standard non-disclosing 404). Reads require no active subscription.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The membership.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable membership UUID (never the shared canonical keyword id)."
                    },
                    "value": {
                      "type": "string",
                      "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                    },
                    "target": {
                      "type": "string",
                      "enum": [
                        "post",
                        "comment",
                        "post_comment"
                      ],
                      "description": "Matching surface for this membership."
                    },
                    "match_type": {
                      "type": "string",
                      "enum": [
                        "all_words",
                        "exact"
                      ],
                      "description": "Matching mode for this membership."
                    },
                    "enabled": {
                      "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "value",
                    "target",
                    "match_type",
                    "enabled"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project, competitor, or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "competitorId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "keywordId",
            "required": true
          }
        ]
      },
      "patch": {
        "operationId": "updateCompetitorKeyword",
        "summary": "Repoint one competitor keyword membership.",
        "description": "Any nonempty subset of `value`/`target`/`match_type`; omitted fields stay unchanged and the membership id never changes. An unchanged identity is a 200 no-op; duplicate/overlap collisions within the competitor and project-wide canonical ownership collisions answer 409 with no mutation. Writes share the website's business gates.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "The updated membership (same id).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "description": "Stable membership UUID (never the shared canonical keyword id)."
                    },
                    "value": {
                      "type": "string",
                      "description": "Normalized keyword value (trimmed, lowercased, whitespace collapsed)."
                    },
                    "target": {
                      "type": "string",
                      "enum": [
                        "post",
                        "comment",
                        "post_comment"
                      ],
                      "description": "Matching surface for this membership."
                    },
                    "match_type": {
                      "type": "string",
                      "enum": [
                        "all_words",
                        "exact"
                      ],
                      "description": "Matching mode for this membership."
                    },
                    "enabled": {
                      "description": "Read-only provider-observed enabled state (null = never observed); never accepted on write.",
                      "type": [
                        "boolean",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "value",
                    "target",
                    "match_type",
                    "enabled"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for the request body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Business denial shared with the website (NO_ACTIVE_PLAN or a plan-limit problem with quota data).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project, competitor, or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Competitor website collision, duplicate/overlapping keyword identity, or a canonical rule already owned by another competitor in this project.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "value": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "target": {
                    "type": "string",
                    "enum": [
                      "post",
                      "comment",
                      "post_comment"
                    ]
                  },
                  "match_type": {
                    "type": "string",
                    "enum": [
                      "all_words",
                      "exact"
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "competitorId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "keywordId",
            "required": true
          }
        ]
      },
      "delete": {
        "operationId": "deleteCompetitorKeyword",
        "summary": "Unlink one competitor keyword membership.",
        "description": "Removes exactly the addressed membership (204, no body); the competitor itself remains (empty until an explicit child POST — no reseeding). Repeating the delete answers the standard non-disclosing 404. Writes share the website's business gates.",
        "tags": [
          "projects"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "204": {
            "description": "The membership was unlinked."
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Business denial shared with the website (NO_ACTIVE_PLAN or a plan-limit problem with quota data).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project, competitor, or keyword membership not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "competitorId",
            "required": true
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "keywordId",
            "required": true
          }
        ]
      }
    },
    "/api/v1/projects/{projectId}/leads/": {
      "get": {
        "operationId": "listProjectLeads",
        "summary": "List a project's post leads (lead or competitor surface).",
        "description": "Owner-scoped cursor-paginated read. `source_type` selects the lead or competitor surface (default lead); `workflow` defaults to new (24h untouched window; accepted: new, saved, replied, all); `min_score` accepts 50/60/70/80; `matched_keyword` repeats as an OR-set (lead surface only); `trigger_competitor` must reference an owned competitor (competitor surface only); `page_size` defaults to 10 (capped at 100; malformed values fall back to the default); invalid cursors answer the non-disclosing 404. Accepts a Clerk bearer token or a personal API token (`Authorization: Token <key>`); both credentials resolve to the same internal owner and no active subscription is required to read.",
        "tags": [
          "leads"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "One cursor-paginated page of leads.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "previous": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "project_id": {
                            "type": "string"
                          },
                          "relevance_score": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "priority": {
                            "type": "string"
                          },
                          "is_saved": {
                            "type": "boolean"
                          },
                          "is_replied": {
                            "type": "boolean"
                          },
                          "match_reason": {
                            "type": "string"
                          },
                          "source_type": {
                            "type": "string"
                          },
                          "trigger_keyword_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "matched_keyword": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          },
                          "reddit_item": {
                            "type": "object",
                            "properties": {
                              "subreddit_name_prefixed": {
                                "type": "string"
                              },
                              "post_fullname": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "body": {
                                "type": "string"
                              },
                              "ai_summary": {
                                "type": "string"
                              },
                              "author": {
                                "type": "string"
                              },
                              "permalink": {
                                "type": "string"
                              },
                              "external_url": {
                                "type": "string"
                              },
                              "created_utc": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "subreddit_name_prefixed",
                              "post_fullname",
                              "title",
                              "body",
                              "ai_summary",
                              "author",
                              "permalink",
                              "external_url",
                              "created_utc"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "project_id",
                          "relevance_score",
                          "priority",
                          "is_saved",
                          "is_replied",
                          "match_reason",
                          "source_type",
                          "trigger_keyword_id",
                          "matched_keyword",
                          "created_at",
                          "updated_at",
                          "reddit_item"
                        ]
                      }
                    }
                  },
                  "required": [
                    "next",
                    "previous",
                    "results"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for the query target.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "source_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "workflow",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "min_score",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "matched_keyword",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          {
            "in": "query",
            "name": "trigger_competitor",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "in": "query",
            "name": "priority",
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          }
        ]
      }
    },
    "/api/v1/projects/{projectId}/comment-leads/": {
      "get": {
        "operationId": "listProjectCommentLeads",
        "summary": "List a project's comment leads (lead or competitor surface).",
        "description": "Owner-scoped cursor-paginated read with the same filter contract as the post-lead list; rows serialize through the comment view (parent post title degrades to empty when the parent row is missing). `source_type` selects lead (default) or competitor. Accepts a Clerk bearer token or a personal API token (`Authorization: Token <key>`); both credentials resolve to the same internal owner and no active subscription is required to read.",
        "tags": [
          "leads"
        ],
        "security": [
          {
            "personalApiToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "One cursor-paginated page of leads.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "next": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "previous": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "project_id": {
                            "type": "string"
                          },
                          "relevance_score": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "priority": {
                            "type": "string"
                          },
                          "is_saved": {
                            "type": "boolean"
                          },
                          "is_replied": {
                            "type": "boolean"
                          },
                          "match_reason": {
                            "type": "string"
                          },
                          "source_type": {
                            "type": "string"
                          },
                          "trigger_keyword_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "matched_keyword": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          },
                          "reddit_comment": {
                            "type": "object",
                            "properties": {
                              "comment_fullname": {
                                "type": "string"
                              },
                              "post_title": {
                                "type": "string"
                              },
                              "subreddit_name_prefixed": {
                                "type": "string"
                              },
                              "author": {
                                "type": "string"
                              },
                              "body": {
                                "type": "string"
                              },
                              "permalink": {
                                "type": "string"
                              },
                              "created_utc": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "comment_fullname",
                              "post_title",
                              "subreddit_name_prefixed",
                              "author",
                              "body",
                              "permalink",
                              "created_utc"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "project_id",
                          "relevance_score",
                          "priority",
                          "is_saved",
                          "is_replied",
                          "match_reason",
                          "source_type",
                          "trigger_keyword_id",
                          "matched_keyword",
                          "created_at",
                          "updated_at",
                          "reddit_comment"
                        ]
                      }
                    }
                  },
                  "required": [
                    "next",
                    "previous",
                    "results"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for the query target.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or rejected Clerk bearer token or personal API token.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Project not found for this caller.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Personal-token usage allowance exhausted (token path; see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected internal failure.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Rate-limit binding unavailable for personal-token verification.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "query",
            "name": "source_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "workflow",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "min_score",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "matched_keyword",
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              ]
            }
          },
          {
            "in": "query",
            "name": "trigger_competitor",
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "in": "query",
            "name": "priority",
            "schema": {
              "type": "string",
              "maxLength": 32
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1024
            }
          },
          {
            "schema": {
              "type": "string"
            },
            "in": "path",
            "name": "projectId",
            "required": true
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "personalApiToken": {
        "type": "http",
        "scheme": "token",
        "description": "Personal API token (issued to accounts with an active paid plan). Send `Authorization: Token <key>`. Accepted ONLY by operations that explicitly declare it as an alternative to the Clerk bearer token; every other protected operation rejects it."
      }
    },
    "schemas": {
      "FieldError": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256
          },
          "code": {
            "type": "string",
            "enum": [
              "INVALID_TYPE",
              "INVALID_FORMAT",
              "INVALID_VALUE",
              "TOO_SMALL",
              "TOO_BIG",
              "UNRECOGNIZED_KEY",
              "INVALID"
            ]
          },
          "message": {
            "type": "string",
            "maxLength": 200
          }
        },
        "required": [
          "field",
          "code"
        ]
      },
      "Problem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "pattern": "^urn:intentloom:problem:[A-Z][A-Z0-9_]*$"
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "code": {
            "type": "string",
            "enum": [
              "VALIDATION_FAILED",
              "UNAUTHORIZED",
              "NOT_FOUND",
              "METHOD_NOT_ALLOWED",
              "INTERNAL_ERROR",
              "FORBIDDEN",
              "NO_ACTIVE_PLAN",
              "PLAN_LIMIT_EXCEEDED",
              "FREE_LIMIT_EXCEEDED",
              "CONFLICT",
              "QUOTA_EXCEEDED",
              "RATE_LIMITED",
              "PROVIDER_UNAVAILABLE",
              "BOT_VERIFICATION_FAILED",
              "ABUSE_PROTECTION_UNAVAILABLE",
              "FREE_TOOLS_ADMISSION_DISABLED"
            ]
          },
          "requestId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 128
          },
          "detail": {
            "type": "string",
            "maxLength": 300
          },
          "errors": {
            "maxItems": 25,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FieldError"
            }
          },
          "quota": {
            "type": "object",
            "properties": {
              "entitlement": {
                "type": "string",
                "minLength": 1,
                "maxLength": 64
              },
              "limit": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "usage": {
                "anyOf": [
                  {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "entitlement",
              "limit",
              "usage"
            ]
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code",
          "requestId"
        ]
      }
    }
  }
}
