{
  "openapi": "3.1.0",
  "info": {
    "title": "IPL Betting Public API",
    "description": "Read-only access to published IPL Betting articles through the stable /api/v1 URL namespace. This API is public and does not require authentication.",
    "version": "1.0.0",
    "contact": {
      "name": "IPL Betting Editorial Team",
      "email": "editorial@vegas11.org.in",
      "url": "https://iplbettingg.com/developers/"
    }
  },
  "x-api-versioning": {
    "strategy": "Major version in the URL path",
    "current": "v1",
    "compatibility": "Backward-compatible fields may be added within v1; breaking changes require a new major path.",
    "deprecation": "Deprecated aliases return a Deprecation header and a Link to the published policy. No Sunset date is currently scheduled."
  },
  "servers": [
    {
      "url": "https://iplbettingg.com",
      "description": "Production"
    }
  ],
  "externalDocs": {
    "description": "IPL Betting developer resources",
    "url": "https://iplbettingg.com/developers/"
  },
  "tags": [
    {
      "name": "Articles",
      "description": "Published sports articles and betting guides"
    }
  ],
  "paths": {
    "/api/v1/articles": {
      "get": {
        "tags": [
          "Articles"
        ],
        "operationId": "listPublishedArticles",
        "summary": "List published articles",
        "description": "Returns published IPL Betting articles with pagination. Use the returned slugs with the article endpoint or the canonical HTML URL.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Page"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Search"
          },
          {
            "$ref": "#/components/parameters/Category"
          }
        ],
        "responses": {
          "200": {
            "description": "Published article list.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArticleListResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request contains an invalid parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "405": {
            "description": "The HTTP method is not supported.",
            "headers": {
              "Allow": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "GET, HEAD"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "The API could not complete the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/articles/{slug}": {
      "get": {
        "tags": [
          "Articles"
        ],
        "operationId": "getPublishedArticle",
        "summary": "Get one published article",
        "parameters": [
          {
            "$ref": "#/components/parameters/Slug"
          }
        ],
        "responses": {
          "200": {
            "description": "Published article.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ArticleResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request contains an invalid parameter.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "The requested published article does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "405": {
            "description": "The HTTP method is not supported.",
            "headers": {
              "Allow": {
                "required": true,
                "schema": {
                  "type": "string",
                  "const": "GET, HEAD"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "The API could not complete the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "Page": {
        "name": "page",
        "in": "query",
        "description": "One-based page number.",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "default": 1
        }
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "description": "Number of articles per page. Maximum 100.",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 30
        }
      },
      "Search": {
        "name": "search",
        "in": "query",
        "description": "Case-insensitive search across title, slug, and excerpt. Maximum 200 characters.",
        "required": false,
        "schema": {
          "type": "string",
          "maxLength": 200
        }
      },
      "Category": {
        "name": "category",
        "in": "query",
        "description": "Filter by a category slug such as cricket, football, or tennis.",
        "required": false,
        "schema": {
          "type": "string"
        }
      },
      "Slug": {
        "name": "slug",
        "in": "path",
        "description": "Published article slug returned by the list endpoint.",
        "required": true,
        "schema": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "responses": {
      "ArticleList": {
        "description": "Published article list.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ArticleListResponse"
            }
          }
        }
      },
      "Article": {
        "description": "Published article.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ArticleResponse"
            }
          }
        }
      },
      "InvalidParameter": {
        "description": "The request contains an invalid parameter.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "success": false,
              "error": {
                "code": "invalid_parameter",
                "message": "limit must be a positive integer and no greater than 100.",
                "resolution": "Adjust the value and try the request again."
              }
            }
          }
        }
      },
      "NotFound": {
        "description": "The requested published article does not exist.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "MethodNotAllowed": {
        "description": "The HTTP method is not supported.",
        "headers": {
          "Allow": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      },
      "InternalError": {
        "description": "The API could not complete the request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    },
    "schemas": {
      "Article": {
        "type": "object",
        "required": [
          "id",
          "title",
          "slug",
          "excerpt",
          "content_html",
          "category_id",
          "author",
          "published_at",
          "updated_at",
          "seo_title",
          "seo_description",
          "featured_image",
          "image_url"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "excerpt": {
            "type": [
              "string",
              "null"
            ]
          },
          "content_html": {
            "type": [
              "string",
              "null"
            ]
          },
          "category_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "author": {
            "type": [
              "string",
              "null"
            ]
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "seo_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "seo_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "featured_image": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "image_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        }
      },
      "Pagination": {
        "type": "object",
        "required": [
          "page",
          "limit",
          "total",
          "totalPages"
        ],
        "properties": {
          "page": {
            "type": "integer",
            "minimum": 1
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "totalPages": {
            "type": "integer",
            "minimum": 1
          }
        }
      },
      "Category": {
        "type": "object",
        "required": [
          "id",
          "name",
          "slug"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          }
        }
      },
      "ArticleListResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "pagination",
          "links",
          "categories"
        ],
        "properties": {
          "success": {
            "const": true
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Article"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "links": {
            "$ref": "#/components/schemas/DiscoveryLinks"
          },
          "categories": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Category"
            }
          }
        }
      },
      "ArticleResponse": {
        "type": "object",
        "required": [
          "success",
          "data",
          "links"
        ],
        "properties": {
          "success": {
            "const": true
          },
          "data": {
            "$ref": "#/components/schemas/Article"
          },
          "links": {
            "$ref": "#/components/schemas/ArticleLinks"
          }
        }
      },
      "DiscoveryLinks": {
        "type": "object",
        "required": [
          "self",
          "documentation",
          "openapi"
        ],
        "properties": {
          "self": {
            "type": "string",
            "format": "uri"
          },
          "documentation": {
            "type": "string",
            "format": "uri"
          },
          "openapi": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ArticleLinks": {
        "type": "object",
        "required": [
          "self",
          "html",
          "documentation"
        ],
        "properties": {
          "self": {
            "type": "string",
            "format": "uri"
          },
          "html": {
            "type": "string",
            "format": "uri"
          },
          "documentation": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "code",
          "message",
          "resolution"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "invalid_parameter",
              "not_found",
              "method_not_allowed",
              "internal_error"
            ]
          },
          "message": {
            "type": "string"
          },
          "resolution": {
            "type": "string"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "success",
          "error"
        ],
        "properties": {
          "success": {
            "const": false
          },
          "error": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
