{
  "openapi": "3.1.0",
  "info": {
    "title": "FundingRadar API",
    "version": "1.0.0",
    "x-tokenFormat": "`fdr_` followed by 28 URL-safe characters: 32 characters, 168 bits. The prefix is `fdr_` and not `fr_` on purpose — this host answers its own `404 Not Found`, before PHP runs, for a `fr_` value in a token header on `api/v1/*.php` (measured 2026-10-09, reproducible; `fz_`, `fdr_`, `fnd_`, `has_` and unprefixed values alike reached PHP). Tokens minted with `fr_` still authenticate. If you ever get a host 404 with a valid token, try the other accepted header and check `src/ApiToken.php` first.",
    "summary": "Read-only access to HAS green academy funding calls, matched research groups and funders.",
    "description": "The FundingRadar API exposes the funding calls that the daily pipeline collects and extracts, together with the matches it computed for the research groups (lectoraten).\n\n**Read-only.** Every endpoint issues SELECT queries. There is no endpoint that changes data; feedback, favourites and group management stay in the web application.\n\n**Authentication.** A personal API token, sent as either `Authorization: Bearer <token>` or `X-API-Token: <token>`. Create, name and revoke tokens in the web application under *Settings → API access*. A token has the same read access as the account that owns it, and keeps working after that account logs out — which is exactly why creating one asks for the password again.\n\n**Platform note (measured 2026-10-09).** nginx, in front of the app, answers its own `404 Not Found` — before PHP runs — on requests to `api/v1/*.php` that carry a `fr_`-prefixed token value in a token header, while `fz_`, `fdr_`, `fnd_`, `has_` and unprefixed values of the same shape reached PHP, and so did the same `fr_` value sent as a query parameter. The prefix is therefore `fdr_`; a host 404 with a valid token is a host problem, not a bad token. See `x-tokenFormat`.\n\n**Not for browsers.** No CORS headers are sent, so a page in a browser cannot call this API. Use it from a script, a server or an MCP client.\n\n**Defaults.** `calls` answers with calls that can still be acted on: a closed round (`closed`, `intake_closed`) or a deadline that has passed is left out. `include_closed=1` returns the archive, and naming an explicit `status` lifts the default too. Also hidden: calls classified as not eligible for HAS and calls with a deadline before 2020 — pass `include_ineligible=1` for the first group; an explicit `deadline_after` replaces the 2020 cut-off. The same definition of \"still actionable\" drives the research-group counts (`matched_open_calls`).\n\n**Errors.** Failures answer with a non-2xx status and `{\"error\": \"...\"}`. Parameter mistakes are `422` with a message that names the parameter, so a client knows what to fix."
  },
  "servers": [
    {
      "url": "/",
      "description": "This FundingRadar installation. The documentation page rewrites this to the path it is served from."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "basicAuth": []
    },
    {
      "apiTokenHeader": []
    },
    {
      "xFundingRadarToken": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Personal API token from Settings → API access. Format: `fdr_` followed by 28 URL-safe characters (32 in total). The standard form and the first one the MCP client tries."
      },
      "basicAuth": {
        "type": "http",
        "scheme": "basic",
        "description": "The same token as the **username** with an empty password (`base64(\"fdr_…:\")`). Accepted because the host in front of the app refuses token-shaped values in some headers, and base64 hides the shape from it. Not a place to put a real account password."
      },
      "apiTokenHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Token",
        "description": "The same token in a custom header. Accepted for scripts that follow the older convention; this is also the name the production host most often filters, so the MCP client does not use it."
      },
      "xFundingRadarToken": {
        "type": "apiKey",
        "in": "header",
        "name": "X-FundingRadar-Token",
        "description": "The same token in a neutral header name — the MCP client's last fallback when the host turns the other two away."
      }
    },
    "parameters": {
      "limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 20
        },
        "description": "Page size."
      },
      "offset": {
        "name": "offset",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 0,
          "default": 0
        },
        "description": "Number of rows to skip."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable reason; names the offending parameter for 422s."
          },
          "details": {
            "type": "object",
            "additionalProperties": true,
            "description": "Present for some failures."
          }
        },
        "example": {
          "error": "deadline_after must be an ISO date (YYYY-MM-DD)"
        }
      },
      "Token": {
        "type": "object",
        "description": "A personal API token. The secret itself is never returned here; only the display prefix.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "token_prefix": {
            "type": "string",
            "description": "First 12 characters of the secret, for recognition."
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read"
              ]
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_used_ip": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "null means the token never expires."
          },
          "revoked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "is_active": {
            "type": "boolean"
          }
        }
      },
      "Call": {
        "type": "object",
        "description": "A funding call, as the dashboard shows it. Large scrape payloads and internal dedup keys are not exposed.",
        "properties": {
          "id": {
            "type": "integer"
          },
          "public_id": {
            "type": "string",
            "format": "uuid",
            "description": "Use this in URLs and deep links; the numeric id is accepted too."
          },
          "title": {
            "type": "string"
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "description": "Funder short name as stored on the call (e.g. ZonMw, RVO, EU Portal)."
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "open",
              "upcoming",
              "closed",
              "intake_closed",
              null
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "apply_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "call_document_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "tracked_url": {
            "type": "string",
            "format": "uri",
            "description": "The same destination through this application's click counter (/api/click.php): a click is logged in email_click_log and shows up in the admin's Click Analytics with utm_source=mcp. Hand this one to people; use url to read the page itself.",
            "example": "https://dilab.has.nl/showcases/fundingradar/api/click.php?call_id=1234&type=call&user_id=5&utm_source=mcp&utm_medium=agent&utm_content=call_link"
          },
          "tracked_apply_url": {
            "type": "string",
            "format": "uri",
            "description": "Like tracked_url, but for apply_url; present only when the call has a separate application page.",
            "example": "https://dilab.has.nl/showcases/fundingradar/api/click.php?call_id=1234&type=apply&user_id=5&utm_source=mcp&utm_medium=agent&utm_content=apply_link"
          },
          "screenshot_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "language": {
            "type": [
              "string",
              "null"
            ],
            "description": "Mostly nl or en; sometimes empty."
          },
          "call_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "application_rounds": {
            "type": [
              "string",
              "null"
            ]
          },
          "open_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "next_round_open_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "deadline_eoi": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "deadline": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "The field to filter on."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "funding_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free text; almost always grant."
          },
          "geo_scope": {
            "type": [
              "string",
              "null"
            ]
          },
          "funder": {
            "type": [
              "string",
              "null"
            ]
          },
          "program": {
            "type": [
              "string",
              "null"
            ]
          },
          "themes": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "disciplines": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "focus_areas": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Canonical values are onderzoek, onderwijs and zakelijke_dienstverlening. The pipeline also writes free text here."
          },
          "for_specific_groups": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "budget_max": {
            "type": [
              "number",
              "null"
            ]
          },
          "budget_min": {
            "type": [
              "number",
              "null"
            ]
          },
          "budget_total_call": {
            "type": [
              "number",
              "null"
            ]
          },
          "cofinancing_required": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "cofinancing_min": {
            "type": [
              "number",
              "null"
            ]
          },
          "cofinancing_percentage": {
            "type": [
              "number",
              "null"
            ]
          },
          "project_duration_months_min": {
            "type": [
              "integer",
              "null"
            ]
          },
          "project_duration_months_max": {
            "type": [
              "integer",
              "null"
            ]
          },
          "consortium_required": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "consortium_min_size": {
            "type": [
              "integer",
              "null"
            ]
          },
          "applicant_type": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "applicant_scope": {
            "type": [
              "string",
              "null"
            ]
          },
          "eligibility_criteria": {
            "type": [
              "array",
              "object",
              "null"
            ]
          },
          "contact_details": {
            "type": [
              "object",
              "null"
            ],
            "additionalProperties": true
          },
          "assessment_duration_months": {
            "type": [
              "integer",
              "null"
            ]
          },
          "assessment_info": {
            "type": [
              "string",
              "null"
            ]
          },
          "eoi_required": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "has_eligibility": {
            "type": [
              "string",
              "null"
            ],
            "description": "The pipeline's verdict on HAS eligibility; 'not_eligible' calls are hidden by default."
          },
          "eligibility_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "urgency": {
            "type": [
              "string",
              "null"
            ],
            "description": "Derived from the deadline: EXPIRED, PLAN, HOT or WATCH."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "research_group_count": {
            "type": "integer",
            "description": "Number of research groups this call was matched to (list endpoint only)."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Tag"
            },
            "description": "List and detail endpoints."
          },
          "research_groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResearchGroupRef"
            },
            "description": "List endpoint: id and name per matched group."
          },
          "is_favorited": {
            "type": "boolean",
            "description": "Whether the token's own account has bookmarked this call."
          }
        }
      },
      "ResearchGroupRef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          }
        }
      },
      "ResearchGroup": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string",
            "description": "Stable identifier; use it in ?research_group= filters."
          },
          "short_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "full_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "homepage_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact_email": {
            "type": [
              "string",
              "null"
            ],
            "description": "Contact person for the group. Personal data — use it only where that is appropriate."
          },
          "is_internal": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "is_professorship": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "true for the lectoraten."
          },
          "member_count": {
            "type": "integer"
          },
          "call_count": {
            "type": "integer",
            "description": "All matched calls, including closed ones."
          },
          "matched_open_calls": {
            "type": "integer",
            "description": "Matched calls whose status is not closed."
          },
          "theme_count": {
            "type": "integer"
          },
          "last_notified_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Last time a digest e-mail mentioned one of this group's matched calls."
          }
        }
      },
      "ResearchGroupMatch": {
        "type": "object",
        "description": "A call matched to a research group, including why the pipeline matched it and whether the group was notified.",
        "properties": {
          "call_id": {
            "type": "integer"
          },
          "research_group_id": {
            "type": "integer"
          },
          "public_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "deadline": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "tracked_url": {
            "type": "string",
            "format": "uri",
            "description": "The same destination through this application's click counter (/api/click.php): a click is logged in email_click_log and shows up in the admin's Click Analytics with utm_source=mcp. Hand this one to people; use url to read the page itself.",
            "example": "https://dilab.has.nl/showcases/fundingradar/api/click.php?call_id=1234&type=call&user_id=5&utm_source=mcp&utm_medium=agent&utm_content=call_link"
          },
          "focus_areas": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "matched_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "auto_gpt or manual."
          },
          "match_reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the pipeline judged this call relevant for the group."
          },
          "email_sent": {
            "type": "boolean"
          },
          "notified_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "Source": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "short_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "website_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "funder_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "active": {
            "type": "boolean"
          },
          "link_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Health of the scrape URL as last checked."
          },
          "last_checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "scrape_priority": {
            "type": "integer"
          },
          "call_count": {
            "type": "integer"
          }
        }
      },
      "Tag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "call_count": {
            "type": "integer"
          }
        }
      },
      "Theme": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "research_group_id": {
            "type": "integer"
          },
          "research_group_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_active": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "researcher_count": {
            "type": "integer"
          },
          "call_count": {
            "type": "integer"
          },
          "call_id": {
            "type": "integer",
            "description": "Present when the theme is returned for one call."
          },
          "matched_by": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "StatsBucket": {
        "type": "object",
        "properties": {
          "group_key": {
            "type": "string"
          },
          "call_count": {
            "type": "integer"
          }
        }
      }
    }
  },
  "paths": {
    "/api/v1/me.php": {
      "get": {
        "operationId": "getMe",
        "summary": "Who is calling",
        "description": "The account behind the token, the token's own metadata and the research groups that account is linked to. Useful as a first call to validate a token.",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The caller.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "user": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "integer"
                            },
                            "email": {
                              "type": "string"
                            },
                            "role": {
                              "type": "string",
                              "enum": [
                                "user",
                                "group_lead",
                                "admin"
                              ]
                            },
                            "email_frequency": {
                              "type": "string",
                              "enum": [
                                "daily",
                                "weekly",
                                "off"
                              ]
                            },
                            "created_at": {
                              "type": [
                                "string",
                                "null"
                              ],
                              "format": "date-time"
                            },
                            "research_groups": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "additionalProperties": true
                              }
                            }
                          }
                        },
                        "token": {
                          "$ref": "#/components/schemas/Token"
                        },
                        "limits": {
                          "type": "object",
                          "properties": {
                            "active_tokens": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. See the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/calls.php": {
      "get": {
        "operationId": "searchCalls",
        "summary": "Search funding calls",
        "description": "Search and filter the funding calls. The query builder is the same one the dashboard uses, so the API and the web app agree on what counts as a match.",
        "tags": [
          "Calls"
        ],
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "Free text to search for. Every word must match, so send a subject rather than a question — and the search is expanded by default: the words themselves, their Dutch/English equivalents and the variants HAS works with, OR-combined over title, description, funder, programme and the call's own URLs (see `literal`). Named `query` and not `q` because the host in front of the app answers its own 404 on `calls.php?q=…`; `q` is still accepted as an alias when it gets through. A POST with a JSON body carrying the same fields is accepted, and that is the way to send a search: the host in front of the app answers its own 404 on a query string that would run the expanded search."
          },
          {
            "name": "literal",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Search `q` exactly as given, without turning it into terms. Default is off: a search expands `q` into the words themselves, their Dutch/English equivalents and the variants HAS works with, OR-combined over title, description, funder, programme and the call's own URLs — without that a whole paragraph finds nothing, because every word of `q` must match. `meta.expanded_terms` shows what was searched. The dashboard does not use this endpoint, so its search is unchanged. The flag is an opt-out because the host in front of the app blocks a parameter named `expand` next to `q` (see docs/api-v1.md)."
          },
          {
            "name": "source",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Funder by short name or full name, e.g. ZonMw. Case-insensitive; unknown values answer 404."
          },
          {
            "name": "source_id",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Funder by id, instead of source."
          },
          {
            "name": "research_group",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Research group by slug or name, e.g. green-health. Only calls matched to that group; unknown values answer 404."
          },
          {
            "name": "research_group_id",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": "Research group by id, instead of research_group."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "upcoming",
                "closed",
                "intake_closed"
              ]
            },
            "description": "Call status. Validated against the statuses present in the database."
          },
          {
            "name": "tag",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Tag name, e.g. AI."
          },
          {
            "name": "focus_area",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "onderzoek",
                "onderwijs",
                "zakelijke_dienstverlening"
              ]
            },
            "description": "One or more comma-separated canonical focus areas. Other values are rejected: the column also holds free text, which would give a misleading result."
          },
          {
            "name": "deadline_after",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Only calls with a deadline on or after this date. Overrides the default 'hide pre-2020' cut-off."
          },
          {
            "name": "deadline_before",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Only calls with a deadline on or before this date."
          },
          {
            "name": "include_closed",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Also return calls that are closed or past their deadline. Off by default: the endpoint answers with calls that can still be acted on. Naming an explicit status also lifts this default."
          },
          {
            "name": "include_ineligible",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Include calls the pipeline classified as not eligible for HAS."
          },
          {
            "name": "favorites_only",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Only calls bookmarked by the token's own account."
          },
          {
            "name": "sort_by",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "deadline_asc",
              "enum": [
                "deadline_asc",
                "deadline_strict",
                "deadline_desc",
                "created_at_desc",
                "created_at_asc",
                "title_asc",
                "title_desc",
                "budget_desc",
                "budget_asc",
                "status_priority"
              ]
            },
            "description": "Result order. deadline_asc puts the nearest deadline first, without a deadline last."
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of calls.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Call"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "description": "Rows matching the filter, not the size of this page."
                        },
                        "count": {
                          "type": "integer"
                        },
                        "limit": {
                          "type": "integer"
                        },
                        "offset": {
                          "type": "integer"
                        },
                        "has_more": {
                          "type": "boolean"
                        },
                        "filters": {
                          "type": "object",
                          "additionalProperties": true,
                          "description": "The filters as applied, so a client can echo them back."
                        },
                        "actionable_only": {
                          "type": "boolean",
                          "description": "True when the server applied the 'still actionable' default (not closed, deadline not passed)."
                        },
                        "expanded": {
                          "type": "boolean",
                          "description": "True when `q` was turned into search terms."
                        },
                        "expanded_terms": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "The terms actually searched, in the order they came from the question."
                        },
                        "literal": {
                          "type": "boolean",
                          "description": "True when the caller asked for an exact search."
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": 7529,
                      "public_id": "5923a56c-c8ce-4155-9c57-58b3a59c062a",
                      "title": "Onderzoeksconsortia voor passend zorgaanbod over de gehele zorgketen",
                      "source": "ZonMw",
                      "status": "open",
                      "deadline": "2026-10-20",
                      "open_date": "2026-07-28",
                      "urgency": "HOT",
                      "funding_type": "grant",
                      "language": "nl",
                      "focus_areas": [],
                      "research_group_count": 2,
                      "tags": [
                        {
                          "id": 4,
                          "name": "Gezondheid"
                        }
                      ],
                      "research_groups": [
                        {
                          "id": 7,
                          "name": "Groene Gezondheid"
                        }
                      ],
                      "is_favorited": false
                    }
                  ],
                  "meta": {
                    "total": 42,
                    "count": 1,
                    "limit": 20,
                    "offset": 0,
                    "has_more": true
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown source or research group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "A parameter has an invalid value.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded. See the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/call.php": {
      "get": {
        "operationId": "getCall",
        "summary": "One funding call",
        "description": "The full record plus the matched research groups (with the match reason and e-mail status), the matched research themes and the tags.",
        "tags": [
          "Calls"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The public UUID or the numeric call id."
          }
        ],
        "responses": {
          "200": {
            "description": "The call with its relations.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "call": {
                          "$ref": "#/components/schemas/Call"
                        },
                        "research_groups": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ResearchGroupMatch"
                          }
                        },
                        "themes": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Theme"
                          }
                        },
                        "tags": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Tag"
                          }
                        },
                        "is_favorited": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No call with that id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "id is missing or not a UUID / numeric id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/research_groups.php": {
      "get": {
        "operationId": "listResearchGroups",
        "summary": "Research groups, or one group with its matched calls",
        "description": "Without parameters: all research groups with their counts. With `slug`: that group plus the calls the pipeline matched to it — the endpoint behind 'what is relevant for our lectoraat'.",
        "tags": [
          "Research groups"
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Research group slug or name. Unknown values answer 404, which is different from 'matched no calls'."
          },
          {
            "name": "include_closed",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "With slug: also return matches whose call is closed."
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/offset"
          }
        ],
        "responses": {
          "200": {
            "description": "Groups, or one group with matches.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ResearchGroup"
                          }
                        },
                        "meta": {
                          "type": "object",
                          "properties": {
                            "count": {
                              "type": "integer"
                            }
                          }
                        }
                      }
                    },
                    {
                      "type": "object",
                      "properties": {
                        "data": {
                          "type": "object",
                          "properties": {
                            "research_group": {
                              "$ref": "#/components/schemas/ResearchGroup"
                            },
                            "matches": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/ResearchGroupMatch"
                              }
                            }
                          }
                        },
                        "meta": {
                          "type": "object",
                          "properties": {
                            "total": {
                              "type": "integer"
                            },
                            "count": {
                              "type": "integer"
                            },
                            "limit": {
                              "type": "integer"
                            },
                            "offset": {
                              "type": "integer"
                            },
                            "has_more": {
                              "type": "boolean"
                            },
                            "include_closed": {
                              "type": "boolean"
                            }
                          }
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown research group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/sources.php": {
      "get": {
        "operationId": "listSources",
        "summary": "Funding sources",
        "description": "The funders that are scraped, with how many calls each has contributed.",
        "tags": [
          "Sources"
        ],
        "parameters": [
          {
            "name": "active_only",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Only sources with active = true."
          }
        ],
        "responses": {
          "200": {
            "description": "The funders.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Source"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer"
                        },
                        "active_only": {
                          "type": "boolean"
                        },
                        "total_calls": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stats.php": {
      "get": {
        "operationId": "getFundingStats",
        "summary": "Call counts per bucket",
        "description": "Counts grouped by source, month, status, language, funding_type, focus_area or research_group, limited to calls created in the last `months` months. Beware two things: research_group counts a call once per group it matched, so those buckets do not add up to distinct calls; and focus_area is capped at 200 buckets because the column also holds free text.",
        "tags": [
          "Statistics"
        ],
        "parameters": [
          {
            "name": "group_by",
            "in": "query",
            "schema": {
              "type": "string",
              "default": "source",
              "enum": [
                "source",
                "month",
                "status",
                "language",
                "funding_type",
                "focus_area",
                "research_group"
              ]
            },
            "description": "How to group the counts."
          },
          {
            "name": "months",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 120,
              "default": 12
            },
            "description": "Only count calls created in the last N months."
          }
        ],
        "responses": {
          "200": {
            "description": "Buckets, ordered by count descending.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "buckets": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/StatsBucket"
                          }
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "group_by": {
                          "type": "string"
                        },
                        "months": {
                          "type": "integer"
                        },
                        "bucket_count": {
                          "type": "integer"
                        },
                        "counted_calls": {
                          "type": "integer"
                        },
                        "bucket_limit": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                },
                "example": {
                  "data": {
                    "buckets": [
                      {
                        "group_key": "RVO",
                        "call_count": 1302
                      },
                      {
                        "group_key": "EU Portal",
                        "call_count": 1140
                      }
                    ]
                  },
                  "meta": {
                    "group_by": "source",
                    "months": 12,
                    "bucket_count": 31,
                    "counted_calls": 4434,
                    "bucket_limit": 200
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Unknown group_by, or months out of range.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tags.php": {
      "get": {
        "operationId": "listTags",
        "summary": "Tags with call counts",
        "tags": [
          "Tags"
        ],
        "responses": {
          "200": {
            "description": "All tags.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Tag"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/themes.php": {
      "get": {
        "operationId": "listThemes",
        "summary": "Research themes",
        "description": "All research themes, or the themes of one research group.",
        "tags": [
          "Research groups"
        ],
        "parameters": [
          {
            "name": "research_group",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Research group slug or name."
          }
        ],
        "responses": {
          "200": {
            "description": "Themes.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Theme"
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "integer"
                        },
                        "research_group": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, malformed, revoked or expired token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Unknown research group.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Account",
      "description": "The token and the account behind it."
    },
    {
      "name": "Calls",
      "description": "Funding calls."
    },
    {
      "name": "Research groups",
      "description": "Lectoraten, their themes and their matched calls."
    },
    {
      "name": "Sources",
      "description": "The funders that are scraped."
    },
    {
      "name": "Statistics",
      "description": "Aggregated counts."
    },
    {
      "name": "Tags",
      "description": "Tags used on calls."
    }
  ]
}
