{
  "openapi": "3.0.3",
  "info": {
    "title": "Plunder & Riffle agent API",
    "version": "1.0.0",
    "description": "Pitch pages, audioscript pages and MP4s for agents. Prices are in USD (GET /api/agent/services); credits are the list price rounded up at $0.10/credit, so a page is 1 credit and an audioscript or MP4 is 3. Failed jobs are refunded. Pay with x-api-key credits or x402 USDC on Base via Bankr."
  },
  "servers": [
    {
      "url": "https://bot.plunderandriffle.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  },
  "paths": {
    "/api/agent/services": {
      "get": {
        "summary": "Public menu: services, prices, limits",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/agent/before": {
      "post": {
        "summary": "Personalized pitch page for one person (1 credit)",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "string",
                    "description": "Website, x.com/linkedin link or a sentence about them (<=1500 chars)"
                  },
                  "offer": {
                    "type": "string",
                    "description": "What the sender sells (<=600 chars)"
                  },
                  "language": {
                    "type": "string",
                    "description": "Language name or code"
                  }
                },
                "required": [
                  "input"
                ]
              }
            }
          }
        }
      }
    },
    "/api/agent/audioscript": {
      "post": {
        "summary": "Script (<150 words, verbatim) or mp3 (<=3 min) -> beat-timed captioned page (3 credits, $0.25; MP4 is a separate step)",
        "responses": {
          "202": {
            "description": "Job accepted. Poll the status endpoint (free)."
          },
          "400": {
            "description": "Invalid request"
          },
          "402": {
            "description": "Out of credits"
          },
          "429": {
            "description": "Renderer busy"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "script": {
                    "type": "string",
                    "description": "Exact words to speak, under 150 words. Use this OR audio_url."
                  },
                  "audio_url": {
                    "type": "string",
                    "description": "https mp3/m4a/wav, <=3 min, <=24MB"
                  },
                  "title": {
                    "type": "string",
                    "description": "Title"
                  },
                  "language": {
                    "type": "string",
                    "description": "Language"
                  }
                },
                "description": "Send exactly one of script or audio_url."
              }
            }
          }
        }
      }
    },
    "/api/agent/audioscript/{jobId}": {
      "get": {
        "summary": "Audioscript job status (free)",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/agent/mp4": {
      "post": {
        "summary": "Render an engine page to MP4 (3 credits)",
        "responses": {
          "202": {
            "description": "Job accepted. Poll the status endpoint (free)."
          },
          "400": {
            "description": "Invalid request"
          },
          "402": {
            "description": "Out of credits"
          },
          "429": {
            "description": "Renderer busy"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pageUrl": {
                    "type": "string",
                    "description": "An engine page URL (/m/<id> or *.here.now)"
                  }
                },
                "required": [
                  "pageUrl"
                ]
              }
            }
          }
        }
      }
    },
    "/api/agent/mp4/{jobId}": {
      "get": {
        "summary": "MP4 job status (free)",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "parameters": [
          {
            "name": "jobId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/api/agent/brands/memes": {
      "post": {
        "summary": "Branded-bot meme + slideshow + hot take, 23 languages (1 credit)",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "string",
                    "description": "Sentence, idea, website or X post (<=2000 chars)"
                  },
                  "language": {
                    "type": "string",
                    "description": "Language"
                  }
                },
                "required": [
                  "input"
                ]
              }
            }
          }
        }
      }
    },
    "/api/agent/xaiver/memes": {
      "post": {
        "summary": "Alias of /api/agent/brands/memes",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "string",
                    "description": "Sentence, idea, website or X post (<=2000 chars)"
                  },
                  "language": {
                    "type": "string",
                    "description": "Language"
                  }
                },
                "required": [
                  "input"
                ]
              }
            }
          }
        },
        "deprecated": true
      }
    },
    "/api/agent/credits/packs": {
      "get": {
        "summary": "Credit packs",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/mcp": {
      "post": {
        "summary": "MCP server (Streamable HTTP, stateless). Tools: list_services, create_before_pitch, create_audioscript, get_audioscript_status, request_mp4, get_mp4_status",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          {
            "apiKey": []
          }
        ]
      }
    },
    "/api/agent/invite-bot": {
      "post": {
        "summary": "Free-bot invite: the recipient's /before pitch plus a one-time claim link for a free branded bot with 200 generations (1 credit)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input": {
                    "type": "string",
                    "description": "Recipient's website, x.com/linkedin link or a sentence about them (<=1500 chars)"
                  },
                  "language": {
                    "type": "string",
                    "description": "Language name or code"
                  }
                },
                "required": [
                  "input"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK: { code, inviteUrl, beforeUrl, who, freeGenerations, message, expiresInDays }"
          },
          "402": {
            "description": "Out of credits"
          },
          "429": {
            "description": "3 new invites per day / 10 unclaimed per key"
          }
        }
      }
    }
  }
}
