{
  "openapi": "3.1.0",
  "info": {
    "title": "technic.dev Public Agent API",
    "version": "1.0.0",
    "description": "Open, read-only and subscription API for technic.dev AI newsletters. Free and rate-limited. MCP server available at /mcp.",
    "contact": {
      "name": "Technic Intelligence, Inc.",
      "email": "hello@technic.dev",
      "url": "https://technic.dev/agents/"
    }
  },
  "servers": [
    {
      "url": "https://technic.dev"
    }
  ],
  "paths": {
    "/api/v1/newsletters": {
      "get": {
        "operationId": "listNewsletters",
        "summary": "List active technic.dev newsletters",
        "responses": {
          "200": {
            "description": "Array of active newsletters with latest issue metadata and machine URLs"
          }
        }
      }
    },
    "/api/v1/issues": {
      "get": {
        "operationId": "listIssues",
        "summary": "List public published issues",
        "parameters": [
          {
            "name": "newsletter",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ai"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "since",
            "in": "query",
            "description": "ISO date YYYY-MM-DD",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public issue summaries"
          }
        }
      }
    },
    "/api/v1/issues/{slug}/latest": {
      "get": {
        "operationId": "getLatestIssue",
        "summary": "Get the latest public issue for a newsletter",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "markdown"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Latest issue JSON or Markdown"
          },
          "404": {
            "description": "No public issue found"
          }
        }
      }
    },
    "/api/v1/issues/{slug}/{ref}": {
      "get": {
        "operationId": "getIssue",
        "summary": "Get a specific public issue by date (YYYY-MM-DD) or issue number",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "description": "Date (YYYY-MM-DD) or issue number",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "markdown"
              ],
              "default": "json"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Issue JSON or Markdown"
          },
          "404": {
            "description": "Issue not found"
          }
        }
      }
    },
    "/api/v1/search": {
      "get": {
        "operationId": "searchIssues",
        "summary": "Semantic search over published issue scenes",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 240
            }
          },
          {
            "name": "newsletter",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 3650
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 25,
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked matching scenes with issue URLs, anchors, and primary source links"
          }
        }
      }
    },
    "/api/v1/briefing": {
      "post": {
        "operationId": "getBriefing",
        "summary": "Personal briefing: stories from recent issues that match one reader's interests and work",
        "description": "Ranks the stories of the public issues in the window against each interest and the optional context. Every interest with news gets its best story; interests with none are listed in no_news_on. The context is used for this request only and never stored.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "interests": {
                    "type": "string",
                    "maxLength": 800,
                    "description": "Comma-separated topics, e.g. 'coding agents, EU AI Act'. Empty for the newest stories."
                  },
                  "context": {
                    "type": "string",
                    "maxLength": 600,
                    "description": "A sentence or two about the reader's work"
                  },
                  "role": {
                    "type": "string",
                    "maxLength": 80
                  },
                  "days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 90,
                    "default": 7
                  },
                  "since": {
                    "type": "string",
                    "description": "YYYY-MM-DD; overrides days"
                  },
                  "newsletter": {
                    "type": "string"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 20,
                    "default": 8
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ranked items with story URLs, why it matters, takeaways and primary sources; issues covered; interests with no news; writing instructions"
          }
        }
      },
      "get": {
        "operationId": "getBriefingByQuery",
        "summary": "Personal briefing by query string (use POST to send context)",
        "parameters": [
          {
            "name": "interests",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 800
            }
          },
          {
            "name": "role",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 90,
              "default": 7
            }
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "newsletter",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 20,
              "default": 8
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Same as POST"
          }
        }
      }
    },
    "/api/v1/sources": {
      "get": {
        "operationId": "searchSources",
        "summary": "Search verified primary sources cited in published technic.dev issues",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 240
            }
          },
          {
            "name": "topic",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entity",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "newsletter",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 30,
              "default": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cited primary sources with summaries, entities, topics, and citing issue URLs"
          }
        }
      }
    },
    "/api/v1/subscribe": {
      "post": {
        "operationId": "subscribeNewsletter",
        "summary": "Subscribe an email address to a newsletter (sends double opt-in confirmation)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "newsletter": {
                    "type": "string",
                    "default": "ai"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Confirmation email queued or already subscribed"
          },
          "429": {
            "description": "Rate limited"
          }
        }
      }
    },
    "/api/v1/webhooks": {
      "post": {
        "operationId": "registerWebhook",
        "summary": "Register an HTTPS webhook for issue.published events (requires synchronous challenge echo)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  },
                  "newsletter": {
                    "type": "string",
                    "default": "*",
                    "description": "Newsletter slug or '*' for all newsletters"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Webhook active; returns id and one-time HMAC signing secret"
          },
          "400": {
            "description": "Invalid URL or challenge verification failed"
          }
        }
      }
    },
    "/api/v1/webhooks/{id}": {
      "delete": {
        "operationId": "deleteWebhook",
        "summary": "Remove a webhook subscription (authenticate with Authorization: Bearer <secret>)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook deleted"
          },
          "401": {
            "description": "Invalid secret"
          }
        }
      }
    }
  }
}
