{
  "openapi": "3.1.0",
  "info": {
    "title": "Approvibe API",
    "version": "1.0.0",
    "description": "Host the store pages of a mobile app (privacy policy, terms, support, account deletion) and its smart link. The same operations are available as MCP tools at /mcp. The developer remains responsible for the content of their pages."
  },
  "servers": [
    {
      "url": "https://approvibe.com/api/v1"
    }
  ],
  "security": [
    {
      "bearer": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearer": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key (sa_…) created in the dashboard"
      }
    }
  },
  "paths": {
    "/store-requirements": {
      "get": {
        "summary": "What the App Store and Google Play require",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/templates": {
      "get": {
        "summary": "Page templates (Markdown)",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "en"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/sdks": {
      "get": {
        "summary": "SDK reference",
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/apps": {
      "get": {
        "summary": "List apps",
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      },
      "post": {
        "summary": "Create an app",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "store_urls": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "icon_url": {
                    "type": "string"
                  },
                  "developer": {
                    "type": "string"
                  },
                  "contact_email": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  }
                },
                "required": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Plan limit"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/apps/{appId}": {
      "get": {
        "summary": "Get an app (URLs, pages, lint)",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      },
      "patch": {
        "summary": "Update an app",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "icon_url": {
                    "type": "string"
                  },
                  "developer": {
                    "type": "string"
                  },
                  "contact_email": {
                    "type": "string"
                  },
                  "store_urls": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/apps/{appId}/sdks": {
      "put": {
        "summary": "Declare the SDKs used",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sdk_ids": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "sdk_ids"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/apps/{appId}/pages/{type}": {
      "get": {
        "summary": "Get a page",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "privacy",
                "terms",
                "support",
                "delete-account"
              ]
            }
          },
          {
            "name": "locale",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      },
      "put": {
        "summary": "Write the draft of a page (returns lint warnings)",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "privacy",
                "terms",
                "support",
                "delete-account"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "locale": {
                    "type": "string",
                    "default": "en"
                  },
                  "markdown": {
                    "type": "string"
                  }
                },
                "required": [
                  "markdown"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/apps/{appId}/publish": {
      "post": {
        "summary": "Publish drafts",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "types": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "locales": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/apps/{appId}/slug": {
      "post": {
        "summary": "Change the public address",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "slug": {
                    "type": "string"
                  }
                },
                "required": [
                  "slug"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/apps/{appId}/stats": {
      "get": {
        "summary": "Statistics",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 30
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/apps/{appId}/reviews": {
      "get": {
        "summary": "Store reviews (full history kept by Approvibe)",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "store",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ios",
                "android"
              ]
            }
          },
          {
            "name": "min_rating",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "max_rating",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "new",
                "replied",
                "ignored"
              ]
            }
          },
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "until",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/apps/{appId}/reviews/stats": {
      "get": {
        "summary": "Reputation score and review statistics",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/apps/{appId}/reviews/export": {
      "get": {
        "summary": "All reviews as JSON Lines",
        "parameters": [
          {
            "name": "appId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/reviews/{reviewId}": {
      "patch": {
        "summary": "Update a review status",
        "parameters": [
          {
            "name": "reviewId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "new",
                      "replied",
                      "ignored"
                    ]
                  }
                },
                "required": [
                  "status"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/requests": {
      "get": {
        "summary": "Deletion and support requests",
        "parameters": [
          {
            "name": "app_id",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "new",
                "handled"
              ]
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "deletion",
                "support"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/requests/{requestId}": {
      "patch": {
        "summary": "Update a request status",
        "parameters": [
          {
            "name": "requestId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "new",
                      "handled"
                    ]
                  }
                },
                "required": [
                  "status"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Invalid input"
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    }
  }
}