{
  "openapi": "3.1.0",
  "info": {
    "title": "Hitfactor Public API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://hitfactorapp.com/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  },
  "paths": {
    "/credits/balance": {
      "get": {
        "operationId": "credits_balance",
        "summary": "Get the credits left for this organization and when each batch expires. Costs 0 credits.",
        "tags": [
          "account"
        ],
        "x-mcp-tool": "credits_balance",
        "x-mode": "sync",
        "x-requires-channel-sync": false,
        "x-credit-cost": 0,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "availableCredits": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "grants": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "creditsRemaining": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "expiresAt": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "creditsRemaining",
                              "expiresAt"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "availableCredits",
                        "grants"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": []
      }
    },
    "/operations/{operationId}": {
      "get": {
        "operationId": "operation_get",
        "summary": "Get the status and result of an async operation. Costs 0 credits.",
        "tags": [
          "account"
        ],
        "x-mcp-tool": "operation_get",
        "x-mode": "sync",
        "x-requires-channel-sync": false,
        "x-credit-cost": 0,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "operationId": {
                          "type": "string"
                        },
                        "toolName": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "queued",
                            "running",
                            "succeeded",
                            "failed",
                            "canceled"
                          ]
                        },
                        "result": {
                          "anyOf": [
                            {},
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "error": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "code": {
                                  "type": "string"
                                },
                                "message": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "code",
                                "message"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "startedAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "completedAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "expiresAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "operationId",
                        "toolName",
                        "status",
                        "result",
                        "error",
                        "createdAt",
                        "startedAt",
                        "completedAt",
                        "expiresAt"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "operationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          }
        ]
      }
    },
    "/research/demand": {
      "post": {
        "operationId": "research_demand",
        "summary": "Query Hitfactor global attention map topic demand across YouTube tech channels, filtered by query, time window (d30, d90, d365), and signal stability (distributed vs fragile). Costs 1 credit.",
        "tags": [
          "research:read"
        ],
        "x-mcp-tool": "research_demand",
        "x-mode": "sync",
        "x-requires-channel-sync": false,
        "x-credit-cost": 1,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "snapshotDate": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "window": {
                          "type": "string",
                          "enum": [
                            "d30",
                            "d90",
                            "d365"
                          ]
                        },
                        "totalTopics": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "topics": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "topicId": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "core",
                                  "adjacent",
                                  "excluded",
                                  "non_tech"
                                ]
                              },
                              "shareOfCore": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "delta": {
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "views": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "stability": {
                                "type": "string",
                                "enum": [
                                  "distributed",
                                  "fragile"
                                ]
                              },
                              "channelCount": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "nicheMatch": {
                                "type": "boolean"
                              },
                              "matchedTerritoryNodes": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "topChannels": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "channelId": {
                                      "type": "string"
                                    },
                                    "title": {
                                      "type": "string"
                                    },
                                    "views": {
                                      "type": "number"
                                    }
                                  },
                                  "required": [
                                    "channelId"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "topicId",
                              "label",
                              "kind",
                              "shareOfCore",
                              "delta",
                              "views",
                              "stability",
                              "channelCount"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "snapshotDate",
                        "window",
                        "totalTopics",
                        "topics"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "window": {
                    "default": "d30",
                    "type": "string",
                    "enum": [
                      "d30",
                      "d90",
                      "d365"
                    ]
                  },
                  "stability": {
                    "default": "all",
                    "type": "string",
                    "enum": [
                      "all",
                      "distributed",
                      "fragile"
                    ]
                  },
                  "limit": {
                    "default": 20,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  },
                  "onlyChannelNiche": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/research/radar": {
      "post": {
        "operationId": "research_radar",
        "summary": "Read the latest cached Hitfactor Tech Radar snapshot of breakout stories across GitHub, Hacker News, Reddit, X, Hugging Face, and RSS with YouTube coverage counts. Never triggers live external API calls. Costs 1 credit.",
        "tags": [
          "research:read"
        ],
        "x-mcp-tool": "research_radar",
        "x-mode": "sync",
        "x-requires-channel-sync": false,
        "x-credit-cost": 1,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "capturedAt": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "storyCount": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "stories": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "title": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string"
                              },
                              "sources": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "attentionScore": {
                                "type": "number"
                              },
                              "youtubeCoverage": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "summary": {
                                "type": "string"
                              },
                              "topics": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "territoryMatch": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "title",
                              "url",
                              "sources",
                              "attentionScore",
                              "youtubeCoverage"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "capturedAt",
                        "storyCount",
                        "stories"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "source": {
                    "default": "all",
                    "type": "string",
                    "enum": [
                      "all",
                      "github",
                      "hn",
                      "reddit",
                      "x",
                      "hf",
                      "rss"
                    ]
                  },
                  "limit": {
                    "default": 20,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 50
                  },
                  "maxYoutubeCoverage": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "onlyOrgTerritory": {
                    "default": false,
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/titles/generate": {
      "post": {
        "operationId": "generate_titles",
        "summary": "Generate and score YouTube title candidates for a concept, conditioned on the connected channel avatars, title-v2-sft, and study-008 structural levers. Costs 4 credits.",
        "tags": [
          "packaging:write"
        ],
        "x-mcp-tool": "generate_titles",
        "x-mode": "sync",
        "x-requires-channel-sync": true,
        "x-credit-cost": 4,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "titles": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "title": {
                                "type": "string"
                              },
                              "angle": {
                                "type": "string"
                              },
                              "rankScore": {
                                "type": "number"
                              },
                              "scores": {
                                "type": "object",
                                "properties": {
                                  "composite": {
                                    "type": "number"
                                  },
                                  "want": {
                                    "type": "number"
                                  },
                                  "avoid": {
                                    "type": "number"
                                  },
                                  "wonder": {
                                    "type": "number"
                                  },
                                  "avatarScore": {
                                    "type": "number"
                                  },
                                  "structurePercentile": {
                                    "type": "number"
                                  }
                                },
                                "required": [
                                  "composite",
                                  "structurePercentile"
                                ],
                                "additionalProperties": false
                              },
                              "levers": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "feature": {
                                      "type": "string"
                                    },
                                    "bloc": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "direction": {
                                      "type": "string",
                                      "enum": [
                                        "add",
                                        "remove"
                                      ]
                                    },
                                    "effectPctPerStep": {
                                      "type": "number"
                                    }
                                  },
                                  "required": [
                                    "feature",
                                    "bloc",
                                    "direction",
                                    "effectPctPerStep"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "title",
                              "angle",
                              "rankScore",
                              "scores",
                              "levers"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "groundingRejected": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "titles",
                        "groundingRejected"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "concept": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "workingTitle": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "targetAudience": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "count": {
                    "default": 8,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 15
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 2000
                  }
                },
                "required": [
                  "concept"
                ]
              }
            }
          }
        }
      }
    },
    "/hooks/generate": {
      "post": {
        "operationId": "generate_hooks",
        "summary": "Generate 30-second-capped, fact-checked spoken YouTube hooks across requested formats using hook-lora-v2 and channel WPM/messaging defaults, with optional reference exemplars. Costs 3 credits.",
        "tags": [
          "hooks:write"
        ],
        "x-mcp-tool": "generate_hooks",
        "x-mode": "sync",
        "x-requires-channel-sync": true,
        "x-credit-cost": 3,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "hooks": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "format": {
                                "type": "string",
                                "enum": [
                                  "reframe-intro",
                                  "four-p",
                                  "if-then"
                                ]
                              },
                              "text": {
                                "type": "string"
                              },
                              "wordCount": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "estimatedSeconds": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "passedChecks": {
                                "type": "boolean"
                              },
                              "failures": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "opening",
                                    "length",
                                    "number",
                                    "name"
                                  ]
                                }
                              }
                            },
                            "required": [
                              "format",
                              "text",
                              "wordCount",
                              "estimatedSeconds",
                              "passedChecks",
                              "failures"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "exemplars": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "published",
                                  "reference"
                                ]
                              },
                              "channelHandle": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "title": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "text": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "kind",
                              "channelHandle",
                              "title",
                              "text"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "hooks",
                        "exemplars"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "mainIdea": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1500
                  },
                  "problem": {
                    "type": "string",
                    "maxLength": 1500
                  },
                  "payoff": {
                    "type": "string",
                    "maxLength": 1500
                  },
                  "proof": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "sections": {
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 400
                    }
                  },
                  "presenter": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "formats": {
                    "minItems": 1,
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "reframe-intro",
                        "four-p",
                        "if-then"
                      ]
                    }
                  },
                  "targetWpm": {
                    "type": "integer",
                    "minimum": 60,
                    "maximum": 300
                  },
                  "direction": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "includeExemplars": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "title",
                  "mainIdea"
                ]
              }
            }
          }
        }
      }
    },
    "/packages/rank": {
      "post": {
        "operationId": "rank_packages",
        "summary": "Run swapped-order dual-judge pairwise ranking on 1 to 10 title or title+thumbnail package pairs. Costs 2 credits per pair.",
        "tags": [
          "packaging:write"
        ],
        "x-mcp-tool": "rank_packages",
        "x-mode": "sync",
        "x-requires-channel-sync": false,
        "x-credit-cost": "variable",
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "winner": {
                                "type": "string",
                                "enum": [
                                  "a",
                                  "b",
                                  "tie"
                                ]
                              },
                              "confidence": {
                                "type": "string",
                                "enum": [
                                  "high",
                                  "moderate",
                                  "tossup"
                                ]
                              },
                              "rationale": {
                                "type": "string"
                              },
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "title",
                                  "joint"
                                ]
                              }
                            },
                            "required": [
                              "winner",
                              "confidence",
                              "rationale",
                              "mode"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "results"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pairs": {
                    "minItems": 1,
                    "maxItems": 10,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "a": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 300
                            },
                            "thumbnailUrl": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "uri"
                            }
                          },
                          "required": [
                            "title"
                          ],
                          "additionalProperties": false
                        },
                        "b": {
                          "type": "object",
                          "properties": {
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 300
                            },
                            "thumbnailUrl": {
                              "type": "string",
                              "maxLength": 2048,
                              "format": "uri"
                            }
                          },
                          "required": [
                            "title"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "a",
                        "b"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "topic": {
                    "type": "string",
                    "maxLength": 500
                  }
                },
                "required": [
                  "pairs"
                ]
              }
            }
          }
        }
      }
    },
    "/retention/channel": {
      "post": {
        "operationId": "analyze_channel_retention",
        "summary": "Analyze the channel's audience retention: which hook signals hold viewers at 30 seconds, the openings that held best, and the steepest mid-video drop-offs with the exact spoken lines. Needs retention curves for at least 5 videos; with fewer, it returns state insufficient_data and charges 0 credits. Costs 1 credit otherwise.",
        "tags": [
          "retention:read"
        ],
        "x-mcp-tool": "analyze_channel_retention",
        "x-mode": "sync",
        "x-requires-channel-sync": true,
        "x-credit-cost": 1,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "insufficient_data"
                            },
                            "videosWithRetention": {
                              "type": "number"
                            },
                            "minimumRequired": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "state",
                            "videosWithRetention",
                            "minimumRequired"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "state": {
                              "type": "string",
                              "const": "ready"
                            },
                            "videosWithRetention": {
                              "type": "number"
                            },
                            "videosAnalyzed": {
                              "type": "number"
                            },
                            "signals": {
                              "type": "object",
                              "properties": {
                                "videosInCohort": {
                                  "type": "number"
                                },
                                "underpowered": {
                                  "type": "boolean"
                                },
                                "caveats": {
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "items": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string"
                                      },
                                      "label": {
                                        "type": "string"
                                      },
                                      "group": {
                                        "type": "string"
                                      },
                                      "tier": {
                                        "type": "string"
                                      },
                                      "bucket": {
                                        "type": "string"
                                      },
                                      "direction": {
                                        "type": "string"
                                      },
                                      "indicates": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "label",
                                      "group",
                                      "tier",
                                      "bucket",
                                      "direction",
                                      "indicates"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "videosInCohort",
                                "underpowered",
                                "caveats",
                                "items"
                              ],
                              "additionalProperties": false
                            },
                            "topOpenings": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "videoId": {
                                    "type": "string"
                                  },
                                  "youtubeId": {
                                    "type": "string"
                                  },
                                  "videoTitle": {
                                    "type": "string"
                                  },
                                  "relativeRetention30s": {
                                    "type": "number"
                                  },
                                  "openingText": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "videoId",
                                  "youtubeId",
                                  "videoTitle",
                                  "relativeRetention30s",
                                  "openingText"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "steepDrops": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "videoId": {
                                    "type": "string"
                                  },
                                  "youtubeId": {
                                    "type": "string"
                                  },
                                  "videoTitle": {
                                    "type": "string"
                                  },
                                  "second": {
                                    "type": "number"
                                  },
                                  "timestamp": {
                                    "type": "string"
                                  },
                                  "deepLink": {
                                    "type": "string"
                                  },
                                  "relativeRetention": {
                                    "type": "number"
                                  },
                                  "dropMagnitude": {
                                    "type": "number"
                                  },
                                  "spokenLine": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "videoId",
                                  "youtubeId",
                                  "videoTitle",
                                  "second",
                                  "timestamp",
                                  "deepLink",
                                  "relativeRetention",
                                  "dropMagnitude",
                                  "spokenLine"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "dips": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "videoId": {
                                    "type": "string"
                                  },
                                  "youtubeId": {
                                    "type": "string"
                                  },
                                  "videoTitle": {
                                    "type": "string"
                                  },
                                  "second": {
                                    "type": "number"
                                  },
                                  "timestamp": {
                                    "type": "string"
                                  },
                                  "deepLink": {
                                    "type": "string"
                                  },
                                  "relativeRetention": {
                                    "type": "number"
                                  },
                                  "dropMagnitude": {
                                    "type": "number"
                                  },
                                  "spokenLine": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "videoId",
                                  "youtubeId",
                                  "videoTitle",
                                  "second",
                                  "timestamp",
                                  "deepLink",
                                  "relativeRetention",
                                  "dropMagnitude",
                                  "spokenLine"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "state",
                            "videosWithRetention",
                            "videosAnalyzed",
                            "signals",
                            "topOpenings",
                            "steepDrops",
                            "dips"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "maxVideos": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 25
                  }
                }
              }
            }
          }
        }
      }
    },
    "/retention/critique": {
      "post": {
        "operationId": "critique_retention",
        "summary": "Critique a hook or script draft against this channel's own retention evidence (hook signals, best openings, steepest drop-offs). Returns risk, issues with suggested rewrites, and a rewritten draft. Runs async: poll the operation or pass webhookUrl. Costs 8 credits; credits are released if the run fails (for example, fewer than 5 videos with retention curves).",
        "tags": [
          "retention:read"
        ],
        "x-mcp-tool": "critique_retention",
        "x-mode": "async",
        "x-requires-channel-sync": true,
        "x-credit-cost": 8,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted. Poll pollUrl for the result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "operationId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "const": "queued"
                        },
                        "pollUrl": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "operationId",
                        "status",
                        "pollUrl"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "x-operation-result": {
          "type": "object",
          "properties": {
            "overallRisk": {
              "type": "string",
              "enum": [
                "low",
                "medium",
                "high"
              ]
            },
            "summary": {
              "type": "string"
            },
            "channelSignalsUsed": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "issues": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "excerpt": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "matchedChannelPattern": {
                    "type": "string"
                  },
                  "citedVideoTitle": {
                    "type": "string"
                  },
                  "suggestedRewrite": {
                    "type": "string"
                  }
                },
                "required": [
                  "excerpt",
                  "reason",
                  "matchedChannelPattern",
                  "suggestedRewrite"
                ],
                "additionalProperties": false
              }
            },
            "rewrittenDraft": {
              "type": "string"
            }
          },
          "required": [
            "overallRisk",
            "summary",
            "channelSignalsUsed",
            "issues",
            "rewrittenDraft"
          ],
          "additionalProperties": false
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "draftType": {
                    "type": "string",
                    "enum": [
                      "hook",
                      "script"
                    ]
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 30000
                  },
                  "targetDurationSeconds": {
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 7200
                  },
                  "webhookUrl": {
                    "type": "string",
                    "maxLength": 2000,
                    "format": "uri"
                  }
                },
                "required": [
                  "draftType",
                  "text"
                ]
              }
            }
          }
        }
      }
    },
    "/thumbnails/generate": {
      "post": {
        "operationId": "generate_thumbnail",
        "summary": "Generate a blueprint-backed YouTube thumbnail PNG asynchronously using corpus winner blueprints, channel brand context, and optional reference images or presenter headshot. Costs 15 credits.",
        "tags": [
          "packaging:write"
        ],
        "x-mcp-tool": "generate_thumbnail",
        "x-mode": "async",
        "x-requires-channel-sync": true,
        "x-credit-cost": 15,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted. Poll pollUrl for the result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "operationId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "const": "queued"
                        },
                        "pollUrl": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "operationId",
                        "status",
                        "pollUrl"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "x-operation-result": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "format": "uri",
              "description": "Signed HTTPS download URL for the generated PNG (expires after 24 hours)."
            },
            "expiresAt": {
              "type": "string",
              "description": "ISO-8601 expiration timestamp for the signed PNG URL."
            },
            "route": {
              "type": "string",
              "enum": [
                "html",
                "photo"
              ],
              "description": "Rendering pipeline used to compose the thumbnail."
            },
            "headline": {
              "type": "string",
              "description": "Thumbnail overlay headline selected for the layout."
            },
            "blueprintId": {
              "description": "Corpus winner blueprint ID used, if applicable.",
              "type": [
                "string",
                "null"
              ]
            },
            "blueprintSummary": {
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "layout": {
                      "type": "string"
                    },
                    "storyType": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "promptTemplate": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "layout",
                    "storyType",
                    "promptTemplate"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ],
              "description": "Summary of the selected visual blueprint."
            },
            "verificationPassed": {
              "type": "boolean",
              "description": "Whether automated visual verification passed on the rendered PNG."
            }
          },
          "required": [
            "url",
            "expiresAt",
            "route",
            "headline",
            "blueprintId",
            "blueprintSummary",
            "verificationPassed"
          ],
          "additionalProperties": false
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "concept": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "style": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "blueprintId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "referenceUrls": {
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 2048,
                      "format": "uri"
                    }
                  },
                  "headshotUrl": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "webhookUrl": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  }
                },
                "required": [
                  "title",
                  "concept"
                ]
              }
            }
          }
        }
      }
    },
    "/concepts/ideate": {
      "post": {
        "operationId": "ideate_concepts",
        "summary": "Generate evidence-grounded YouTube video concepts for the connected channel using published knowledge base facts, cached Tech Radar stories, TopicDemand trends, outlier exemplars, and proven title formats. Async operation; costs 25 credits.",
        "tags": [
          "ideation:write"
        ],
        "x-mcp-tool": "ideate_concepts",
        "x-mode": "async",
        "x-requires-channel-sync": true,
        "x-credit-cost": 25,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted. Poll pollUrl for the result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "operationId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "const": "queued"
                        },
                        "pollUrl": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "operationId",
                        "status",
                        "pollUrl"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "x-operation-result": {
          "type": "object",
          "properties": {
            "concepts": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "workingTitle": {
                    "type": "string"
                  },
                  "angle": {
                    "type": "string"
                  },
                  "productTieIn": {
                    "type": "string"
                  },
                  "targetAudience": {
                    "type": "string"
                  },
                  "format": {
                    "type": "string"
                  },
                  "titleSkeletons": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "citations": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "source": {
                          "type": "string",
                          "enum": [
                            "radar",
                            "demand",
                            "knowledge_base",
                            "outlier"
                          ]
                        },
                        "label": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "source",
                        "label"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "briefSummary": {
                    "type": "string"
                  }
                },
                "required": [
                  "workingTitle",
                  "angle",
                  "productTieIn",
                  "targetAudience",
                  "format",
                  "titleSkeletons",
                  "citations",
                  "briefSummary"
                ],
                "additionalProperties": false
              }
            },
            "contextSummary": {
              "type": "object",
              "properties": {
                "channelName": {
                  "type": "string"
                },
                "niche": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "kbFactCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "radarStoryCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "demandTopicCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "recentVideoCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "exemplarCount": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "radarCapturedAt": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "demandSnapshotDate": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "channelName",
                "niche",
                "kbFactCount",
                "radarStoryCount",
                "demandTopicCount",
                "recentVideoCount",
                "exemplarCount",
                "radarCapturedAt",
                "demandSnapshotDate"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "concepts",
            "contextSummary"
          ],
          "additionalProperties": false
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "topicFocus": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "count": {
                    "default": 3,
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 5
                  },
                  "audienceNotes": {
                    "type": "string",
                    "maxLength": 1500
                  },
                  "includeRadar": {
                    "default": true,
                    "type": "boolean"
                  },
                  "webhookUrl": {
                    "type": "string",
                    "maxLength": 2048,
                    "format": "uri"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/scripts/generate": {
      "post": {
        "operationId": "generate_script",
        "summary": "Generate a full YouTube script grounded in the connected channel voice, knowledge base, and exemplars, with the rewrite loop capped to 1 pass. Async operation; costs 100 credits.",
        "tags": [
          "scripts:write"
        ],
        "x-mcp-tool": "generate_script",
        "x-mode": "async",
        "x-requires-channel-sync": true,
        "x-credit-cost": 100,
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "202": {
            "description": "Accepted. Poll pollUrl for the result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "operationId": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "const": "queued"
                        },
                        "pollUrl": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "operationId",
                        "status",
                        "pollUrl"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "required": [
                        "requestId",
                        "creditsCharged",
                        "creditsRemaining"
                      ],
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "creditsCharged": {
                          "type": "integer"
                        },
                        "creditsRemaining": {
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "replayed": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "invalid_input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "insufficient_credits",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "operation_not_found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "channel_sync_pending or idempotency_conflict",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "rate_limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "object",
                      "required": [
                        "code",
                        "message"
                      ],
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                }
              }
            }
          }
        },
        "x-operation-result": {
          "type": "object",
          "properties": {
            "script": {
              "type": "string",
              "description": "Full generated YouTube script text."
            },
            "wordCount": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Word count of the generated script."
            },
            "estimatedDurationSeconds": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Estimated spoken duration in seconds."
            },
            "rewritePassesUsed": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991,
              "description": "Number of critic rewrite passes used (0 or 1)."
            },
            "groundingNotes": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Knowledge base and exemplar grounding notes used during generation."
            }
          },
          "required": [
            "script",
            "wordCount",
            "estimatedDurationSeconds",
            "rewritePassesUsed",
            "groundingNotes"
          ],
          "additionalProperties": false
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                  },
                  "concept": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "targetWordCount": {
                    "description": "Target word count (300-5000, defaults to 1500 when targetDurationMinutes is omitted).",
                    "type": "integer",
                    "minimum": 300,
                    "maximum": 5000
                  },
                  "targetDurationMinutes": {
                    "description": "Target duration in minutes (2-30), converted via channel speaking pace when targetWordCount is omitted.",
                    "type": "number",
                    "minimum": 2,
                    "maximum": 30
                  },
                  "outline": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "hook": {
                    "type": "string",
                    "maxLength": 1500
                  },
                  "presenter": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "notes": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "webhookUrl": {
                    "type": "string",
                    "maxLength": 2048
                  }
                },
                "required": [
                  "title",
                  "concept"
                ]
              }
            }
          }
        }
      }
    }
  }
}
