{
  "openapi": "3.1.0",
  "info": {
    "title": "Petnecto API",
    "version": "1.0.0",
    "summary": "Paw to paw. Every pet, one question away.",
    "description": "Adoptable pets as JSON. No key. Every pet in one plain format, with a link to its own listing. Add ?output=md for Markdown.",
    "contact": {
      "email": "hello@squatch.cc"
    }
  },
  "servers": [
    {
      "url": "https://petnecto.com"
    }
  ],
  "paths": {
    "/api/v1/pets": {
      "get": {
        "operationId": "find_pets",
        "summary": "Search adoptable pets",
        "parameters": [
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "US, CA or TW",
            "schema": {
              "type": "string",
              "enum": [
                "US",
                "CA",
                "TW"
              ]
            }
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "description": "Taiwan county or city (with country=TW)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "near",
            "in": "query",
            "required": false,
            "description": "US ZIP or Canadian postal code",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "miles",
            "in": "query",
            "required": false,
            "description": "Radius, 1-500 (default 50)",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "species",
            "in": "query",
            "required": false,
            "description": "Dog, Cat, Rabbit...",
            "schema": {
              "type": "string",
              "enum": [
                "Dog",
                "Cat",
                "Rabbit",
                "Bird",
                "Horse",
                "Small animal",
                "Reptile",
                "Pig",
                "Barnyard"
              ]
            }
          },
          {
            "name": "age",
            "in": "query",
            "required": false,
            "description": "Age group",
            "schema": {
              "type": "string",
              "enum": [
                "Baby",
                "Young",
                "Adult",
                "Senior"
              ]
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "description": "Size group",
            "schema": {
              "type": "string",
              "enum": [
                "Small",
                "Medium",
                "Large",
                "X-Large"
              ]
            }
          },
          {
            "name": "sex",
            "in": "query",
            "required": false,
            "description": "Sex",
            "schema": {
              "type": "string",
              "enum": [
                "Male",
                "Female"
              ]
            }
          },
          {
            "name": "good_with",
            "in": "query",
            "required": false,
            "description": "Comma list of dogs, cats, kids",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page, 1-100",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Language for names and text (else Accept-Language)",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "es",
                "zh-Hant",
                "zh-Hans",
                "ko",
                "ja",
                "vi",
                "fr",
                "ar",
                "tl"
              ]
            }
          },
          {
            "name": "output",
            "in": "query",
            "required": false,
            "description": "md for Markdown instead of JSON",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "md"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The answer as JSON (or Markdown with output=md)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/error"
          },
          "429": {
            "$ref": "#/components/responses/error"
          },
          "502": {
            "$ref": "#/components/responses/error"
          },
          "503": {
            "$ref": "#/components/responses/error"
          }
        }
      }
    },
    "/api/v1/pets/{id}": {
      "get": {
        "operationId": "get_pet",
        "summary": "One pet",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^(rg|tw|sample)-\\d{1,12}$"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "description": "Language for names and text (else Accept-Language)",
            "schema": {
              "type": "string",
              "enum": [
                "en",
                "es",
                "zh-Hant",
                "zh-Hans",
                "ko",
                "ja",
                "vi",
                "fr",
                "ar",
                "tl"
              ]
            }
          },
          {
            "name": "output",
            "in": "query",
            "required": false,
            "description": "md for Markdown instead of JSON",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "md"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The answer as JSON (or Markdown with output=md)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/error"
          },
          "429": {
            "$ref": "#/components/responses/error"
          },
          "502": {
            "$ref": "#/components/responses/error"
          }
        }
      }
    },
    "/api/v1/rescues/{id}": {
      "get": {
        "operationId": "get_rescue",
        "summary": "One rescue or shelter",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^(rg-org-[a-z0-9]{1,12}|tw-shelter-\\d{1,6})$"
            }
          },
          {
            "name": "output",
            "in": "query",
            "required": false,
            "description": "md for Markdown instead of JSON",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "md"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The answer as JSON (or Markdown with output=md)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/error"
          },
          "429": {
            "$ref": "#/components/responses/error"
          },
          "502": {
            "$ref": "#/components/responses/error"
          }
        }
      }
    },
    "/api/v1/about": {
      "get": {
        "operationId": "about_this_service",
        "summary": "Sources, operator, and takedowns",
        "parameters": [
          {
            "name": "output",
            "in": "query",
            "required": false,
            "description": "md for Markdown instead of JSON",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "md"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The answer as JSON (or Markdown with output=md)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "error": {
        "description": "What went wrong, in a sentence",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "error": {
                  "type": "string"
                }
              },
              "required": [
                "error"
              ]
            }
          }
        }
      }
    }
  }
}
