{
  "openapi": "3.1.0",
  "info": {
    "title": "Napkinshot research API",
    "version": "1 (beta)",
    "summary": "Look up the product ideas on Napkinshot: which ideas exist, since when, with their AI shots and how people voted.",
    "description": "Only ideas their creators put in the public swipe feed: the product concept (name, tagline, features, price), when it was created, the AI-generated shots and how people voted, including what they would pay and why they passed. Never the idea's original text, which stays with its creator, and nothing about who had the idea: Napkinshot doesn't know. Ideas shared only by link are not in the API.\n\nGet a key: write to support@ideeninsel.net with who you are and what you'd like to build.\n\nRules: use the data to research ideas. Don't build or register other people's ideas as your own without asking them, don't pass the data on in bulk, don't use it to train AI, keep the \"AI-generated\" label on the images and credit napkinshot.com. The details are in the terms, § 2.",
    "termsOfService": "https://napkinshot.com/terms",
    "contact": { "name": "Napkinshot support", "email": "support@ideeninsel.net", "url": "https://napkinshot.com/developers" }
  },
  "externalDocs": { "description": "The API for developers", "url": "https://napkinshot.com/developers" },
  "servers": [{ "url": "https://napkinshot.com" }],
  "security": [{ "key": [] }],
  "paths": {
    "/api/v1/ideas": {
      "get": {
        "operationId": "listIdeas",
        "summary": "All public ideas, newest first",
        "parameters": [
          { "name": "limit", "in": "query", "description": "Ideas per page. A value outside 1 to 50 is moved to the nearest end.", "schema": { "type": "integer", "default": 20 } },
          { "name": "cursor", "in": "query", "description": "The next page: the value of next from the previous page.", "schema": { "type": "string" } }
        ],
        "responses": {
          "200": {
            "description": "A page of ideas.",
            "headers": { "x-quota-limit": { "$ref": "#/components/headers/QuotaLimit" }, "x-quota-remaining": { "$ref": "#/components/headers/QuotaRemaining" } },
            "content": { "application/json": { "schema": {
              "type": "object",
              "required": ["ideas", "next"],
              "properties": {
                "ideas": { "type": "array", "items": { "$ref": "#/components/schemas/Idea" } },
                "next": { "type": ["string", "null"], "description": "The cursor of the next page; null on the last page." }
              }
            } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "405": { "$ref": "#/components/responses/MethodNotAllowed" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "default": { "$ref": "#/components/responses/Unexpected" }
        }
      }
    },
    "/api/v1/ideas/search": {
      "get": {
        "operationId": "searchIdeas",
        "summary": "Ideas similar in meaning, in any language",
        "description": "Searches by meaning, not just words: \"schwebende Quallenlampe\" finds \"floating jellyfish lamp\".",
        "parameters": [
          { "name": "q", "in": "query", "required": true, "description": "What to search for. A longer search is cut to its first 300 characters.", "schema": { "type": "string", "minLength": 1 } },
          { "name": "limit", "in": "query", "description": "Ideas to return. A value outside 1 to 20 is moved to the nearest end.", "schema": { "type": "integer", "default": 10 } }
        ],
        "responses": {
          "200": {
            "description": "The most similar ideas, most similar first.",
            "headers": { "x-quota-limit": { "$ref": "#/components/headers/QuotaLimit" }, "x-quota-remaining": { "$ref": "#/components/headers/QuotaRemaining" } },
            "content": { "application/json": { "schema": {
              "type": "object",
              "required": ["query", "ideas"],
              "properties": {
                "query": { "type": "string", "description": "The search as read." },
                "ideas": { "type": "array", "items": { "$ref": "#/components/schemas/SearchHit" } }
              }
            } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "405": { "$ref": "#/components/responses/MethodNotAllowed" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "503": { "$ref": "#/components/responses/Booked" },
          "default": { "$ref": "#/components/responses/Unexpected" }
        }
      }
    },
    "/api/v1/ideas/{id}": {
      "get": {
        "operationId": "getIdea",
        "summary": "One idea",
        "parameters": [
          { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[a-z0-9]{10}$" } }
        ],
        "responses": {
          "200": {
            "description": "The idea.",
            "headers": { "x-quota-limit": { "$ref": "#/components/headers/QuotaLimit" }, "x-quota-remaining": { "$ref": "#/components/headers/QuotaRemaining" } },
            "content": { "application/json": { "schema": {
              "type": "object",
              "required": ["idea"],
              "properties": { "idea": { "$ref": "#/components/schemas/Idea" } }
            } } }
          },
          "401": { "$ref": "#/components/responses/Unauthorized" },
          "404": { "$ref": "#/components/responses/NotFound" },
          "405": { "$ref": "#/components/responses/MethodNotAllowed" },
          "429": { "$ref": "#/components/responses/TooManyRequests" },
          "default": { "$ref": "#/components/responses/Unexpected" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "key": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your key, sent as Authorization: Bearer nsk_… (nsk_ and 32 lowercase letters or digits). During the beta a key is free and allows 1,000 requests a month, up to 60 a minute. Ask for one at support@ideeninsel.net."
      }
    },
    "headers": {
      "QuotaLimit": { "description": "Requests this key may make this calendar month.", "schema": { "type": "integer" } },
      "QuotaRemaining": { "description": "Requests this key has left this calendar month.", "schema": { "type": "integer" } }
    },
    "schemas": {
      "Idea": {
        "type": "object",
        "required": ["id", "url", "created", "name", "tagline", "features", "price_eur", "images", "votes"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9]{10}$" },
          "url": { "type": "string", "format": "uri", "description": "The idea's page on napkinshot.com." },
          "created": { "type": "string", "format": "date-time" },
          "name": { "type": "string" },
          "tagline": { "type": "string" },
          "features": { "type": "array", "items": { "type": "string" } },
          "price_eur": { "type": "number", "description": "The price the concept names, in euros." },
          "images": { "type": "array", "items": { "$ref": "#/components/schemas/Image" } },
          "votes": { "$ref": "#/components/schemas/Votes" }
        }
      },
      "Image": {
        "type": "object",
        "required": ["kind", "url", "ai_generated"],
        "properties": {
          "kind": { "type": "string", "enum": ["studio", "in_use", "packaging", "detail"] },
          "url": { "type": "string", "format": "uri" },
          "ai_generated": { "const": true, "description": "Every image is an AI-generated concept render, not a photo of a real product. Keep this label." }
        }
      },
      "Votes": {
        "type": "object",
        "required": ["total", "buy", "pass", "buy_rate", "avg_price_eur", "pass_reasons"],
        "properties": {
          "total": { "type": "integer" },
          "buy": { "type": "integer", "description": "Votes that would buy it." },
          "pass": { "type": "integer", "description": "Votes that would pass." },
          "buy_rate": { "type": ["number", "null"], "description": "buy / total, to two decimals; null without votes." },
          "avg_price_eur": { "type": ["number", "null"], "description": "What voters would pay on average, in euros; null if nobody named a price." },
          "pass_reasons": {
            "type": "object",
            "required": ["too_expensive", "dont_need", "already_exists"],
            "properties": {
              "too_expensive": { "type": "integer" },
              "dont_need": { "type": "integer" },
              "already_exists": { "type": "integer" }
            }
          }
        }
      },
      "SearchHit": {
        "allOf": [
          { "$ref": "#/components/schemas/Idea" },
          { "type": "object", "required": ["similarity"], "properties": { "similarity": { "type": "number", "minimum": 0, "maximum": 1, "description": "How close in meaning, from 0 (unrelated) to 1." } } }
        ]
      },
      "Error": {
        "type": "object",
        "required": ["error"],
        "properties": { "error": { "type": "string", "description": "What went wrong, in words." } }
      },
      "Booked": {
        "allOf": [
          { "$ref": "#/components/schemas/Error" },
          { "type": "object", "required": ["booked"], "properties": { "booked": { "const": true, "description": "The day's AI budget is used up; try again tomorrow." } } }
        ]
      }
    },
    "responses": {
      "BadRequest": { "description": "A cursor that isn't valid, or a search without q.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
      "Unauthorized": { "description": "No key, or an unknown or revoked one.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
      "NotFound": { "description": "No public idea with that id, or no such endpoint.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
      "MethodNotAllowed": { "description": "Only GET is supported.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
      "TooManyRequests": { "description": "More than 60 requests a minute, or the key's requests for this month are used up.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
      "Booked": { "description": "Napkinshot's AI budget for the day is used up, which search needs. Try again tomorrow.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Booked" } } } },
      "Unexpected": { "description": "Something broke on our side. Try again in a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
    }
  }
}
