{
  "openapi": "3.1.0",
  "info": {
    "title": "Autocomputing Briefs API",
    "version": "1.0.0",
    "description": "Short, sourced reports on finance, AI and the CRM world. Every brief cites its primary source: SEC filings, federal agencies, and company newsrooms and changelogs.",
    "contact": {"url": "https://autocomputing.systems"}
  },
  "servers": [{"url": "https://autocomputing.systems/v1"}],
  "components": {
    "securitySchemes": {"bearer": {"type": "http", "scheme": "bearer", "description": "A key that starts with acs_. Get one at https://autocomputing.systems/#plans"}},
    "schemas": {
      "Brief": {
        "type": "object",
        "properties": {
          "id": {"type": "integer"},
          "desk": {"type": "string", "enum": ["finance", "ai"]},
          "date": {"type": "string", "format": "date"},
          "headline": {"type": "string"},
          "category": {"type": "string"},
          "source": {"type": "string"},
          "source_url": {"type": "string"},
          "paragraphs": {"type": "array", "items": {"type": "string"}},
          "citation": {"type": "string"},
          "tickers": {"type": "array", "items": {"type": "string"}},
          "tags": {"type": "array", "items": {"type": "object"}},
          "links": {"type": "array", "items": {"type": "object"}},
          "related": {"type": "array", "items": {"type": "object"}}
        }
      },
      "BriefList": {
        "type": "object",
        "properties": {
          "desk": {"type": "string"},
          "briefs": {"type": "array", "items": {"$ref": "#/components/schemas/Brief"}},
          "next_before": {"type": ["string", "null"], "description": "Pass as before= to get the next page."},
          "total": {"type": "integer"},
          "first_date": {"type": ["string", "null"]},
          "last_date": {"type": ["string", "null"]}
        }
      },
      "Error": {"type": "object", "properties": {"error": {"type": "string"}, "message": {"type": "string"}}}
    }
  },
  "paths": {
    "/sample": {
      "get": {
        "summary": "The three newest briefs (free)",
        "parameters": [{"name": "desk", "in": "query", "schema": {"type": "string", "enum": ["finance", "ai"], "default": "finance"}}],
        "responses": {"200": {"description": "Briefs", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BriefList"}}}}}
      }
    },
    "/briefs": {
      "get": {
        "summary": "Briefs, newest first",
        "security": [{"bearer": []}],
        "parameters": [
          {"name": "desk", "in": "query", "schema": {"type": "string", "enum": ["finance", "ai"], "default": "finance"}},
          {"name": "q", "in": "query", "description": "Search words in headline, text, source or tickers", "schema": {"type": "string"}},
          {"name": "before", "in": "query", "schema": {"type": "string", "format": "date"}},
          {"name": "until", "in": "query", "schema": {"type": "string", "format": "date"}},
          {"name": "subject", "in": "query", "schema": {"type": "string"}},
          {"name": "type", "in": "query", "schema": {"type": "string"}},
          {"name": "tag", "in": "query", "description": "kind:key, for example company:salesforce", "schema": {"type": "string"}},
          {"name": "limit", "in": "query", "schema": {"type": "integer", "minimum": 1, "maximum": 60, "default": 30}}
        ],
        "responses": {
          "200": {"description": "Briefs", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/BriefList"}}}},
          "401": {"description": "No key or bad key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}},
          "429": {"description": "Quota used up", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}
        }
      }
    },
    "/briefs/{id}": {
      "get": {
        "summary": "One brief",
        "security": [{"bearer": []}],
        "parameters": [{"name": "id", "in": "path", "required": true, "schema": {"type": "integer"}}],
        "responses": {"200": {"description": "A brief", "content": {"application/json": {"schema": {"type": "object", "properties": {"brief": {"$ref": "#/components/schemas/Brief"}}}}}}, "404": {"description": "Not found"}}
      }
    },
    "/usage": {
      "get": {
        "summary": "Plan and requests used (does not count against the quota)",
        "security": [{"bearer": []}],
        "responses": {"200": {"description": "Usage"}}
      }
    },
    "/plans": {"get": {"summary": "Plans on sale", "responses": {"200": {"description": "Plans"}}}}
  }
}
