{
  "openapi": "3.1.0",
  "info": {
    "title": "Cogundi Index for AI agents",
    "version": "1.0",
    "description": "Search Dutch and French companies, read their profiles with sources, ask a question about a company, or ask which company in a Dutch municipality fits a question. Answers come from the profile only; unknown means the company has not shared it. Cite profile_url."
  },
  "servers": [
    {
      "url": "https://www.cogundi.com/api/agents"
    }
  ],
  "paths": {
    "/search": {
      "get": {
        "operationId": "searchCompanies",
        "summary": "Search companies by name, trade or place",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Name, trade or place",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "place",
            "in": "query",
            "required": false,
            "description": "Town",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "trade",
            "in": "query",
            "required": false,
            "description": "Trade slug",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "NL or FR",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "score: highest AI visibility first",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "description": "nl, en or fr",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching companies"
          }
        }
      }
    },
    "/companies/{slug}": {
      "get": {
        "operationId": "getCompany",
        "summary": "A company profile with sources and what is still unknown",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "description": "nl, en or fr",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The profile"
          },
          "404": {
            "description": "Unknown company"
          }
        }
      }
    },
    "/companies/{slug}/ask": {
      "get": {
        "operationId": "askCompany",
        "summary": "Ask a question about a company; answered from the profile, or unknown",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "The question, e.g. \"Werken jullie in Utrecht?\"",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "locale",
            "in": "query",
            "required": false,
            "description": "nl, en or fr",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching answers with sources, or unknown"
          }
        }
      },
      "post": {
        "operationId": "askCompanyJson",
        "summary": "Ask a question about a company as JSON",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "question": {
                    "type": "string"
                  },
                  "locale": {
                    "type": "string"
                  }
                },
                "required": [
                  "question"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Matching answers with sources, or unknown"
          }
        }
      }
    },
    "/cities/{slug}": {
      "get": {
        "operationId": "getCity",
        "summary": "A Dutch municipality: its region, the questions people there ask AI per trade, and its companies in the Index",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The municipality"
          },
          "404": {
            "description": "Unknown municipality"
          }
        }
      }
    },
    "/cities/{slug}/ask": {
      "get": {
        "operationId": "askCity",
        "summary": "Ask which company in a municipality fits a question, e.g. \"Welke loodgieter in Zaanstad kan vandaag nog komen?\"",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "The question",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Companies from the Index for that place and trade, or none"
          }
        }
      }
    }
  }
}