{
  "openapi": "3.1.0",
  "info": {
    "title": "Misión Mascota public API",
    "version": "1.2.0",
    "description": "Read-only access to public lost, found and seen pet posts in Argentina, for AI agents and integrations. No authentication. Contact details are never exposed and coordinates are approximate. Content is in Spanish (es-AR). An MCP server with the same data lives at https://misionmascota.org/mcp.",
    "contact": {
      "url": "https://misionmascota.org"
    }
  },
  "servers": [
    {
      "url": "https://misionmascota.org/api/v1"
    }
  ],
  "paths": {
    "/pets": {
      "get": {
        "operationId": "searchPets",
        "summary": "List public posts by filters",
        "description": "Paginated, newest event first. For one specific pet your user describes, prefer POST /pets/match.",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "lost",
                "found",
                "seen"
              ]
            },
            "description": "The list to read. lost: posts of pets their family is looking for; read them when your user (the human you are chatting with) found or saw a loose pet. found: pets someone is keeping until the family turns up; seen: pets someone saw loose but did not keep. Read found and seen when your user lost their pet."
          },
          {
            "name": "species",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "dog",
                "cat"
              ]
            }
          },
          {
            "name": "gender",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "M",
                "F",
                "U"
              ]
            }
          },
          {
            "name": "province",
            "in": "query",
            "schema": {
              "type": "string",
              "description": "Argentine province, verbatim from GET /api/v1/meta (provinces)."
            }
          },
          {
            "name": "city",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 100
            }
          },
          {
            "name": "date_from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "date_to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "lat",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "With lng and radius_km."
          },
          {
            "name": "lng",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "radius_km",
            "in": "query",
            "schema": {
              "type": "number",
              "maximum": 500
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of posts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Pet"
                      }
                    },
                    "meta": {
                      "type": "object"
                    },
                    "links": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        }
      }
    },
    "/pets/match": {
      "get": {
        "operationId": "findMatchingPetsByQuery",
        "summary": "Rank public posts against one described pet (query string)",
        "description": "Same as the POST form, for agents whose fetch tool can only send GET. Example: /pets/match?kind=lost&species=dog&date=2026-11-20&province=Buenos%20Aires&sex=male&size=medium&coat_colors=black,white",
        "parameters": [
          {
            "name": "kind",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "lost",
                "found",
                "seen"
              ]
            },
            "description": "Your user's own situation (the human you are chatting with, not anyone in the posts), not the list to search: the engine searches the opposite lists. lost = your user lost their pet (\"perdí a mi perro\"), searches found and seen posts. found = your user has a pet that is not theirs and wants to know who is looking for it (\"encontré un perro\", \"quiero saber quién lo busca\"), searches lost posts. seen = your user saw a loose pet and did not keep it (\"vi un perro suelto\"), searches lost posts. Never send lost when your user found a pet: that compares it with other found pets."
          },
          {
            "name": "species",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "dog",
                "cat"
              ]
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "When it was lost, found or seen; within the last year."
          },
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -56,
              "maximum": -21
            }
          },
          {
            "name": "lng",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": -74,
              "maximum": -53
            }
          },
          {
            "name": "province",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Required without lat/lng. Argentine province, verbatim from GET /api/v1/meta (provinces)."
          },
          {
            "name": "city",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            },
            "description": "Optional, narrows the results."
          },
          {
            "name": "sex",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "male",
                "female",
                "unknown"
              ]
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "mini",
                "small",
                "medium",
                "large",
                "giant"
              ]
            }
          },
          {
            "name": "coat_length",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "hairless",
                "short",
                "medium",
                "long"
              ]
            }
          },
          {
            "name": "coat_colors",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Comma-separated, up to 3: black, white, cream, fawn, golden, light_brown, dark_brown, reddish_brown, gray, silver, blue_gray"
            },
            "description": "Comma-separated colour codes, main one first."
          },
          {
            "name": "breed",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 80
            },
            "description": "Spanish breed name as used in Argentina; leave out for mixed breeds."
          }
        ],
        "responses": {
          "200": {
            "description": "Candidates, best first. Empty results carry next_step with the publish link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchResponse"
                }
              }
            }
          },
          "404": {
            "description": "Scored search is switched off."
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        }
      },
      "post": {
        "operationId": "findMatchingPets",
        "summary": "Rank public posts against one described pet",
        "description": "Scores public posts of the opposite kind with the site's matching engine: a lost pet against found and seen posts, a found or seen pet against lost posts, within 60 km (or the province) and dated consistently. Returns at most 20 candidates above the engine's threshold, with plain reasons. Send at least 2 usable traits (sex other than unknown, size, coat_length, coat_colors, a recognized breed); geocode the place yourself. Limited per IP. Answers 404 while switched off. The body may instead be a MEIDAM-AR document (POST only); it is recognized by meidam_version.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/MatchQuery"
                  },
                  {
                    "$ref": "#/components/schemas/MeidamMatchQuery"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Candidates, best first. Empty results carry next_step with the publish link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchResponse"
                }
              }
            }
          },
          "404": {
            "description": "Scored search is switched off."
          },
          "422": {
            "$ref": "#/components/responses/Invalid"
          },
          "429": {
            "$ref": "#/components/responses/TooMany"
          }
        }
      }
    },
    "/pets/{id}": {
      "get": {
        "operationId": "getPet",
        "summary": "One public post by pet id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The post",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Pet"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Missing or not public."
          }
        }
      }
    },
    "/meta": {
      "get": {
        "operationId": "getVocabulary",
        "summary": "Valid filter values",
        "description": "Types (each with when to read it), species, genders, provinces and, while scored search is on, the match codes with match.kinds (when to send each kind: the opposite of types).",
        "responses": {
          "200": {
            "description": "Vocabulary",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Pet": {
        "type": "object",
        "description": "A public post. Contact is always null; coordinates are rounded to ~1 km; free text has contact details replaced by \"[contacto oculto]\".",
        "properties": {
          "id": {
            "type": "integer"
          },
          "type": {
            "type": "string",
            "enum": [
              "lost",
              "found",
              "seen"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "reunited",
              "unknown"
            ]
          },
          "species": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "dog",
              "cat",
              null
            ]
          },
          "pet_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "characteristics": {
            "type": "object",
            "properties": {
              "breed": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "size": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "gender": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "colors": {},
              "coat_length": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "location": {
            "type": "object",
            "properties": {
              "city": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "province": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "lat": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "lng": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "dates": {
            "type": "object",
            "properties": {
              "event_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "posted_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              }
            }
          },
          "story": {
            "type": [
              "string",
              "null"
            ]
          },
          "photo": {
            "type": "object",
            "properties": {
              "thumbnail": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "full": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri"
              },
              "usage": {
                "type": "string",
                "description": "The display rule above, repeated in every response for agents."
              }
            },
            "description": "A public photo of the animal itself (never a poster or a family photo). Show only this image for this pet, or link it; never search the web or generate one. When both URLs are null there is no public photo: show none."
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Canonical page. Always show it: your user acts from there."
          },
          "contact": {
            "type": "null"
          }
        }
      },
      "MatchQuery": {
        "type": "object",
        "required": [
          "kind",
          "species",
          "date"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "lost",
              "found",
              "seen"
            ],
            "description": "Your user's own situation (the human you are chatting with, not anyone in the posts), not the list to search: the engine searches the opposite lists. lost = your user lost their pet (\"perdí a mi perro\"), searches found and seen posts. found = your user has a pet that is not theirs and wants to know who is looking for it (\"encontré un perro\", \"quiero saber quién lo busca\"), searches lost posts. seen = your user saw a loose pet and did not keep it (\"vi un perro suelto\"), searches lost posts. Never send lost when your user found a pet: that compares it with other found pets."
          },
          "species": {
            "type": "string",
            "enum": [
              "dog",
              "cat"
            ]
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "When it was lost, found or seen; within the last year."
          },
          "lat": {
            "type": "number",
            "minimum": -56,
            "maximum": -21
          },
          "lng": {
            "type": "number",
            "minimum": -74,
            "maximum": -53
          },
          "province": {
            "type": "string",
            "description": "Required without lat/lng. Argentine province, verbatim from GET /api/v1/meta (provinces)."
          },
          "city": {
            "type": "string",
            "maxLength": 80,
            "description": "Optional, narrows the results."
          },
          "sex": {
            "type": "string",
            "enum": [
              "male",
              "female",
              "unknown"
            ]
          },
          "size": {
            "type": "string",
            "enum": [
              "mini",
              "small",
              "medium",
              "large",
              "giant"
            ]
          },
          "coat_length": {
            "type": "string",
            "enum": [
              "hairless",
              "short",
              "medium",
              "long"
            ]
          },
          "coat_colors": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "string",
              "enum": [
                "black",
                "white",
                "cream",
                "fawn",
                "golden",
                "light_brown",
                "dark_brown",
                "reddish_brown",
                "gray",
                "silver",
                "blue_gray"
              ]
            }
          },
          "breed": {
            "type": "string",
            "maxLength": 80,
            "description": "Spanish breed name as used in Argentina; leave out for mixed breeds."
          }
        }
      },
      "MatchResponse": {
        "type": "object",
        "required": [
          "searched",
          "results"
        ],
        "properties": {
          "searched": {
            "type": "object",
            "description": "What the query was read as and which lists were searched. Tell your user, so a wrong kind shows.",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "lost",
                  "found",
                  "seen"
                ]
              },
              "among": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "lost",
                    "found",
                    "seen"
                  ]
                }
              }
            }
          },
          "results": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "object",
              "properties": {
                "score": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 100
                },
                "reasons": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "pet": {
                  "$ref": "#/components/schemas/Pet"
                }
              }
            }
          },
          "next_step": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "publish_url": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      },
      "MeidamMatchQuery": {
        "type": "object",
        "required": [
          "meidam_version",
          "pet"
        ],
        "description": "A MEIDAM-AR document (open pet data standard, draft) carrying the described pet and exactly one case. The case needs its date (lost_at, found_at or seen_at) and location.state; origin and status may be left out. Checked against the declared meidam_version. Extra traits (eyes, tail, neutered, collar) improve the score; accessory details are used for scoring only and never echoed or stored. The same minimum of 2 usable traits applies.",
        "externalDocs": {
          "description": "MEIDAM-AR standard",
          "url": "https://misionmascota.org/desarrolladores/estandar/0.3.0"
        },
        "properties": {
          "meidam_version": {
            "type": "string",
            "examples": [
              "0.3.0"
            ]
          },
          "pet": {
            "type": "object",
            "description": "MEIDAM-AR pet: codes D/C, M/F/U, size 1-5, coat_length 0-3, colours as hex from the coat palette. Whole-document JSON Schema: https://misionmascota.org/desarrolladores/estandar/0.3.0/pet.schema.json"
          },
          "lost_pet": {
            "type": "object"
          },
          "found_pet": {
            "type": "object"
          },
          "seen_pet": {
            "type": "object"
          }
        },
        "oneOf": [
          {
            "required": [
              "lost_pet"
            ]
          },
          {
            "required": [
              "found_pet"
            ]
          },
          {
            "required": [
              "seen_pet"
            ]
          }
        ]
      }
    },
    "responses": {
      "Invalid": {
        "description": "Invalid query; messages say what to fix or ask your user.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "message": {
                  "type": "string"
                },
                "errors": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "TooMany": {
        "description": "Rate limited; see Retry-After.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          }
        }
      }
    }
  }
}
