{
  "openapi": "3.1.0",
  "info": {
    "title": "ExploreWorldAI agent API",
    "version": "agent-api-v1.0.0",
    "description": "Source-bound answers for AI agents: EU rules, applicability by role, EU statistics, traveller rights, sanctions checks and today's official changes. Every row names its source page and review date. Level 1 is free without a key; a key raises the daily ceiling and freshness.",
    "contact": {
      "name": "Valkiv Ventures AB",
      "email": "stig@valkiv.com",
      "url": "https://exploreworldai.com/developers"
    },
    "license": {
      "name": "Quote with a link to the source page",
      "url": "https://exploreworldai.com/terms"
    }
  },
  "servers": [
    {
      "url": "https://guhdexlcewpmmqcgscvt.supabase.co/functions/v1/agent-api/v1"
    }
  ],
  "externalDocs": {
    "url": "https://exploreworldai.com/developers"
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "schemas": {
      "Envelope": {
        "type": "object",
        "required": [
          "status",
          "data",
          "warnings",
          "error",
          "meta"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "error"
            ]
          },
          "data": {},
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": [
              "object",
              "null"
            ]
          },
          "meta": {
            "type": "object"
          }
        }
      },
      "PaymentRequired": {
        "type": "object",
        "required": [
          "error",
          "status",
          "message",
          "upgrade_url"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "enum": [
              402
            ]
          },
          "message": {
            "type": "string"
          },
          "upgrade_url": {
            "type": "string",
            "format": "uri"
          },
          "terms": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    }
  },
  "security": [
    {},
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/rules": {
      "get": {
        "operationId": "rules",
        "summary": "EU rules",
        "description": "Find EU law articles and rule pages (GDPR, AI Act, DSA, DMA, PSD2 and more) by words, each with its EUR-Lex based page and review date. Source: /data/omrade/eu.jsonl, /data/omrade/ovrigt.jsonl.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Words to look for, e.g. 'gdpr article 6'.",
            "example": "gdpr article 6",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Page language: en, sv, no or de. Default en.",
            "example": "en",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "sv",
                "no",
                "de"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum rows, 1 to 25. Default 10.",
            "example": "10",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rows in the fixed envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "402": {
            "description": "Daily ceiling reached. The body carries upgrade_url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequired"
                }
              }
            }
          }
        }
      }
    },
    "/applies": {
      "get": {
        "operationId": "applies",
        "summary": "Does it apply to us?",
        "description": "Rules by role in the supply chain (provider, importer, distributor, platform, cloud provider) and topic, with the short answer and the page that cites the articles. Source: /data/omrade/compliance.jsonl.",
        "parameters": [
          {
            "name": "role",
            "in": "query",
            "required": true,
            "description": "Role words, e.g. 'importer' or 'cloud provider'.",
            "example": "importer",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "topic",
            "in": "query",
            "required": false,
            "description": "Topic words, e.g. 'ai' or 'product safety'.",
            "example": "ai",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum rows, 1 to 25. Default 10.",
            "example": "10",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rows in the fixed envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "402": {
            "description": "Daily ceiling reached. The body carries upgrade_url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequired"
                }
              }
            }
          }
        }
      }
    },
    "/stats": {
      "get": {
        "operationId": "stats",
        "summary": "EU statistics",
        "description": "Eurostat figures per country and measure (GDP per inhabitant, employment, prices, unemployment, population), with comparisons and the Eurostat source. Source: /data/omrade/eu.jsonl, /data/omrade/statistik.jsonl.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Country and measure, e.g. 'germany unemployment'.",
            "example": "germany unemployment",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Page language: en, sv, no or de. Default en.",
            "example": "en",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "sv",
                "no",
                "de"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum rows, 1 to 25. Default 10.",
            "example": "10",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rows in the fixed envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "402": {
            "description": "Daily ceiling reached. The body carries upgrade_url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequired"
                }
              }
            }
          }
        }
      }
    },
    "/traveller": {
      "get": {
        "operationId": "traveller",
        "summary": "Traveller rights",
        "description": "Air passenger rights, delays, cancellations, entry and visa questions in Europe, answered from the official regulation and authority pages. Source: /data/omrade/ovrigt.jsonl.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "description": "Words, e.g. 'flight cancelled compensation'.",
            "example": "flight cancelled",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Page language: en, sv, no or de. Default en.",
            "example": "en",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "sv",
                "no",
                "de"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum rows, 1 to 25. Default 10.",
            "example": "10",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rows in the fixed envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "402": {
            "description": "Daily ceiling reached. The body carries upgrade_url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequired"
                }
              }
            }
          }
        }
      }
    },
    "/sanctions": {
      "get": {
        "operationId": "sanctions",
        "summary": "Sanctions check",
        "description": "Check a name against the EU consolidated list, the UN Security Council list and the US OFAC SDN list. Returns listed rows exactly as the list writes them. Source: /sanktioner/listor/eu.json, /sanktioner/listor/fn.json, OFAC SDN.",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": true,
            "description": "Name of a person or entity, at least 3 letters.",
            "example": "Al-Nuaymi",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum rows, 1 to 25. Default 10.",
            "example": "10",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rows in the fixed envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "402": {
            "description": "Daily ceiling reached. The body carries upgrade_url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequired"
                }
              }
            }
          }
        }
      }
    },
    "/today": {
      "get": {
        "operationId": "today",
        "summary": "Today's changes",
        "description": "What changed today: ECB reference rates, new EU Safety Gate alerts, OFAC additions and removals, and the count of pages whose read text changed. Source: ECB, EU Safety Gate, OFAC SDN, /andringar-dygn.txt.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Rows in the fixed envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "402": {
            "description": "Daily ceiling reached. The body carries upgrade_url.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentRequired"
                }
              }
            }
          }
        }
      }
    },
    "/mcp-factory": {
      "post": {
        "operationId": "generate_mcp_server",
        "summary": "Generate an MCP server from CSV or JSON",
        "description": "Send product, compliance or risk data as CSV or JSON and get a runnable Node.js MCP server with Dockerfile and README as a zip, or as JSON with format=json. Nothing is stored. Free, at most 2 MB and 5 000 rows.",
        "servers": [
          {
            "url": "https://guhdexlcewpmmqcgscvt.supabase.co/functions/v1"
          }
        ],
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": false,
            "description": "Server name",
            "schema": {
              "type": "string",
              "maxLength": 80
            }
          },
          {
            "name": "input",
            "in": "query",
            "required": false,
            "description": "csv or json; guessed when absent",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json"
              ]
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "description": "json returns the files as JSON instead of a zip",
            "schema": {
              "type": "string",
              "enum": [
                "json"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "text/csv": {
              "schema": {
                "type": "string"
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "format",
                  "data"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "csv",
                      "json"
                    ]
                  },
                  "data": {}
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A zip with package.json, index.js, data.json, Dockerfile and README.md, or the envelope with files.",
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "429": {
            "description": "Hourly or daily ceiling reached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          }
        }
      }
    }
  }
}
