{
  "openapi": "3.1.0",
  "info": {
    "title": "Anime Meta read-only API",
    "version": "1.0.0",
    "description": "Look up anime one show at a time. At most 10 results per search, no listing or bulk endpoint, 60 requests per minute per address. Scores belong to their sites."
  },
  "servers": [
    {
      "url": "https://anime-meta.com"
    }
  ],
  "paths": {
    "/api/v1/search": {
      "get": {
        "operationId": "searchAnime",
        "summary": "Search shows by title",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 2,
              "maxLength": 100
            },
            "description": "Title or part of a title, any language"
          }
        ],
        "responses": {
          "200": {
            "description": "Up to 10 shows, most popular first",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed per minute (60)"
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/anime/{slug}": {
      "get": {
        "operationId": "getAnime",
        "summary": "One show with scores, airing and links",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Slug from a search result"
          }
        ],
        "responses": {
          "200": {
            "description": "The show",
            "headers": {
              "X-RateLimit-Limit": {
                "schema": {
                  "type": "integer"
                },
                "description": "Requests allowed per minute (60)"
              },
              "X-RateLimit-Remaining": {
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Anime"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "SearchResult": {
        "type": "object",
        "required": [
          "slug",
          "title",
          "url"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "title_native": {
            "type": [
              "string",
              "null"
            ]
          },
          "year": {
            "type": [
              "integer",
              "null"
            ]
          },
          "season": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "WINTER",
              "SPRING",
              "SUMMER",
              "FALL",
              null
            ]
          },
          "format": {
            "type": [
              "string",
              "null"
            ]
          },
          "episodes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "combined_score": {
            "type": [
              "number",
              "null"
            ],
            "description": "0-100; null when too few ratings"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "required": [
          "query",
          "results"
        ],
        "properties": {
          "query": {
            "type": "string"
          },
          "results": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/SearchResult"
            }
          }
        }
      },
      "SourceScore": {
        "type": "object",
        "properties": {
          "source": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "score_raw": {
            "type": [
              "string",
              "null"
            ],
            "description": "As the site shows it"
          },
          "score_100": {
            "type": [
              "number",
              "null"
            ]
          },
          "ratings": {
            "type": [
              "integer",
              "null"
            ]
          },
          "as_of": {
            "type": [
              "string",
              "null"
            ],
            "description": "Date fetched (YYYY-MM-DD)"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "stale": {
            "type": "boolean"
          }
        }
      },
      "Anime": {
        "type": "object",
        "required": [
          "slug",
          "title",
          "url",
          "score",
          "airing",
          "links"
        ],
        "properties": {
          "slug": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "title": {
            "type": "string"
          },
          "title_english": {
            "type": [
              "string",
              "null"
            ]
          },
          "title_romaji": {
            "type": [
              "string",
              "null"
            ]
          },
          "title_native": {
            "type": [
              "string",
              "null"
            ]
          },
          "synonyms": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "format": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "season": {
            "type": [
              "string",
              "null"
            ]
          },
          "year": {
            "type": [
              "integer",
              "null"
            ]
          },
          "start_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "end_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "episodes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "duration_minutes": {
            "type": [
              "integer",
              "null"
            ]
          },
          "studios": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "genres": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "age_rating": {
            "type": [
              "string",
              "null"
            ]
          },
          "synopsis": {
            "type": [
              "string",
              "null"
            ]
          },
          "score": {
            "type": "object",
            "properties": {
              "combined": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "combined_scale": {
                "type": "string"
              },
              "combined_sources": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "combined_ratings": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "note": {
                "type": "string"
              },
              "sources": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SourceScore"
                }
              }
            }
          },
          "airing": {
            "type": "object",
            "properties": {
              "next_episode": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "next_airing_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "episodes": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "episode": {
                      "type": "integer"
                    },
                    "airing_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "aired": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "links": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "site": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}