{
  "openapi": "3.1.0",
  "info": {
    "title": "Outfame public agent API",
    "version": "1.0.0",
    "description": "Read-only JSON API for AI agents and developers: Outfame's plans (first-month prices), free tools and blog search (no authentication), plus the signed-in user's account summary at /api/agents/v1/me (OAuth 2.1 or an auth.md credential, scope account:read).",
    "termsOfService": "https://www.outfame.com/terms-of-service",
    "contact": {
      "name": "Outfame Team",
      "email": "support@outfame.com",
      "url": "https://www.outfame.com/contact"
    }
  },
  "servers": [
    {
      "url": "https://www.outfame.com"
    }
  ],
  "externalDocs": {
    "description": "AI agents and developer access",
    "url": "https://www.outfame.com/docs/agents"
  },
  "paths": {
    "/api/agents/v1": {
      "get": {
        "operationId": "getApiIndex",
        "summary": "API index",
        "description": "Lists the endpoints under /api/agents/v1 with their authentication, and links this OpenAPI file and the documentation.",
        "responses": {
          "200": {
            "description": "The index.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "name",
                    "endpoints"
                  ],
                  "properties": {
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "openapi": {
                      "type": "string",
                      "format": "uri"
                    },
                    "documentation": {
                      "type": "string",
                      "format": "uri"
                    },
                    "endpoints": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "method",
                          "url",
                          "description",
                          "auth"
                        ],
                        "properties": {
                          "method": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "auth": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/v1/plans": {
      "get": {
        "operationId": "listPlans",
        "summary": "List Outfame plans",
        "description": "Go, Grow and Glory with the first-month price in US dollars, what each plan includes and the sign-up link.",
        "responses": {
          "200": {
            "description": "The plans.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plans"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/v1/free-tools": {
      "get": {
        "operationId": "listFreeTools",
        "summary": "List free tools",
        "description": "Outfame's free Instagram and AI tools with page URL and a one-line description.",
        "responses": {
          "200": {
            "description": "The tools.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FreeTools"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/v1/blog/search": {
      "get": {
        "operationId": "searchBlog",
        "summary": "Search the blog",
        "description": "Blog articles matching the words in q, best match first.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Words to search for.",
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Number of results to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 10,
              "default": 5
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The matching articles.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlogSearch"
                }
              }
            }
          },
          "400": {
            "description": "q or limit is missing or out of range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The blog search is unavailable right now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/v1/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "API status",
        "description": "Returns status ok. Never cached.",
        "responses": {
          "200": {
            "description": "The API is up.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "ok"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/agents/v1/me": {
      "get": {
        "operationId": "getAccountSummary",
        "summary": "Account summary of the signed-in user",
        "description": "The user's email and every connected Instagram or TikTok account with its status, follower numbers, plan name and the account's plan status. Read-only. No prices, payment or card data. Never cached. Without a token: 401 with WWW-Authenticate pointing at https://www.outfame.com/.well-known/oauth-protected-resource (resource https://www.outfame.com); an unclaimed auth.md credential: 403 insufficient_scope.",
        "security": [
          {
            "oauth2": [
              "account:read"
            ]
          },
          {
            "agentCredential": []
          }
        ],
        "responses": {
          "200": {
            "description": "Account summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountSummary"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, expired or revoked token (WWW-Authenticate: Bearer resource_metadata=..., scope=\"account:read\").",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          },
          "403": {
            "description": "Token lacks account:read (for example an auth.md credential that is not claimed yet).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "Plan": {
        "type": "object",
        "required": [
          "id",
          "name",
          "firstMonthPriceUsd",
          "firstMonthPrice",
          "summary",
          "includes",
          "signupUrl",
          "pricingUrl"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Lowercase plan name."
          },
          "name": {
            "type": "string"
          },
          "firstMonthPriceUsd": {
            "type": "number",
            "description": "Price of the first month in US dollars."
          },
          "firstMonthPrice": {
            "type": "string",
            "description": "The same price as text, for example with a dollar sign."
          },
          "summary": {
            "type": "string"
          },
          "includes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "signupUrl": {
            "type": "string",
            "format": "uri"
          },
          "pricingUrl": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Plans": {
        "type": "object",
        "required": [
          "currency",
          "note",
          "plans"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "const": "USD"
          },
          "note": {
            "type": "string",
            "description": "Billing note: first-month prices and how billing works."
          },
          "plans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Plan"
            }
          }
        }
      },
      "FreeTool": {
        "type": "object",
        "required": [
          "name",
          "url",
          "description"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "FreeTools": {
        "type": "object",
        "required": [
          "tools"
        ],
        "properties": {
          "tools": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FreeTool"
            }
          }
        }
      },
      "BlogResult": {
        "type": "object",
        "required": [
          "title",
          "url",
          "description",
          "publishedAt",
          "categories"
        ],
        "properties": {
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          },
          "publishedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "BlogSearch": {
        "type": "object",
        "required": [
          "query",
          "total",
          "results"
        ],
        "properties": {
          "query": {
            "type": "string"
          },
          "total": {
            "type": "integer",
            "description": "Number of matching articles in all."
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BlogResult"
            }
          }
        }
      },
      "OAuthError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "error_description": {
            "type": "string"
          },
          "resource_metadata": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ConnectedAccount": {
        "type": "object",
        "required": [
          "id",
          "platform",
          "username",
          "status",
          "growth_active",
          "plan"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "platform": {
            "type": "string",
            "enum": [
              "instagram",
              "tiktok"
            ]
          },
          "username": {
            "type": "string"
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "connected",
              "disconnected"
            ]
          },
          "growth_active": {
            "type": "boolean",
            "description": "Whether Outfame is currently growing this account."
          },
          "followers": {
            "type": [
              "integer",
              "null"
            ]
          },
          "followers_at_start": {
            "type": [
              "integer",
              "null"
            ]
          },
          "follower_change": {
            "type": [
              "integer",
              "null"
            ]
          },
          "following": {
            "type": [
              "integer",
              "null"
            ]
          },
          "posts": {
            "type": [
              "integer",
              "null"
            ]
          },
          "plan": {
            "type": "object",
            "required": [
              "name",
              "status"
            ],
            "properties": {
              "name": {
                "type": "string",
                "description": "Trial, Go, Grow or Glory"
              },
              "status": {
                "type": "string",
                "enum": [
                  "active",
                  "in_trial",
                  "paused",
                  "inactive",
                  "trial",
                  "none"
                ],
                "description": "The account's plan status."
              },
              "billing_period": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "added_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "AccountSummary": {
        "type": "object",
        "required": [
          "email",
          "account_count",
          "active_plans",
          "connected_accounts",
          "generated_at"
        ],
        "properties": {
          "email": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_count": {
            "type": "integer"
          },
          "active_plans": {
            "type": "integer"
          },
          "connected_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConnectedAccount"
            }
          },
          "generated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth 2.1 authorization code with PKCE (S256) for public clients; dynamic client registration at https://www.outfame.com/api/oauth/register. Metadata: https://www.outfame.com/.well-known/oauth-authorization-server",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://www.outfame.com/oauth/authorize",
            "tokenUrl": "https://www.outfame.com/api/oauth/token",
            "refreshUrl": "https://www.outfame.com/api/oauth/token",
            "scopes": {
              "account:read": "Read your Outfame account summary: connected accounts, growth numbers and plan status"
            }
          }
        }
      },
      "agentCredential": {
        "type": "http",
        "scheme": "bearer",
        "description": "auth.md credential (ofak_...) from https://www.outfame.com/api/agent-auth/register, claimed by the user; see https://www.outfame.com/auth.md"
      }
    }
  }
}
