{
  "openapi": "3.1.0",
  "info": {
    "title": "Framplates API",
    "version": "1.0.0",
    "description": "Read-only search over the Framplates catalogue of free and paid Framer website templates. No key needed. Please link each template to its Framplates page (the url field).",
    "contact": { "email": "hello@framplates.com", "url": "https://framplates.com/developers" }
  },
  "servers": [{ "url": "https://framplates.com/api/v1" }],
  "paths": {
    "/templates": {
      "get": {
        "operationId": "searchTemplates",
        "summary": "Search templates",
        "parameters": [
          { "name": "q", "in": "query", "schema": { "type": "string" }, "description": "Words to match in the name, description or creator." },
          { "name": "creator", "in": "query", "schema": { "type": "string" }, "description": "Creator slug from /creators." },
          { "name": "category", "in": "query", "schema": { "type": "string" }, "description": "A category from /categories." },
          { "name": "feature", "in": "query", "schema": { "type": "string" }, "description": "A Framer feature from /categories." },
          { "name": "price", "in": "query", "schema": { "type": "string", "enum": ["free", "paid"] } },
          { "name": "sort", "in": "query", "schema": { "type": "string", "enum": ["latest", "oldest", "price-low-high", "price-high-low", "alphabetical", "random"], "default": "latest" } },
          { "name": "page", "in": "query", "schema": { "type": "integer", "minimum": 1, "default": 1 } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 24, "default": 12 } }
        ],
        "responses": {
          "200": { "description": "Matching templates", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TemplateList" } } } },
          "400": { "description": "Unknown category, feature or creator", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    },
    "/templates/{slug}": {
      "get": {
        "operationId": "getTemplate",
        "summary": "Get one template",
        "parameters": [{ "name": "slug", "in": "path", "required": true, "schema": { "type": "string" } }],
        "responses": {
          "200": { "description": "The template", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TemplateDetail" } } } },
          "404": { "description": "Not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    },
    "/creators": {
      "get": {
        "operationId": "listCreators",
        "summary": "List creators, most templates first",
        "parameters": [
          { "name": "q", "in": "query", "schema": { "type": "string" } },
          { "name": "page", "in": "query", "schema": { "type": "integer", "minimum": 1, "default": 1 } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 20 } }
        ],
        "responses": { "200": { "description": "Creators", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatorList" } } } } }
      }
    },
    "/categories": {
      "get": {
        "operationId": "getCatalogueInfo",
        "summary": "Catalogue size and valid filter values",
        "responses": { "200": { "description": "Catalogue info", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CatalogueInfo" } } } } }
      }
    }
  },
  "components": {
    "schemas": {
      "Creator": { "type": "object", "properties": { "name": { "type": "string" }, "url": { "type": ["string", "null"], "format": "uri" } } },
      "Template": {
        "type": "object",
        "properties": {
          "slug": { "type": "string" },
          "name": { "type": "string" },
          "price": { "type": "string", "examples": ["Free", "$49"] },
          "creator": { "$ref": "#/components/schemas/Creator" },
          "description": { "type": ["string", "null"] },
          "categories": { "type": "array", "items": { "type": "string" } },
          "thumbnail": { "type": "string", "format": "uri" },
          "url": { "type": "string", "format": "uri" }
        }
      },
      "TemplateList": {
        "type": "object",
        "properties": {
          "total": { "type": "integer" },
          "page": { "type": "integer" },
          "totalPages": { "type": "integer" },
          "templates": { "type": "array", "items": { "$ref": "#/components/schemas/Template" } }
        }
      },
      "TemplateDetail": {
        "allOf": [
          { "$ref": "#/components/schemas/Template" },
          {
            "type": "object",
            "properties": {
              "features": { "type": "array", "items": { "type": "string" } },
              "pages": { "type": "array", "items": { "type": "string" } },
              "livePreview": { "type": ["string", "null"], "format": "uri" },
              "images": { "type": "object", "properties": { "thumbnail": { "type": "string" }, "desktop": { "type": "string" }, "mobile": { "type": "string" } } },
              "addedOn": { "type": ["string", "null"], "format": "date" }
            }
          }
        ]
      },
      "CreatorList": {
        "type": "object",
        "properties": {
          "total": { "type": "integer" },
          "page": { "type": "integer" },
          "creators": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": { "name": { "type": "string" }, "templates": { "type": "integer" }, "freeTemplates": { "type": "integer" }, "url": { "type": "string" }, "slug": { "type": "string" } }
            }
          }
        }
      },
      "CatalogueInfo": {
        "type": "object",
        "properties": {
          "templates": { "type": "integer" },
          "creators": { "type": "integer" },
          "categories": { "type": "array", "items": { "type": "string" } },
          "features": { "type": "array", "items": { "type": "string" } },
          "sorts": { "type": "array", "items": { "type": "string" } }
        }
      },
      "Error": { "type": "object", "properties": { "error": { "type": "string" } } }
    }
  }
}
