{
 "openapi": "3.1.0",
 "info": {
  "title": "PrompTugal.news Civic API",
  "version": "v0.1.26",
  "description": "Read-only GET calls, static JSON files. Independent: not a government or official API. Public procurement of the Algarve's 16 councils from IMPIC's open data, where each council publishes its decisions, and public-service guides from official pages. Every value carries its source and the date read.",
  "license": {
   "name": "CC BY 4.0",
   "url": "https://creativecommons.org/licenses/by/4.0/"
  }
 },
 "servers": [
  {
   "url": "https://civic.promptugal.news"
  }
 ],
 "paths": {
  "/api/v1/index.json": {
   "get": {
    "summary": "The list of endpoints",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/v1/councils.json": {
   "get": {
    "summary": "The 16 Algarve councils, with 2026 totals",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/v1/councils/{id}.json": {
   "get": {
    "summary": "One council: contracts 2026 and 2025 by procedure, top suppliers, where its minutes, agendas, notices and budget are published",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Council"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/v1/companies.json": {
   "get": {
    "summary": "Companies with contracts at three or more councils in 2026",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/v1/companies/{nif}.json": {
   "get": {
    "summary": "One company: its contracts with the Algarve councils in 2026",
    "parameters": [
     {
      "name": "nif",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/v1/services.json": {
   "get": {
    "summary": "Public-service guides and which office does what",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/v1/services/{id}.json": {
   "get": {
    "summary": "One guide, step by step, with official pages",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/v1/procurement/summary.json": {
   "get": {
    "summary": "Totals for the 16 councils, 2026 and 2025",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/v1/municipal-companies.json": {
   "get": {
    "summary": "The councils' municipal companies, with their contracts by procedure, 2026 and 2025",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/v1/billing/meter.json": {
   "get": {
    "summary": "The reading meter's prices for this site",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/data/procurement/base-2026.json": {
   "get": {
    "summary": "Every 2026 contract of the 16 councils (large)",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object"
        }
       }
      }
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "Council": {
    "type": "object",
    "required": [
     "id",
     "name",
     "contracts_2026",
     "sources"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "nif": {
      "type": [
       "string",
       "null"
      ]
     },
     "contracts_2026": {
      "type": "object"
     },
     "contracts_2025": {
      "type": "object"
     },
     "top_suppliers_2026": {
      "type": "array"
     },
     "where_published": {
      "type": "object"
     },
     "sources": {
      "type": "array"
     }
    }
   }
  }
 }
}
