{
  "openapi": "3.0.3",
  "info": {
    "title": "Breed Health Score API",
    "version": "1.0.0",
    "description": "Free, read-only JSON API of dog-breed health data: median lifespan, conformation and hereditary-condition summaries, and the composite Breed Health Score (0 to 100) for 155 breeds. Licensed CC-BY-4.0; attribution with a link back to breedhealthscore.com is required.",
    "contact": {
      "name": "Breed Health Score",
      "url": "https://breedhealthscore.com/developers/"
    },
    "license": {
      "name": "CC-BY-4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  },
  "servers": [
    {
      "url": "https://breedhealthscore.com"
    }
  ],
  "paths": {
    "/api/breeds.json": {
      "get": {
        "summary": "List all breeds",
        "description": "Every breed with its Breed Health Score, median lifespan, size, commonly reported conditions and canonical URL.",
        "operationId": "listBreeds",
        "responses": {
          "200": {
            "description": "All breeds",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreedList"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/breeds/{slug}.json": {
      "get": {
        "summary": "Get one breed",
        "description": "Full detail for a single breed, including component scores and conditions.",
        "operationId": "getBreed",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "labrador-retriever"
          }
        ],
        "responses": {
          "200": {
            "description": "Breed detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreedDetail"
                }
              }
            }
          },
          "404": {
            "description": "Breed not found"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Breed": {
        "type": "object",
        "properties": {
          "breed": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "median_lifespan_years": {
            "type": "number"
          },
          "size": {
            "type": "string",
            "nullable": true
          },
          "brachycephalic": {
            "type": "boolean"
          },
          "conditions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "severe_count": {
            "type": "integer",
            "description": "Count of this breed's conditions classed as life-threatening or major-welfare."
          },
          "health_score": {
            "type": "integer"
          },
          "grade": {
            "type": "string"
          },
          "components": {
            "type": "object",
            "properties": {
              "longevity": {
                "type": "integer"
              },
              "conformation": {
                "type": "integer"
              },
              "burden": {
                "type": "integer",
                "nullable": true
              }
            }
          }
        }
      },
      "Envelope": {
        "type": "object",
        "properties": {
          "dataset": {
            "type": "string"
          },
          "api_version": {
            "type": "string"
          },
          "licence": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "source_url": {
            "type": "string"
          },
          "attribution": {
            "type": "string"
          },
          "docs": {
            "type": "string"
          }
        }
      },
      "BreedList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "total": {
                "type": "integer"
              },
              "count": {
                "type": "integer"
              },
              "breeds": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Breed"
                }
              }
            }
          }
        ]
      },
      "BreedDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "breed": {
                "$ref": "#/components/schemas/Breed"
              }
            }
          }
        ]
      }
    }
  }
}