{
  "openapi": "3.1.0",
  "info": {
    "title": "UpGrow public API",
    "version": "1.0.0",
    "summary": "Read-only facts about UpGrow plans, the one-time shop, free Instagram tools and the blog, plus a signed-in user's own account summary.",
    "description": "A free, read-only JSON API for AI agents and developers. The public endpoints need no authentication and no API key. GET /api/public/v1/me returns the signed-in user's own account summary and needs that user's approval: an UpGrow OAuth access token or a claimed agent credential with scope account:read (see https://www.upgrow.com/auth.md). Plan prices are first-month prices and shop prices are one-time prices. Documentation: https://www.upgrow.com/developers",
    "contact": {
      "name": "UpGrow Team",
      "url": "https://www.upgrow.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://www.upgrow.com",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "UpGrow for AI agents and developers",
    "url": "https://www.upgrow.com/developers"
  },
  "paths": {
    "/api/public/v1": {
      "get": {
        "operationId": "getApiIndex",
        "summary": "Index of the endpoints",
        "description": "Lists the REST endpoints with their URLs and whether they need authentication.",
        "responses": {
          "200": {
            "description": "Endpoint index",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "openapi": {
                      "type": "string",
                      "format": "uri"
                    },
                    "endpoints": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "method": {
                            "type": "string"
                          },
                          "path": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          },
                          "auth": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "method",
                          "path",
                          "url",
                          "auth"
                        ]
                      }
                    }
                  },
                  "required": [
                    "name",
                    "endpoints"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/plans": {
      "get": {
        "operationId": "listPlans",
        "summary": "List the UpGrow growth plans",
        "description": "Basic, Pro and Turbo with the first-month price, what each plan includes and the sign-up link.",
        "responses": {
          "200": {
            "description": "The growth plans",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                },
                "description": "Always *"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlansResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/products": {
      "get": {
        "operationId": "listProducts",
        "summary": "List the one-time shop products",
        "description": "Instagram and TikTok followers, likes, views and comments sold once, with tiers, starting prices and product page links.",
        "responses": {
          "200": {
            "description": "The shop products",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                },
                "description": "Always *"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/free-tools": {
      "get": {
        "operationId": "listFreeTools",
        "summary": "List the free Instagram tools",
        "description": "Each free tool with its page link and a one-line description.",
        "responses": {
          "200": {
            "description": "The free tools",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                },
                "description": "Always *"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FreeToolsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/blog/search": {
      "get": {
        "operationId": "searchBlog",
        "summary": "Search the UpGrow blog",
        "description": "Blog posts matching the query, most relevant first.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Search text, 2 to 100 characters.",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of results, 1 to 10. Defaults to 5.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching posts",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                },
                "description": "Always *"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlogSearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "q or limit is invalid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The search backend failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Health check",
        "description": "Returns {\"status\":\"ok\"}. Never cached.",
        "responses": {
          "200": {
            "description": "The API is up",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "ok"
                    }
                  },
                  "required": [
                    "status"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/me": {
      "get": {
        "operationId": "getAccountSummary",
        "summary": "The signed-in user's account summary",
        "description": "Email, connected Instagram and TikTok accounts with connection status, follower numbers (now and when added) and each account's plan name and status. Read-only; never contains prices, payment or card details. Not cached.",
        "security": [
          {
            "upgrowOAuth": [
              "account:read"
            ]
          },
          {
            "agentCredential": []
          }
        ],
        "responses": {
          "200": {
            "description": "Account summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountSummary"
                }
              }
            }
          },
          "401": {
            "description": "No token, or the token is invalid, expired or revoked",
            "headers": {
              "WWW-Authenticate": {
                "description": "Bearer challenge with resource_metadata and scope",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          },
          "403": {
            "description": "insufficient_scope: the agent credential has not been claimed by a user yet",
            "headers": {
              "WWW-Authenticate": {
                "description": "Bearer challenge with resource_metadata and scope",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      },
      "Plan": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "examples": [
              "Basic"
            ]
          },
          "firstMonthPrice": {
            "type": "string",
            "description": "First-month price in US dollars.",
            "examples": [
              "$49"
            ]
          },
          "currency": {
            "type": "string",
            "const": "USD"
          },
          "description": {
            "type": "string"
          },
          "includes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "pricingUrl": {
            "type": "string",
            "format": "uri"
          },
          "signupUrl": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "name",
          "firstMonthPrice",
          "currency",
          "description",
          "includes",
          "pricingUrl",
          "signupUrl"
        ]
      },
      "PlansResponse": {
        "type": "object",
        "properties": {
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Plan"
            }
          }
        },
        "required": [
          "plans"
        ]
      },
      "ProductTier": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "features": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "from": {
            "type": "string",
            "description": "Smallest package of this tier with its one-time price.",
            "examples": [
              "100 followers for $2.99"
            ]
          }
        },
        "required": [
          "name",
          "features",
          "from"
        ]
      },
      "Product": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "platform": {
            "type": "string",
            "enum": [
              "instagram",
              "tiktok"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "from": {
            "type": "string",
            "description": "Smallest package with its one-time price.",
            "examples": [
              "50 likes for $1.99"
            ]
          },
          "delivery": {
            "type": "string"
          },
          "guarantees": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tiers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProductTier"
            }
          }
        },
        "required": [
          "slug",
          "name",
          "platform",
          "url",
          "from",
          "delivery",
          "guarantees",
          "tiers"
        ]
      },
      "ProductsResponse": {
        "type": "object",
        "properties": {
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            }
          }
        },
        "required": [
          "products"
        ]
      },
      "FreeTool": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "url",
          "description"
        ]
      },
      "FreeToolsResponse": {
        "type": "object",
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FreeTool"
            }
          }
        },
        "required": [
          "tools"
        ]
      },
      "BlogPost": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "publishedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "title",
          "url",
          "description",
          "publishedAt"
        ]
      },
      "BlogSearchResponse": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string"
          },
          "count": {
            "type": "integer"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BlogPost"
            }
          }
        },
        "required": [
          "query",
          "count",
          "results"
        ]
      },
      "ConnectedAccount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "UpGrow account id (use it with the account MCP tool get_growth_stats)"
          },
          "platform": {
            "type": "string",
            "enum": [
              "instagram",
              "tiktok"
            ]
          },
          "username": {
            "type": "string"
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "connection_status": {
            "type": "string",
            "enum": [
              "connected",
              "disconnected"
            ]
          },
          "growth_running": {
            "type": "boolean",
            "description": "Whether UpGrow is currently growing this account"
          },
          "plan": {
            "type": "string",
            "description": "basic, pro, turbo, free or suspended"
          },
          "plan_name": {
            "type": "string"
          },
          "plan_status": {
            "type": "string",
            "enum": [
              "active",
              "no_paid_plan",
              "inactive",
              "suspended"
            ]
          },
          "followers": {
            "type": [
              "integer",
              "null"
            ]
          },
          "followers_at_start": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Followers when the account was added to UpGrow"
          },
          "followers_gained": {
            "type": [
              "integer",
              "null"
            ]
          },
          "following": {
            "type": [
              "integer",
              "null"
            ]
          },
          "posts": {
            "type": [
              "integer",
              "null"
            ]
          },
          "likes": {
            "type": [
              "integer",
              "null"
            ],
            "description": "TikTok only"
          },
          "likes_at_start": {
            "type": [
              "integer",
              "null"
            ],
            "description": "TikTok only"
          },
          "added_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "dashboard_url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "id",
          "platform",
          "username",
          "connection_status",
          "plan",
          "plan_name",
          "plan_status"
        ]
      },
      "AccountSummary": {
        "type": "object",
        "description": "Read-only. Never contains prices, payment or card details.",
        "properties": {
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_count": {
            "type": "integer"
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConnectedAccount"
            }
          }
        },
        "required": [
          "email",
          "account_count",
          "accounts"
        ]
      },
      "OAuthError": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "error_description": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      }
    },
    "securitySchemes": {
      "upgrowOAuth": {
        "type": "oauth2",
        "description": "OAuth 2.1 authorization code with PKCE (S256) for public clients. Register a client at https://www.upgrow.com/api/oauth/register (RFC 7591). Metadata: https://www.upgrow.com/.well-known/oauth-authorization-server",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://www.upgrow.com/oauth/authorize",
            "tokenUrl": "https://www.upgrow.com/api/oauth/token",
            "refreshUrl": "https://www.upgrow.com/api/oauth/token",
            "scopes": {
              "account:read": "Read your UpGrow account summary: connected accounts, growth numbers and plan status"
            }
          }
        }
      },
      "agentCredential": {
        "type": "http",
        "scheme": "bearer",
        "description": "An agent credential (uga_...) from https://www.upgrow.com/api/agents/auth/register that the user has claimed. See https://www.upgrow.com/auth.md"
      }
    }
  }
}
