{
  "openapi": "3.0.3",
  "info": {
    "title": "AnyDoor Agent HTTP API",
    "version": "1.0.0",
    "description": "Existing public BFF HTTP endpoints. Remote MCP uses a separate Streamable HTTP endpoint at /mcp; it is not described by this REST OpenAPI contract. No OAuth discovery is provided. Guests can create links and read known-code statistics; the suggestions endpoint currently accepts no token. Account association uses an optional existing token during creation."
  },
  "servers": [
    {
      "url": "https://rym.at"
    }
  ],
  "paths": {
    "/api/v1/shorten": {
      "post": {
        "operationId": "createShortLink",
        "summary": "Create or reuse a persistent public short link",
        "description": "Uses the overseas BFF and existing core RPC. No automatic retries for creation. Statistics have no date-range filter. Suggestions are rate limited and may fetch destination metadata.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "slug": {
                    "type": "string",
                    "description": "Optional custom code; reserved names are rejected."
                  },
                  "token": {
                    "type": "string",
                    "description": "Optional existing account token. Never put this in a URL."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "shortUrl": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "500": {
            "description": "Core or service error"
          }
        }
      }
    },
    "/api/v1/ai/shorten-suggestions": {
      "post": {
        "operationId": "suggestSlugs",
        "summary": "Suggest slugs without reserving or creating links",
        "description": "Uses the overseas BFF and existing core RPC. No automatic retries for creation. Statistics have no date-range filter. Suggestions are rate limited and may fetch destination metadata.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "scene": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "suggestions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "500": {
            "description": "Core or service error"
          },
          "429": {
            "description": "AI rate limit"
          }
        }
      }
    },
    "/api/v1/stats": {
      "post": {
        "operationId": "getClickStats",
        "summary": "Read aggregated daily click counts without visiting the link",
        "description": "Uses the overseas BFF and existing core RPC. No automatic retries for creation. Statistics have no date-range filter. Suggestions are rate limited and may fetch destination metadata.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "shortUrl"
                ],
                "properties": {
                  "shortUrl": {
                    "type": "string",
                    "description": "Short code only, not a full URL."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "clicks": {
                      "type": "array",
                      "nullable": true,
                      "items": {
                        "type": "object",
                        "properties": {
                          "date": {
                            "type": "string"
                          },
                          "click_times": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "500": {
            "description": "Core or service error"
          }
        }
      }
    }
  }
}
