{
  "openapi": "3.1.0",
  "info": {
    "title": "Open Animals API",
    "version": "1.1.0",
    "description": "Anonymous read-only wildlife catalogue and the authenticated Wildlife Copilot. Copilot plans rank stored historical GBIF records: they are not forecasts and never state a probability. Guide: https://openanimals.run/AGENTS.md"
  },
  "servers": [
    {
      "url": "https://api.openanimals.run"
    },
    {
      "url": "https://openanimals.run"
    }
  ],
  "tags": [
    {
      "name": "catalogue",
      "description": "Anonymous, read-only. Limits per client IP."
    },
    {
      "name": "copilot",
      "description": "Wildlife Copilot plans for the signed-in account or a scoped agent grant."
    },
    {
      "name": "agent-grants",
      "description": "Account session only: mint, list and revoke agent tokens, read the audit trail."
    }
  ],
  "paths": {
    "/api/v1/agent/species/search": {
      "get": {
        "operationId": "species-search",
        "summary": "Search the stored species catalogue by name.",
        "tags": [
          "catalogue"
        ],
        "security": [],
        "x-rate-limit": {
          "bucket": "agent-catalogue",
          "requestsPerMinute": 60
        },
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:pt|en|es)(?:-[A-Za-z]{2})?$"
            }
          },
          {
            "name": "units",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "metric",
                "imperial"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            }
          },
          {
            "name": "mass_min_kg",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,6}(?:\\.\\d{1,4})?$"
            }
          },
          {
            "name": "mass_max_kg",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,6}(?:\\.\\d{1,4})?$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query": {
                      "type": "string"
                    },
                    "lang": {
                      "type": "string",
                      "enum": [
                        "pt-PT",
                        "en",
                        "es"
                      ]
                    },
                    "items": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[1-9]\\d{0,19}$"
                          },
                          "gbif_key": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "wikidata_qid": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^Q[1-9]\\d*$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "slug": {
                            "type": "string",
                            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                          },
                          "rank": {
                            "type": "string",
                            "enum": [
                              "kingdom",
                              "phylum",
                              "class",
                              "order",
                              "family",
                              "genus",
                              "species",
                              "subspecies",
                              "breed"
                            ]
                          },
                          "scientific_name": {
                            "type": "string",
                            "minLength": 1
                          },
                          "common_name": {
                            "type": "string",
                            "minLength": 1
                          },
                          "common_name_lang": {
                            "type": "string"
                          },
                          "group_code": {
                            "type": "string",
                            "enum": [
                              "mammal",
                              "bird",
                              "reptile",
                              "amphibian",
                              "fish",
                              "insect",
                              "arachnid",
                              "mollusc",
                              "crustacean",
                              "other",
                              "domestic"
                            ]
                          },
                          "is_domestic": {
                            "type": "boolean"
                          },
                          "parent_id": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[1-9]\\d{0,19}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "version": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "reference_photo": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "pattern": "^[1-9]\\d{0,19}$"
                                  },
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "photo",
                                      "sound"
                                    ]
                                  },
                                  "url": {
                                    "type": "string",
                                    "pattern": "^\\/api\\/v1\\/media\\/"
                                  },
                                  "width": {
                                    "anyOf": [
                                      {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "height": {
                                    "anyOf": [
                                      {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "licence": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "author": {
                                    "type": "string"
                                  },
                                  "source_url": {
                                    "type": "string",
                                    "format": "uri"
                                  },
                                  "source_ids": {
                                    "minItems": 1,
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "is_reference": {
                                    "type": "boolean"
                                  },
                                  "updated_at": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "format": "date-time",
                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "kind",
                                  "url",
                                  "width",
                                  "height",
                                  "licence",
                                  "author",
                                  "source_url",
                                  "source_ids",
                                  "is_reference"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "mass_provenance": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "source": {
                                    "type": "string",
                                    "enum": [
                                      "wikidata",
                                      "anage",
                                      "animaltraits",
                                      "wikipedia_ai",
                                      "gbif",
                                      "manual"
                                    ]
                                  },
                                  "detail": {
                                    "type": "string",
                                    "enum": [
                                      "adult",
                                      "sample_median"
                                    ]
                                  },
                                  "n": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "value_kg": {
                                    "type": "number",
                                    "minimum": 0
                                  }
                                },
                                "required": [
                                  "source",
                                  "detail",
                                  "n",
                                  "value_kg"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "matched_name": {
                            "type": "string"
                          },
                          "matched_lang": {
                            "type": "string"
                          },
                          "match_type": {
                            "type": "string",
                            "enum": [
                              "exact",
                              "prefix",
                              "fuzzy",
                              "gbif"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "gbif_key",
                          "wikidata_qid",
                          "slug",
                          "rank",
                          "scientific_name",
                          "common_name",
                          "common_name_lang",
                          "group_code",
                          "is_domestic",
                          "parent_id",
                          "version",
                          "reference_photo",
                          "matched_name",
                          "matched_lang",
                          "match_type"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": "null"
                    }
                  },
                  "required": [
                    "query",
                    "lang",
                    "items",
                    "next_cursor"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent/species/{taxon}": {
      "get": {
        "operationId": "species-details",
        "summary": "Get a stored species profile with taxonomy, facts and sources.",
        "tags": [
          "catalogue"
        ],
        "security": [],
        "x-rate-limit": {
          "bucket": "agent-catalogue",
          "requestsPerMinute": 60
        },
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(?:pt|en|es)(?:-[A-Za-z]{2})?$"
            }
          },
          {
            "name": "units",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "metric",
                "imperial"
              ]
            }
          },
          {
            "name": "taxon",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 190,
              "pattern": "^(?:[1-9]\\d{0,19}|[a-z][a-z0-9]*(?:-[a-z0-9]+)*)$",
              "description": "Catalogue ID from 1 to 18446744073709551615, or a lowercase hyphenated slug."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^[1-9]\\d{0,19}$"
                    },
                    "gbif_key": {
                      "anyOf": [
                        {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "wikidata_qid": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^Q[1-9]\\d*$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "slug": {
                      "type": "string",
                      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                    },
                    "rank": {
                      "type": "string",
                      "enum": [
                        "kingdom",
                        "phylum",
                        "class",
                        "order",
                        "family",
                        "genus",
                        "species",
                        "subspecies",
                        "breed"
                      ]
                    },
                    "scientific_name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "common_name": {
                      "type": "string",
                      "minLength": 1
                    },
                    "common_name_lang": {
                      "type": "string"
                    },
                    "group_code": {
                      "type": "string",
                      "enum": [
                        "mammal",
                        "bird",
                        "reptile",
                        "amphibian",
                        "fish",
                        "insect",
                        "arachnid",
                        "mollusc",
                        "crustacean",
                        "other",
                        "domestic"
                      ]
                    },
                    "is_domestic": {
                      "type": "boolean"
                    },
                    "parent_id": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[1-9]\\d{0,19}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    },
                    "reference_photo": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^[1-9]\\d{0,19}$"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "photo",
                                "sound"
                              ]
                            },
                            "url": {
                              "type": "string",
                              "pattern": "^\\/api\\/v1\\/media\\/"
                            },
                            "width": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "height": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "licence": {
                              "type": "string",
                              "minLength": 1
                            },
                            "author": {
                              "type": "string"
                            },
                            "source_url": {
                              "type": "string",
                              "format": "uri"
                            },
                            "source_ids": {
                              "minItems": 1,
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "is_reference": {
                              "type": "boolean"
                            },
                            "updated_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "id",
                            "kind",
                            "url",
                            "width",
                            "height",
                            "licence",
                            "author",
                            "source_url",
                            "source_ids",
                            "is_reference"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "mass_provenance": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "source": {
                              "type": "string",
                              "enum": [
                                "wikidata",
                                "anage",
                                "animaltraits",
                                "wikipedia_ai",
                                "gbif",
                                "manual"
                              ]
                            },
                            "detail": {
                              "type": "string",
                              "enum": [
                                "adult",
                                "sample_median"
                              ]
                            },
                            "n": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "value_kg": {
                              "type": "number",
                              "minimum": 0
                            }
                          },
                          "required": [
                            "source",
                            "detail",
                            "n",
                            "value_kg"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "lang": {
                      "type": "string",
                      "enum": [
                        "pt-PT",
                        "en",
                        "es"
                      ]
                    },
                    "locale": {
                      "type": "string"
                    },
                    "units": {
                      "type": "string",
                      "enum": [
                        "metric",
                        "imperial"
                      ]
                    },
                    "names": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "lang": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 190
                          },
                          "is_primary": {
                            "type": "boolean"
                          },
                          "source": {
                            "type": "string"
                          },
                          "source_ids": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "lang",
                          "name",
                          "is_primary",
                          "source",
                          "source_ids"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "taxonomy": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[1-9]\\d{0,19}$"
                          },
                          "rank": {
                            "type": "string",
                            "enum": [
                              "kingdom",
                              "phylum",
                              "class",
                              "order",
                              "family",
                              "genus",
                              "species",
                              "subspecies",
                              "breed"
                            ]
                          },
                          "scientific_name": {
                            "type": "string",
                            "minLength": 1
                          },
                          "common_name": {
                            "type": "string",
                            "minLength": 1
                          },
                          "common_name_lang": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string",
                            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                          }
                        },
                        "required": [
                          "id",
                          "rank",
                          "scientific_name",
                          "common_name",
                          "common_name_lang",
                          "slug"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "facts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[1-9]\\d{0,19}$"
                          },
                          "aggregate": {
                            "type": "object",
                            "properties": {
                              "method": {
                                "type": "string",
                                "const": "median"
                              },
                              "n": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "kind": {
                                "type": "string",
                                "const": "sample_measurement"
                              },
                              "median": {
                                "type": "number",
                                "minimum": 0
                              },
                              "low_confidence": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "method",
                              "n",
                              "kind",
                              "median"
                            ],
                            "additionalProperties": false
                          },
                          "mass_provenance": {
                            "type": "string",
                            "enum": [
                              "wikidata_adult_mass",
                              "animaltraits_labelled_sample_median"
                            ]
                          },
                          "fact": {
                            "type": "string",
                            "enum": [
                              "lifespan_typical",
                              "lifespan_max",
                              "mass",
                              "length",
                              "height",
                              "wingspan",
                              "speed",
                              "diet",
                              "habitat",
                              "activity",
                              "social",
                              "venomous",
                              "iucn_status",
                              "population_trend",
                              "body_covering",
                              "tail_shape",
                              "wing_pattern"
                            ]
                          },
                          "value_min": {
                            "anyOf": [
                              {
                                "type": "number",
                                "minimum": 0
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "value_max": {
                            "anyOf": [
                              {
                                "type": "number",
                                "minimum": 0
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "unit": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "sex": {
                            "type": "string",
                            "enum": [
                              "any",
                              "m",
                              "f"
                            ]
                          },
                          "text_value": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "lang": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "wikidata",
                              "anage",
                              "animaltraits",
                              "wikipedia_ai",
                              "gbif",
                              "manual"
                            ]
                          },
                          "source_ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "licence": {
                            "type": "string",
                            "minLength": 1
                          },
                          "confidence": {
                            "anyOf": [
                              {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "is_estimate": {
                            "type": "boolean"
                          },
                          "source_ids": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "refreshed_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "fact",
                          "value_min",
                          "value_max",
                          "unit",
                          "sex",
                          "text_value",
                          "lang",
                          "source",
                          "source_ref",
                          "licence",
                          "confidence",
                          "is_estimate",
                          "source_ids",
                          "refreshed_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "texts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[1-9]\\d{0,19}$"
                          },
                          "lang": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "summary",
                              "fun_fact",
                              "cue",
                              "rating_reason",
                              "safety"
                            ]
                          },
                          "ordinal": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "text": {
                            "type": "string"
                          },
                          "source_fact_ids": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^[1-9]\\d{0,19}$"
                            }
                          },
                          "source_ids": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "model": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "prompt_version": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "updated_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "lang",
                          "kind",
                          "ordinal",
                          "text",
                          "source_fact_ids",
                          "source_ids",
                          "model",
                          "prompt_version"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "ratings": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "taxon_id": {
                              "type": "string",
                              "pattern": "^[1-9]\\d{0,19}$"
                            },
                            "version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "friendly": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5
                            },
                            "dangerous": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5
                            },
                            "fun": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 5
                            },
                            "rarity": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "smart": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "cuteness": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "pet_suitability": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "inputs": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            "rubric_version": {
                              "type": "string"
                            },
                            "computed_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            "overrides": {
                              "maxItems": 10,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "revision": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 100
                                  },
                                  "override_version": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "reviewed_at": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 100
                                  },
                                  "fields": {
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 40
                                    }
                                  }
                                },
                                "required": [
                                  "revision",
                                  "fields"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "taxon_id",
                            "version",
                            "friendly",
                            "dangerous",
                            "fun",
                            "rarity",
                            "smart",
                            "cuteness",
                            "pet_suitability",
                            "inputs",
                            "rubric_version",
                            "computed_at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "media": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^[1-9]\\d{0,19}$"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "photo",
                              "sound"
                            ]
                          },
                          "url": {
                            "type": "string",
                            "pattern": "^\\/api\\/v1\\/media\\/"
                          },
                          "width": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "height": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "licence": {
                            "type": "string",
                            "minLength": 1
                          },
                          "author": {
                            "type": "string"
                          },
                          "source_url": {
                            "type": "string",
                            "format": "uri"
                          },
                          "source_ids": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "is_reference": {
                            "type": "boolean"
                          },
                          "updated_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "url",
                          "width",
                          "height",
                          "licence",
                          "author",
                          "source_url",
                          "source_ids",
                          "is_reference"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "lookalikes": {
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "species": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "pattern": "^[1-9]\\d{0,19}$"
                              },
                              "gbif_key": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "wikidata_qid": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^Q[1-9]\\d*$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "slug": {
                                "type": "string",
                                "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
                              },
                              "rank": {
                                "type": "string",
                                "enum": [
                                  "kingdom",
                                  "phylum",
                                  "class",
                                  "order",
                                  "family",
                                  "genus",
                                  "species",
                                  "subspecies",
                                  "breed"
                                ]
                              },
                              "scientific_name": {
                                "type": "string",
                                "minLength": 1
                              },
                              "common_name": {
                                "type": "string",
                                "minLength": 1
                              },
                              "common_name_lang": {
                                "type": "string"
                              },
                              "group_code": {
                                "type": "string",
                                "enum": [
                                  "mammal",
                                  "bird",
                                  "reptile",
                                  "amphibian",
                                  "fish",
                                  "insect",
                                  "arachnid",
                                  "mollusc",
                                  "crustacean",
                                  "other",
                                  "domestic"
                                ]
                              },
                              "is_domestic": {
                                "type": "boolean"
                              },
                              "parent_id": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^[1-9]\\d{0,19}$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "version": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "reference_photo": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string",
                                        "pattern": "^[1-9]\\d{0,19}$"
                                      },
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "photo",
                                          "sound"
                                        ]
                                      },
                                      "url": {
                                        "type": "string",
                                        "pattern": "^\\/api\\/v1\\/media\\/"
                                      },
                                      "width": {
                                        "anyOf": [
                                          {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "height": {
                                        "anyOf": [
                                          {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "licence": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "author": {
                                        "type": "string"
                                      },
                                      "source_url": {
                                        "type": "string",
                                        "format": "uri"
                                      },
                                      "source_ids": {
                                        "minItems": 1,
                                        "type": "array",
                                        "items": {
                                          "type": "string"
                                        }
                                      },
                                      "is_reference": {
                                        "type": "boolean"
                                      },
                                      "updated_at": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "format": "date-time",
                                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "kind",
                                      "url",
                                      "width",
                                      "height",
                                      "licence",
                                      "author",
                                      "source_url",
                                      "source_ids",
                                      "is_reference"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "mass_provenance": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "source": {
                                        "type": "string",
                                        "enum": [
                                          "wikidata",
                                          "anage",
                                          "animaltraits",
                                          "wikipedia_ai",
                                          "gbif",
                                          "manual"
                                        ]
                                      },
                                      "detail": {
                                        "type": "string",
                                        "enum": [
                                          "adult",
                                          "sample_median"
                                        ]
                                      },
                                      "n": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "value_kg": {
                                        "type": "number",
                                        "minimum": 0
                                      }
                                    },
                                    "required": [
                                      "source",
                                      "detail",
                                      "n",
                                      "value_kg"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "gbif_key",
                              "wikidata_qid",
                              "slug",
                              "rank",
                              "scientific_name",
                              "common_name",
                              "common_name_lang",
                              "group_code",
                              "is_domestic",
                              "parent_id",
                              "version",
                              "reference_photo"
                            ],
                            "additionalProperties": false
                          },
                          "similarity": {
                            "anyOf": [
                              {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "cue_key": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "cue": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string",
                                    "pattern": "^[1-9]\\d{0,19}$"
                                  },
                                  "lang": {
                                    "type": "string"
                                  },
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "summary",
                                      "fun_fact",
                                      "cue",
                                      "rating_reason",
                                      "safety"
                                    ]
                                  },
                                  "ordinal": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "text": {
                                    "type": "string"
                                  },
                                  "source_fact_ids": {
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "pattern": "^[1-9]\\d{0,19}$"
                                    }
                                  },
                                  "source_ids": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "model": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "prompt_version": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "updated_at": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "format": "date-time",
                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "lang",
                                  "kind",
                                  "ordinal",
                                  "text",
                                  "source_fact_ids",
                                  "source_ids",
                                  "model",
                                  "prompt_version"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "species",
                          "similarity",
                          "cue_key",
                          "cue"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "sources": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "wikidata",
                              "anage",
                              "animaltraits",
                              "wikipedia_ai",
                              "gbif",
                              "manual",
                              "wikipedia",
                              "commons"
                            ]
                          },
                          "label": {
                            "type": "string"
                          },
                          "source_ref": {
                            "type": "string",
                            "minLength": 1
                          },
                          "url": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "uri"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "licence": {
                            "type": "string",
                            "minLength": 1
                          },
                          "author": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "attribution": {
                            "type": "string"
                          },
                          "retrieved_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "label",
                          "source_ref",
                          "url",
                          "licence",
                          "author",
                          "attribution",
                          "retrieved_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "refreshed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "stale": {
                      "type": "boolean"
                    },
                    "refresh_pending": {
                      "type": "boolean"
                    },
                    "enrichment": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "ready"
                      ]
                    },
                    "massSource": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "reference"
                            },
                            "source": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "source"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "estimate"
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "gbif_key",
                    "wikidata_qid",
                    "slug",
                    "rank",
                    "scientific_name",
                    "common_name",
                    "common_name_lang",
                    "group_code",
                    "is_domestic",
                    "parent_id",
                    "version",
                    "reference_photo",
                    "lang",
                    "locale",
                    "units",
                    "names",
                    "taxonomy",
                    "facts",
                    "texts",
                    "ratings",
                    "media",
                    "lookalikes",
                    "sources",
                    "refreshed_at",
                    "stale",
                    "refresh_pending"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent/nearby": {
      "get": {
        "operationId": "nearby-animals",
        "summary": "Get recorded animals for a month in a one-degree GBIF cell.",
        "tags": [
          "catalogue"
        ],
        "security": [],
        "x-rate-limit": {
          "bucket": "agent-cells",
          "requestsPerMinute": 60
        },
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "description": "Number between -90 and 90, encoded as a query string value.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          },
          {
            "name": "lng",
            "in": "query",
            "required": true,
            "schema": {
              "description": "Number between -180 and 180, encoded as a query string value.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "default": "pt-PT",
              "type": "string",
              "enum": [
                "pt-PT",
                "en",
                "es"
              ]
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": false,
            "schema": {
              "description": "UTC month number, 1–12. Defaults to the current UTC month.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Integer from 1 to 50, encoded as a query string value.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cell_id": {
                      "type": "string"
                    },
                    "month": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 12
                    },
                    "species": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "taxon_id": {
                            "type": "string"
                          },
                          "gbif_key": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "slug": {
                            "type": "string"
                          },
                          "scientific_name": {
                            "type": "string"
                          },
                          "common_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reference_photo": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "url": {
                                    "type": "string",
                                    "format": "uri"
                                  },
                                  "licence": {
                                    "type": "string"
                                  },
                                  "author": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "source_url": {
                                    "type": "string",
                                    "format": "uri"
                                  }
                                },
                                "required": [
                                  "url",
                                  "licence",
                                  "author",
                                  "source_url"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "occurrences": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          },
                          "group_code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "taxon_id",
                          "gbif_key",
                          "slug",
                          "scientific_name",
                          "common_name",
                          "reference_photo",
                          "occurrences"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "data_status": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "stale",
                        "pending",
                        "unavailable"
                      ]
                    },
                    "refreshed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "attribution": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "provider": {
                            "type": "string",
                            "enum": [
                              "OpenStreetMap",
                              "GBIF",
                              "Nominatim"
                            ]
                          },
                          "text": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          }
                        },
                        "required": [
                          "provider",
                          "text",
                          "url"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "cell_id",
                    "month",
                    "species",
                    "data_status",
                    "refreshed_at",
                    "attribution"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/agent/nearby/checklist": {
      "get": {
        "operationId": "nearby-checklist",
        "summary": "Get a seasonal checklist for a one-degree GBIF cell.",
        "tags": [
          "catalogue"
        ],
        "security": [],
        "x-rate-limit": {
          "bucket": "agent-cells",
          "requestsPerMinute": 60
        },
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "description": "Number between -90 and 90, encoded as a query string value.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          },
          {
            "name": "lng",
            "in": "query",
            "required": true,
            "schema": {
              "description": "Number between -180 and 180, encoded as a query string value.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "default": "pt-PT",
              "type": "string",
              "enum": [
                "pt-PT",
                "en",
                "es"
              ]
            }
          },
          {
            "name": "season",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "winter",
                "spring",
                "summer",
                "autumn"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Integer from 1 to 50, encoded as a query string value.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cell_id": {
                      "type": "string"
                    },
                    "season": {
                      "type": "string",
                      "enum": [
                        "winter",
                        "spring",
                        "summer",
                        "autumn"
                      ]
                    },
                    "hemisphere": {
                      "type": "string",
                      "enum": [
                        "north",
                        "south"
                      ]
                    },
                    "months": {
                      "minItems": 3,
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                      }
                    },
                    "species": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "taxon_id": {
                            "type": "string"
                          },
                          "gbif_key": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "slug": {
                            "type": "string"
                          },
                          "scientific_name": {
                            "type": "string"
                          },
                          "common_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reference_photo": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "url": {
                                    "type": "string",
                                    "format": "uri"
                                  },
                                  "licence": {
                                    "type": "string"
                                  },
                                  "author": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "source_url": {
                                    "type": "string",
                                    "format": "uri"
                                  }
                                },
                                "required": [
                                  "url",
                                  "licence",
                                  "author",
                                  "source_url"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "group_code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "season_occurrences": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "months": {
                            "minItems": 12,
                            "maxItems": 12,
                            "type": "array",
                            "items": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "peak_month": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 12
                          },
                          "habitat": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "water",
                                  "land"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "taxon_id",
                          "gbif_key",
                          "slug",
                          "scientific_name",
                          "common_name",
                          "reference_photo",
                          "season_occurrences",
                          "months",
                          "peak_month",
                          "habitat"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "data_status": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "stale",
                        "pending",
                        "unavailable"
                      ]
                    },
                    "refreshed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "attribution": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "provider": {
                            "type": "string",
                            "enum": [
                              "OpenStreetMap",
                              "GBIF",
                              "Nominatim"
                            ]
                          },
                          "text": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          }
                        },
                        "required": [
                          "provider",
                          "text",
                          "url"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "cell_id",
                    "season",
                    "hemisphere",
                    "months",
                    "species",
                    "data_status",
                    "refreshed_at",
                    "attribution"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/radar": {
      "get": {
        "operationId": "wildlife-radar",
        "summary": "Use coarse area coordinates to get relative encounter rankings and aggregate sighting counts for a one-degree cell.",
        "tags": [
          "catalogue"
        ],
        "security": [],
        "x-rate-limit": {
          "bucket": "wildlife-radar",
          "requestsPerMinute": 60
        },
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": true,
            "schema": {
              "description": "Number between -90 and 90, encoded as a query string value.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          },
          {
            "name": "lng",
            "in": "query",
            "required": true,
            "schema": {
              "description": "Number between -180 and 180, encoded as a query string value.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "default": "pt-PT",
              "type": "string",
              "enum": [
                "pt-PT",
                "en",
                "es"
              ]
            }
          },
          {
            "name": "month",
            "in": "query",
            "required": false,
            "schema": {
              "description": "UTC month number, 1–12. Defaults to the current UTC month.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Integer from 1 to 50, encoded as a query string value.",
              "type": "string",
              "pattern": "^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cell_id": {
                      "type": "string"
                    },
                    "coarse_cell_id": {
                      "type": "string"
                    },
                    "place_label": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "month": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 12
                    },
                    "season": {
                      "type": "string",
                      "enum": [
                        "winter",
                        "spring",
                        "summer",
                        "autumn"
                      ]
                    },
                    "hemisphere": {
                      "type": "string",
                      "enum": [
                        "north",
                        "south"
                      ]
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "species": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "taxon_id": {
                            "type": "string"
                          },
                          "gbif_key": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "slug": {
                            "type": "string"
                          },
                          "scientific_name": {
                            "type": "string"
                          },
                          "common_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reference_photo": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "url": {
                                    "type": "string",
                                    "format": "uri"
                                  },
                                  "licence": {
                                    "type": "string"
                                  },
                                  "author": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "source_url": {
                                    "type": "string",
                                    "format": "uri"
                                  }
                                },
                                "required": [
                                  "url",
                                  "licence",
                                  "author",
                                  "source_url"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "group_code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "likelihood": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          },
                          "likelihood_band": {
                            "type": "string",
                            "enum": [
                              "high",
                              "medium",
                              "low"
                            ]
                          },
                          "factors": {
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "gbif_month_frequency"
                                    },
                                    "value": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "value"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "recent_community_sightings"
                                    },
                                    "count": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "days": {
                                      "type": "number",
                                      "const": 30
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "count",
                                    "days"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "season_peak"
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "evidence_kind": {
                            "type": "string",
                            "const": "predicted"
                          }
                        },
                        "required": [
                          "taxon_id",
                          "gbif_key",
                          "slug",
                          "scientific_name",
                          "common_name",
                          "reference_photo",
                          "likelihood",
                          "likelihood_band",
                          "factors",
                          "evidence_kind"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "recent_sightings_summary": {
                      "type": "object",
                      "properties": {
                        "data_status": {
                          "type": "string",
                          "enum": [
                            "ready",
                            "empty",
                            "unavailable"
                          ]
                        },
                        "days": {
                          "type": "number",
                          "const": 30
                        },
                        "sightings_total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "species_total": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "data_status",
                        "days",
                        "sightings_total",
                        "species_total"
                      ],
                      "additionalProperties": false
                    },
                    "data_status": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "stale",
                        "pending",
                        "unavailable",
                        "empty"
                      ]
                    },
                    "gbif_data_status": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "stale",
                        "pending",
                        "unavailable"
                      ]
                    },
                    "refreshed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "attribution": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "provider": {
                            "type": "string",
                            "enum": [
                              "GBIF",
                              "OpenStreetMap",
                              "Nominatim",
                              "Open Animals"
                            ]
                          },
                          "text": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          }
                        },
                        "required": [
                          "provider",
                          "text",
                          "url"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "method": {
                      "type": "object",
                      "properties": {
                        "version": {
                          "type": "string",
                          "const": "radar_v1"
                        },
                        "scale": {
                          "type": "string",
                          "const": "relative_encounter_likelihood"
                        },
                        "cell_degrees": {
                          "type": "number",
                          "const": 1
                        },
                        "time_of_day": {
                          "type": "string",
                          "const": "not_used"
                        },
                        "factors": {
                          "type": "object",
                          "properties": {
                            "gbif_month_frequency": {
                              "type": "object",
                              "properties": {
                                "weight": {
                                  "type": "number"
                                },
                                "half_saturation_count": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "weight",
                                "half_saturation_count"
                              ],
                              "additionalProperties": false
                            },
                            "recent_community_sightings": {
                              "type": "object",
                              "properties": {
                                "weight": {
                                  "type": "number"
                                },
                                "half_saturation_count": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "days": {
                                  "type": "number",
                                  "const": 30
                                }
                              },
                              "required": [
                                "weight",
                                "half_saturation_count",
                                "days"
                              ],
                              "additionalProperties": false
                            },
                            "season_peak": {
                              "type": "object",
                              "properties": {
                                "weight": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "weight"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "gbif_month_frequency",
                            "recent_community_sightings",
                            "season_peak"
                          ],
                          "additionalProperties": false
                        },
                        "band_thresholds": {
                          "type": "object",
                          "properties": {
                            "high": {
                              "type": "number"
                            },
                            "medium": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "high",
                            "medium"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "version",
                        "scale",
                        "cell_degrees",
                        "time_of_day",
                        "factors",
                        "band_thresholds"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "cell_id",
                    "coarse_cell_id",
                    "place_label",
                    "month",
                    "season",
                    "hemisphere",
                    "generated_at",
                    "species",
                    "recent_sightings_summary",
                    "data_status",
                    "gbif_data_status",
                    "refreshed_at",
                    "attribution",
                    "method"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/places": {
      "get": {
        "operationId": "places",
        "summary": "Find public wildlife venues and protected areas in a bounding box.",
        "tags": [
          "catalogue"
        ],
        "security": [],
        "x-rate-limit": {
          "bucket": "explorer-places",
          "requestsPerMinute": 10
        },
        "parameters": [
          {
            "name": "bbox",
            "in": "query",
            "required": true,
            "schema": {
              "description": "west,south,east,north in degrees, with a maximum span of 2° on either axis and no antimeridian crossing.",
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "kinds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 200,
              "description": "Comma-separated wildlife place kinds: zoo, aquarium, wildlife_park, nature_reserve, national_park. Defaults to all."
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "default": "pt-PT",
              "type": "string",
              "enum": [
                "pt-PT",
                "en",
                "es"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^osm:(node|way|relation)\\/\\d+$"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "zoo",
                              "aquarium",
                              "wildlife_park",
                              "nature_reserve",
                              "national_park"
                            ]
                          },
                          "lat": {
                            "type": "number"
                          },
                          "lng": {
                            "type": "number"
                          },
                          "website": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "kind",
                          "lat",
                          "lng",
                          "website"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "attribution": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "items",
                    "attribution"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/areas/insights": {
      "get": {
        "operationId": "area-insights",
        "summary": "Get recorded sighting totals and coarsened recent sightings in an area.",
        "tags": [
          "catalogue"
        ],
        "security": [],
        "x-rate-limit": {
          "bucket": "explorer-insights",
          "requestsPerMinute": 60
        },
        "parameters": [
          {
            "name": "bbox",
            "in": "query",
            "required": true,
            "schema": {
              "description": "west,south,east,north in degrees, with a maximum span of 60° on either axis and no antimeridian crossing.",
              "type": "string",
              "maxLength": 128
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "captive",
            "in": "query",
            "required": false,
            "schema": {
              "default": "exclude",
              "type": "string",
              "enum": [
                "include",
                "exclude",
                "only"
              ]
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "default": "pt-PT",
              "type": "string",
              "enum": [
                "pt-PT",
                "en",
                "es"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sightings_total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "species_total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "top_species": {
                      "maxItems": 10,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "taxon_id": {
                            "type": "string"
                          },
                          "common_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "scientific_name": {
                            "type": "string"
                          },
                          "count": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "taxon_id",
                          "common_name",
                          "scientific_name",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "by_month": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "month": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}$"
                          },
                          "count": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "month",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "by_group": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "group_code": {
                            "type": "string",
                            "enum": [
                              "mammal",
                              "bird",
                              "reptile",
                              "amphibian",
                              "fish",
                              "insect",
                              "arachnid",
                              "mollusc",
                              "crustacean",
                              "other",
                              "domestic"
                            ]
                          },
                          "count": {
                            "type": "integer",
                            "minimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "group_code",
                          "count"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "recent": {
                      "maxItems": 10,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "taxon_id": {
                            "type": "string"
                          },
                          "scientific_name": {
                            "type": "string"
                          },
                          "common_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "group_code": {
                            "type": "string",
                            "enum": [
                              "mammal",
                              "bird",
                              "reptile",
                              "amphibian",
                              "fish",
                              "insect",
                              "arachnid",
                              "mollusc",
                              "crustacean",
                              "other",
                              "domestic"
                            ]
                          },
                          "observed_on": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          },
                          "lat": {
                            "type": "number"
                          },
                          "lng": {
                            "type": "number"
                          },
                          "precision_km": {
                            "anyOf": [
                              {
                                "type": "number",
                                "const": 11
                              },
                              {
                                "type": "number",
                                "const": 111
                              }
                            ]
                          },
                          "photo_url": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "ai_assisted",
                              "confirmed",
                              "unverified"
                            ]
                          },
                          "captive": {
                            "type": "boolean"
                          },
                          "reports_hidden": {
                            "type": "boolean",
                            "const": false
                          }
                        },
                        "required": [
                          "id",
                          "taxon_id",
                          "scientific_name",
                          "common_name",
                          "group_code",
                          "observed_on",
                          "lat",
                          "lng",
                          "precision_km",
                          "photo_url",
                          "status",
                          "captive",
                          "reports_hidden"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "first_seen_recent": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "taxon_id": {
                            "type": "string"
                          },
                          "common_name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "scientific_name": {
                            "type": "string"
                          },
                          "first_observed_on": {
                            "type": "string",
                            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                          }
                        },
                        "required": [
                          "taxon_id",
                          "common_name",
                          "scientific_name",
                          "first_observed_on"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "sample_size": {
                      "type": "string",
                      "enum": [
                        "none",
                        "small",
                        "moderate",
                        "large"
                      ]
                    },
                    "note_key": {
                      "type": "string"
                    },
                    "gbif": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "species": {
                              "maxItems": 10,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "taxon_id": {
                                    "type": "string"
                                  },
                                  "scientific_name": {
                                    "type": "string"
                                  },
                                  "common_name": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "occurrences": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "taxon_id",
                                  "scientific_name",
                                  "common_name",
                                  "occurrences"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "data_status": {
                              "type": "string",
                              "enum": [
                                "ready",
                                "stale",
                                "pending",
                                "unavailable"
                              ]
                            },
                            "cells_ready": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "cells_total": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "species",
                            "data_status",
                            "cells_ready",
                            "cells_total"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "data_status": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "empty",
                        "unavailable"
                      ]
                    }
                  },
                  "required": [
                    "sightings_total",
                    "species_total",
                    "top_species",
                    "by_month",
                    "by_group",
                    "recent",
                    "first_seen_recent",
                    "sample_size",
                    "note_key",
                    "gbif",
                    "data_status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/geo/search": {
      "get": {
        "operationId": "geocode",
        "summary": "Resolve a public place name to coordinates and, where available, bounds.",
        "tags": [
          "catalogue"
        ],
        "security": [],
        "x-rate-limit": {
          "bucket": "explorer-geocode",
          "requestsPerMinute": 30
        },
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "description": "Place name, 2–200 characters after trimming.",
              "type": "string",
              "maxLength": 400
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": {
              "default": "pt-PT",
              "type": "string",
              "enum": [
                "pt-PT",
                "en",
                "es"
              ]
            }
          },
          {
            "name": "near",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Optional geographic bias as latitude,longitude in degrees.",
              "type": "string",
              "maxLength": 64,
              "pattern": "^-?[\\d.]+,-?[\\d.]+$"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "description": "Integer from 1 to 10, encoded as a query string value.",
              "type": "string",
              "maxLength": 12,
              "pattern": "^\\d+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "items": {
                      "maxItems": 10,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "country",
                              "region",
                              "city",
                              "neighbourhood",
                              "park",
                              "zoo",
                              "landmark",
                              "address",
                              "other"
                            ]
                          },
                          "lat": {
                            "type": "number",
                            "minimum": -90,
                            "maximum": 90
                          },
                          "lng": {
                            "type": "number",
                            "minimum": -180,
                            "maximum": 180
                          },
                          "bbox": {
                            "anyOf": [
                              {
                                "type": "array",
                                "prefixItems": [
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "number"
                                  }
                                ],
                                "items": false,
                                "minItems": 4,
                                "maxItems": 4
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "country_code": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^[A-Z]{2}$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "label",
                          "kind",
                          "lat",
                          "lng",
                          "bbox",
                          "country_code"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "attribution": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "items",
                    "attribution"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/copilot/plans": {
      "get": {
        "operationId": "copilot-plans-list",
        "summary": "List own plans",
        "tags": [
          "copilot"
        ],
        "security": [
          {
            "session": []
          },
          {
            "agentToken": [
              "plans:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "enum": [
                "active",
                "completed",
                "cancelled"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanList"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "copilot-plans-create",
        "summary": "Create a plan from an intent",
        "tags": [
          "copilot"
        ],
        "security": [
          {
            "session": []
          },
          {
            "agentToken": [
              "plans:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 64
            },
            "description": "Replays return 200 with the original plan."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlan"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Idempotent replay",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/copilot/plans/{id}": {
      "get": {
        "operationId": "copilot-plans-get",
        "summary": "Read a plan",
        "tags": [
          "copilot"
        ],
        "security": [
          {
            "session": []
          },
          {
            "agentToken": [
              "plans:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Plan id (`cp_…`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "copilot-plans-update",
        "summary": "Edit the intent (re-plans, keeps progress) or complete",
        "tags": [
          "copilot"
        ],
        "security": [
          {
            "session": []
          },
          {
            "agentToken": [
              "plans:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Plan id (`cp_…`)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePlan"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/copilot/plans/{id}/refresh": {
      "post": {
        "operationId": "copilot-plans-refresh",
        "summary": "Re-plan from current data, keeping seen/skipped progress",
        "tags": [
          "copilot"
        ],
        "security": [
          {
            "session": []
          },
          {
            "agentToken": [
              "plans:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Plan id (`cp_…`)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "revision": {
                    "type": "integer",
                    "minimum": 1
                  }
                },
                "required": [
                  "revision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/copilot/plans/{id}/cancel": {
      "post": {
        "operationId": "copilot-plans-cancel",
        "summary": "Cancel a plan and its reminder",
        "tags": [
          "copilot"
        ],
        "security": [
          {
            "session": []
          },
          {
            "agentToken": [
              "plans:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Plan id (`cp_…`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/copilot/plans/{id}/items/{taxon}": {
      "patch": {
        "operationId": "copilot-items-update",
        "summary": "Mark a checklist item seen, skipped or todo, optionally attaching an own observation",
        "tags": [
          "copilot"
        ],
        "security": [
          {
            "session": []
          },
          {
            "agentToken": [
              "plans:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Plan id (`cp_…`)."
          },
          {
            "name": "taxon",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Taxon id of a checklist item."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateItem"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/copilot/plans/{id}/reminder": {
      "put": {
        "operationId": "copilot-reminder-set",
        "summary": "Opt in to one reminder, respecting quiet hours",
        "tags": [
          "copilot"
        ],
        "security": [
          {
            "session": []
          },
          {
            "agentToken": [
              "reminders:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Plan id (`cp_…`)."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetReminder"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "copilot-reminder-cancel",
        "summary": "Cancel the reminder",
        "tags": [
          "copilot"
        ],
        "security": [
          {
            "session": []
          },
          {
            "agentToken": [
              "reminders:write"
            ]
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Plan id (`cp_…`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/copilot/reminders/due": {
      "get": {
        "operationId": "copilot-reminders-due",
        "summary": "Deliver due reminders once (in-app)",
        "tags": [
          "copilot"
        ],
        "security": [
          {
            "session": []
          },
          {
            "agentToken": [
              "plans:read"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DueReminders"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/copilot/agent-grants": {
      "get": {
        "operationId": "agent-grants-list",
        "summary": "List agent grants",
        "tags": [
          "agent-grants"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrantList"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "agent-grants-create",
        "summary": "Mint a scoped agent token (shown once)",
        "tags": [
          "agent-grants"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateGrant"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GrantCreated"
                }
              }
            }
          },
          "400": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/copilot/agent-grants/{id}": {
      "delete": {
        "operationId": "agent-grants-revoke",
        "summary": "Revoke an agent grant",
        "tags": [
          "agent-grants"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Grant id (`ag_…`)."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Grant"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/copilot/audit": {
      "get": {
        "operationId": "copilot-audit",
        "summary": "Audit trail of plan and grant changes",
        "tags": [
          "agent-grants"
        ],
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditList"
                }
              }
            }
          },
          "401": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Problem details",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "session": {
        "type": "http",
        "scheme": "bearer",
        "description": "Open Animals account session (native bearer or web cookie with CSRF)."
      },
      "agentToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "oaa_…",
        "description": "Agent grant token. Scopes: plans:read, plans:write, reminders:write. Minted and revoked by the account owner."
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "urn:openanimals:copilot.<code>; codes: invalid_request, unauthenticated, forbidden, insufficient_scope, not_found, conflict, rate_limited, capability_unavailable"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "title",
          "status"
        ]
      },
      "Plan": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^cp_[A-Za-z0-9_-]{22}$"
          },
          "revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "completed",
              "cancelled"
            ]
          },
          "job_state": {
            "type": "string",
            "enum": [
              "ready",
              "waiting_for_data",
              "unavailable"
            ]
          },
          "intent": {
            "type": "object",
            "properties": {
              "text": {
                "default": null,
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 500
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "place": {
                "type": "object",
                "properties": {
                  "label": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lat": {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90
                  },
                  "lng": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "search",
                      "device",
                      "manual"
                    ]
                  }
                },
                "required": [
                  "label",
                  "lat",
                  "lng",
                  "source"
                ],
                "additionalProperties": false
              },
              "date": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "duration_minutes": {
                "default": 120,
                "type": "integer",
                "minimum": 15,
                "maximum": 720
              },
              "interests": {
                "default": [],
                "maxItems": 10,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "mammal",
                    "bird",
                    "reptile",
                    "amphibian",
                    "fish",
                    "insect",
                    "arachnid",
                    "mollusc",
                    "crustacean",
                    "other"
                  ]
                }
              },
              "constraints": {
                "default": {
                  "step_free": false,
                  "transport": null
                },
                "type": "object",
                "properties": {
                  "step_free": {
                    "default": false,
                    "type": "boolean"
                  },
                  "transport": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "walk",
                          "bike",
                          "car",
                          "public"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "step_free",
                  "transport"
                ],
                "additionalProperties": false
              },
              "lang": {
                "default": "en",
                "type": "string",
                "enum": [
                  "pt-PT",
                  "en",
                  "es"
                ]
              }
            },
            "required": [
              "text",
              "place",
              "date",
              "duration_minutes",
              "interests",
              "constraints",
              "lang"
            ],
            "additionalProperties": false
          },
          "evidence": {
            "type": "object",
            "properties": {
              "cell_id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 40
              },
              "month": {
                "type": "integer",
                "minimum": 1,
                "maximum": 12
              },
              "season": {
                "type": "string",
                "enum": [
                  "winter",
                  "spring",
                  "summer",
                  "autumn"
                ]
              },
              "hemisphere": {
                "type": "string",
                "enum": [
                  "north",
                  "south"
                ]
              },
              "data_status": {
                "type": "string",
                "enum": [
                  "ready",
                  "stale",
                  "pending",
                  "unavailable"
                ]
              },
              "refreshed_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "attribution": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "provider": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  },
                  "required": [
                    "provider",
                    "text",
                    "url"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "cell_id",
              "month",
              "season",
              "hemisphere",
              "data_status",
              "refreshed_at",
              "attribution"
            ],
            "additionalProperties": false
          },
          "recommendations": {
            "maxItems": 20,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "taxon_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{0,19}$"
                },
                "slug": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "scientific_name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "common_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "group_code": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reference_photo": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "licence": {
                          "type": "string"
                        },
                        "author": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "source_url": {
                          "type": "string",
                          "format": "uri"
                        }
                      },
                      "required": [
                        "url",
                        "licence",
                        "author",
                        "source_url"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "evidence_kind": {
                  "type": "string",
                  "const": "historical_records"
                },
                "month_occurrences": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "season_occurrences": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "peak_month": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 12
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "habitat": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "water",
                        "land"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "reasons": {
                  "maxItems": 6,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "most_recorded_this_month",
                      "seasonal_peak",
                      "matches_interest",
                      "water_habitat",
                      "land_habitat",
                      "few_records"
                    ]
                  }
                }
              },
              "required": [
                "taxon_id",
                "slug",
                "scientific_name",
                "common_name",
                "group_code",
                "reference_photo",
                "evidence_kind",
                "month_occurrences",
                "season_occurrences",
                "peak_month",
                "habitat",
                "reasons"
              ],
              "additionalProperties": false
            }
          },
          "checklist": {
            "maxItems": 60,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "taxon_id": {
                  "type": "string",
                  "pattern": "^[1-9]\\d{0,19}$"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "todo",
                    "seen",
                    "skipped"
                  ]
                },
                "observation_ref": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^(sighting|identification):[A-Za-z0-9_-]{1,64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "seen_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "current": {
                  "type": "boolean"
                }
              },
              "required": [
                "taxon_id",
                "status",
                "observation_ref",
                "seen_at",
                "current"
              ],
              "additionalProperties": false
            }
          },
          "progress": {
            "type": "object",
            "properties": {
              "seen": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "skipped": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "total": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              }
            },
            "required": [
              "seen",
              "skipped",
              "total"
            ],
            "additionalProperties": false
          },
          "next_action": {
            "type": "string",
            "enum": [
              "wait_for_data",
              "pick_place",
              "go_explore",
              "log_sightings",
              "review_progress",
              "plan_complete"
            ]
          },
          "explanation": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1200
              },
              "source": {
                "type": "string",
                "enum": [
                  "template",
                  "ai"
                ]
              }
            },
            "required": [
              "text",
              "source"
            ],
            "additionalProperties": false
          },
          "safety": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "keep_distance",
                "do_not_feed",
                "protect_sensitive_locations",
                "check_local_rules",
                "tell_someone_route",
                "step_free_unverified"
              ]
            }
          },
          "reminder": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  "utc_offset_minutes": {
                    "type": "integer",
                    "minimum": -840,
                    "maximum": 840
                  },
                  "quiet_start": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 23
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "quiet_end": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 23
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "scheduled",
                      "delivered",
                      "cancelled"
                    ]
                  },
                  "delivered_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "at",
                  "utc_offset_minutes",
                  "quiet_start",
                  "quiet_end",
                  "status",
                  "delivered_at"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "created_by": {
            "type": "string",
            "enum": [
              "account",
              "agent"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "id",
          "revision",
          "status",
          "job_state",
          "intent",
          "evidence",
          "recommendations",
          "checklist",
          "progress",
          "next_action",
          "explanation",
          "safety",
          "reminder",
          "created_by",
          "created_at",
          "updated_at"
        ],
        "additionalProperties": false
      },
      "PlanList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^cp_[A-Za-z0-9_-]{22}$"
                },
                "revision": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "active",
                    "completed",
                    "cancelled"
                  ]
                },
                "job_state": {
                  "type": "string",
                  "enum": [
                    "ready",
                    "waiting_for_data",
                    "unavailable"
                  ]
                },
                "intent": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "default": null,
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 500
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "place": {
                      "type": "object",
                      "properties": {
                        "label": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 160
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "lat": {
                          "type": "number",
                          "minimum": -90,
                          "maximum": 90
                        },
                        "lng": {
                          "type": "number",
                          "minimum": -180,
                          "maximum": 180
                        },
                        "source": {
                          "type": "string",
                          "enum": [
                            "search",
                            "device",
                            "manual"
                          ]
                        }
                      },
                      "required": [
                        "label",
                        "lat",
                        "lng",
                        "source"
                      ],
                      "additionalProperties": false
                    },
                    "date": {
                      "type": "string",
                      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                    },
                    "duration_minutes": {
                      "default": 120,
                      "type": "integer",
                      "minimum": 15,
                      "maximum": 720
                    },
                    "interests": {
                      "default": [],
                      "maxItems": 10,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "mammal",
                          "bird",
                          "reptile",
                          "amphibian",
                          "fish",
                          "insect",
                          "arachnid",
                          "mollusc",
                          "crustacean",
                          "other"
                        ]
                      }
                    },
                    "constraints": {
                      "default": {
                        "step_free": false,
                        "transport": null
                      },
                      "type": "object",
                      "properties": {
                        "step_free": {
                          "default": false,
                          "type": "boolean"
                        },
                        "transport": {
                          "default": null,
                          "anyOf": [
                            {
                              "type": "string",
                              "enum": [
                                "walk",
                                "bike",
                                "car",
                                "public"
                              ]
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "step_free",
                        "transport"
                      ],
                      "additionalProperties": false
                    },
                    "lang": {
                      "default": "en",
                      "type": "string",
                      "enum": [
                        "pt-PT",
                        "en",
                        "es"
                      ]
                    }
                  },
                  "required": [
                    "text",
                    "place",
                    "date",
                    "duration_minutes",
                    "interests",
                    "constraints",
                    "lang"
                  ],
                  "additionalProperties": false
                },
                "evidence": {
                  "type": "object",
                  "properties": {
                    "cell_id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    },
                    "month": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 12
                    },
                    "season": {
                      "type": "string",
                      "enum": [
                        "winter",
                        "spring",
                        "summer",
                        "autumn"
                      ]
                    },
                    "hemisphere": {
                      "type": "string",
                      "enum": [
                        "north",
                        "south"
                      ]
                    },
                    "data_status": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "stale",
                        "pending",
                        "unavailable"
                      ]
                    },
                    "refreshed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "attribution": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "provider": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 40
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "url": {
                            "type": "string",
                            "format": "uri"
                          }
                        },
                        "required": [
                          "provider",
                          "text",
                          "url"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "cell_id",
                    "month",
                    "season",
                    "hemisphere",
                    "data_status",
                    "refreshed_at",
                    "attribution"
                  ],
                  "additionalProperties": false
                },
                "recommendations": {
                  "maxItems": 20,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "taxon_id": {
                        "type": "string",
                        "pattern": "^[1-9]\\d{0,19}$"
                      },
                      "slug": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "scientific_name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "common_name": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "group_code": {
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "reference_photo": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "url": {
                                "type": "string",
                                "format": "uri"
                              },
                              "licence": {
                                "type": "string"
                              },
                              "author": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "source_url": {
                                "type": "string",
                                "format": "uri"
                              }
                            },
                            "required": [
                              "url",
                              "licence",
                              "author",
                              "source_url"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "evidence_kind": {
                        "type": "string",
                        "const": "historical_records"
                      },
                      "month_occurrences": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "season_occurrences": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "peak_month": {
                        "anyOf": [
                          {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 12
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "habitat": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "water",
                              "land"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "reasons": {
                        "maxItems": 6,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "most_recorded_this_month",
                            "seasonal_peak",
                            "matches_interest",
                            "water_habitat",
                            "land_habitat",
                            "few_records"
                          ]
                        }
                      }
                    },
                    "required": [
                      "taxon_id",
                      "slug",
                      "scientific_name",
                      "common_name",
                      "group_code",
                      "reference_photo",
                      "evidence_kind",
                      "month_occurrences",
                      "season_occurrences",
                      "peak_month",
                      "habitat",
                      "reasons"
                    ],
                    "additionalProperties": false
                  }
                },
                "checklist": {
                  "maxItems": 60,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "taxon_id": {
                        "type": "string",
                        "pattern": "^[1-9]\\d{0,19}$"
                      },
                      "status": {
                        "type": "string",
                        "enum": [
                          "todo",
                          "seen",
                          "skipped"
                        ]
                      },
                      "observation_ref": {
                        "anyOf": [
                          {
                            "type": "string",
                            "pattern": "^(sighting|identification):[A-Za-z0-9_-]{1,64}$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "seen_at": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "current": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "taxon_id",
                      "status",
                      "observation_ref",
                      "seen_at",
                      "current"
                    ],
                    "additionalProperties": false
                  }
                },
                "progress": {
                  "type": "object",
                  "properties": {
                    "seen": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "skipped": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "seen",
                    "skipped",
                    "total"
                  ],
                  "additionalProperties": false
                },
                "next_action": {
                  "type": "string",
                  "enum": [
                    "wait_for_data",
                    "pick_place",
                    "go_explore",
                    "log_sightings",
                    "review_progress",
                    "plan_complete"
                  ]
                },
                "explanation": {
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1200
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "template",
                        "ai"
                      ]
                    }
                  },
                  "required": [
                    "text",
                    "source"
                  ],
                  "additionalProperties": false
                },
                "safety": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "keep_distance",
                      "do_not_feed",
                      "protect_sensitive_locations",
                      "check_local_rules",
                      "tell_someone_route",
                      "step_free_unverified"
                    ]
                  }
                },
                "reminder": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        "utc_offset_minutes": {
                          "type": "integer",
                          "minimum": -840,
                          "maximum": 840
                        },
                        "quiet_start": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 23
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "quiet_end": {
                          "anyOf": [
                            {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 23
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "scheduled",
                            "delivered",
                            "cancelled"
                          ]
                        },
                        "delivered_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        }
                      },
                      "required": [
                        "at",
                        "utc_offset_minutes",
                        "quiet_start",
                        "quiet_end",
                        "status",
                        "delivered_at"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "created_by": {
                  "type": "string",
                  "enum": [
                    "account",
                    "agent"
                  ]
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "updated_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "id",
                "revision",
                "status",
                "job_state",
                "intent",
                "evidence",
                "recommendations",
                "checklist",
                "progress",
                "next_action",
                "explanation",
                "safety",
                "reminder",
                "created_by",
                "created_at",
                "updated_at"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "CreatePlan": {
        "type": "object",
        "properties": {
          "intent": {
            "type": "object",
            "properties": {
              "text": {
                "default": null,
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 500
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "place": {
                "type": "object",
                "properties": {
                  "label": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lat": {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90
                  },
                  "lng": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "search",
                      "device",
                      "manual"
                    ]
                  }
                },
                "required": [
                  "label",
                  "lat",
                  "lng",
                  "source"
                ],
                "additionalProperties": false
              },
              "date": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "duration_minutes": {
                "default": 120,
                "type": "integer",
                "minimum": 15,
                "maximum": 720
              },
              "interests": {
                "default": [],
                "maxItems": 10,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "mammal",
                    "bird",
                    "reptile",
                    "amphibian",
                    "fish",
                    "insect",
                    "arachnid",
                    "mollusc",
                    "crustacean",
                    "other"
                  ]
                }
              },
              "constraints": {
                "default": {
                  "step_free": false,
                  "transport": null
                },
                "type": "object",
                "properties": {
                  "step_free": {
                    "default": false,
                    "type": "boolean"
                  },
                  "transport": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "walk",
                          "bike",
                          "car",
                          "public"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              },
              "lang": {
                "default": "en",
                "type": "string",
                "enum": [
                  "pt-PT",
                  "en",
                  "es"
                ]
              }
            },
            "required": [
              "place",
              "date"
            ],
            "additionalProperties": false
          },
          "explain": {
            "default": "template",
            "type": "string",
            "enum": [
              "template",
              "ai"
            ]
          }
        },
        "required": [
          "intent"
        ],
        "additionalProperties": false
      },
      "UpdatePlan": {
        "type": "object",
        "properties": {
          "revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "intent": {
            "type": "object",
            "properties": {
              "text": {
                "default": null,
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 500
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "place": {
                "type": "object",
                "properties": {
                  "label": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 160
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "lat": {
                    "type": "number",
                    "minimum": -90,
                    "maximum": 90
                  },
                  "lng": {
                    "type": "number",
                    "minimum": -180,
                    "maximum": 180
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "search",
                      "device",
                      "manual"
                    ]
                  }
                },
                "required": [
                  "label",
                  "lat",
                  "lng",
                  "source"
                ],
                "additionalProperties": false
              },
              "date": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              "duration_minutes": {
                "default": 120,
                "type": "integer",
                "minimum": 15,
                "maximum": 720
              },
              "interests": {
                "default": [],
                "maxItems": 10,
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "mammal",
                    "bird",
                    "reptile",
                    "amphibian",
                    "fish",
                    "insect",
                    "arachnid",
                    "mollusc",
                    "crustacean",
                    "other"
                  ]
                }
              },
              "constraints": {
                "default": {
                  "step_free": false,
                  "transport": null
                },
                "type": "object",
                "properties": {
                  "step_free": {
                    "default": false,
                    "type": "boolean"
                  },
                  "transport": {
                    "default": null,
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "walk",
                          "bike",
                          "car",
                          "public"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              },
              "lang": {
                "default": "en",
                "type": "string",
                "enum": [
                  "pt-PT",
                  "en",
                  "es"
                ]
              }
            },
            "required": [
              "place",
              "date"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "completed"
            ]
          }
        },
        "required": [
          "revision"
        ],
        "additionalProperties": false
      },
      "UpdateItem": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "todo",
              "seen",
              "skipped"
            ]
          },
          "observation_ref": {
            "default": null,
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(sighting|identification):[A-Za-z0-9_-]{1,64}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "status"
        ],
        "additionalProperties": false
      },
      "SetReminder": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "utc_offset_minutes": {
            "default": 0,
            "type": "integer",
            "minimum": -840,
            "maximum": 840
          },
          "quiet_start": {
            "default": null,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 23
              },
              {
                "type": "null"
              }
            ]
          },
          "quiet_end": {
            "default": null,
            "anyOf": [
              {
                "type": "integer",
                "minimum": 0,
                "maximum": 23
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "at"
        ],
        "additionalProperties": false
      },
      "DueReminders": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "plan_id": {
                  "type": "string",
                  "pattern": "^cp_[A-Za-z0-9_-]{22}$"
                },
                "place_label": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "plan_id",
                "place_label",
                "date",
                "at"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "CreateGrant": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "scopes": {
            "minItems": 1,
            "maxItems": 3,
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "plans:read",
                "plans:write",
                "reminders:write"
              ]
            }
          },
          "expires_in_days": {
            "default": 30,
            "type": "integer",
            "minimum": 1,
            "maximum": 90
          }
        },
        "required": [
          "label",
          "scopes"
        ],
        "additionalProperties": false
      },
      "Grant": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ag_[A-Za-z0-9_-]{16}$"
          },
          "label": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "plans:read",
                "plans:write",
                "reminders:write"
              ]
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "label",
          "scopes",
          "created_at",
          "expires_at",
          "revoked_at",
          "last_used_at"
        ],
        "additionalProperties": false
      },
      "GrantCreated": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^ag_[A-Za-z0-9_-]{16}$"
          },
          "label": {
            "type": "string"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "plans:read",
                "plans:write",
                "reminders:write"
              ]
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "token": {
            "type": "string",
            "pattern": "^oaa_[A-Za-z0-9_-]{43}$"
          }
        },
        "required": [
          "id",
          "label",
          "scopes",
          "created_at",
          "expires_at",
          "revoked_at",
          "last_used_at",
          "token"
        ],
        "additionalProperties": false
      },
      "GrantList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "pattern": "^ag_[A-Za-z0-9_-]{16}$"
                },
                "label": {
                  "type": "string"
                },
                "scopes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "plans:read",
                      "plans:write",
                      "reminders:write"
                    ]
                  }
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "expires_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "revoked_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "last_used_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "label",
                "scopes",
                "created_at",
                "expires_at",
                "revoked_at",
                "last_used_at"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      },
      "AuditList": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                "actor": {
                  "type": "string",
                  "enum": [
                    "account",
                    "agent"
                  ]
                },
                "grant_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "action": {
                  "type": "string",
                  "maxLength": 40
                },
                "plan_id": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^cp_[A-Za-z0-9_-]{22}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "at",
                "actor",
                "grant_id",
                "action",
                "plan_id"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "items"
        ],
        "additionalProperties": false
      }
    }
  }
}
