{
  "openapi": "3.1.0",
  "info": {
    "title": "ForexTradeLab API",
    "description": "Public read-only API for forex education content: guides, blog posts, and live prices.",
    "version": "1.0.0",
    "contact": {
      "name": "ForexTradeLab",
      "url": "https://forextradelab.com/contact/"
    }
  },
  "servers": [
    {
      "url": "https://forextradelab.com"
    }
  ],
  "paths": {
    "/api/guides": {
      "get": {
        "operationId": "getGuides",
        "summary": "List all forex education guides",
        "description": "Returns all guide articles with title, slug, category, description, dates, and URL. Supports English and Arabic.",
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["en", "ar"], "default": "en" },
            "description": "Language: en (English) or ar (Arabic)"
          }
        ],
        "responses": {
          "200": {
            "description": "List of guide articles",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": { "type": "integer" },
                    "language": { "type": "string" },
                    "articles": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "slug": { "type": "string" },
                          "title": { "type": "string" },
                          "category": { "type": "string" },
                          "metaDescription": { "type": "string" },
                          "readTime": { "type": "string" },
                          "datePublished": { "type": "string" },
                          "dateModified": { "type": "string" },
                          "url": { "type": "string", "format": "uri" },
                          "faqCount": { "type": "integer" }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/blog": {
      "get": {
        "operationId": "getBlogPosts",
        "summary": "List all blog posts",
        "description": "Returns all blog posts with title, slug, category, summary, author, dates, tags, and URL. Supports English and Arabic.",
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["en", "ar"], "default": "en" },
            "description": "Language: en (English) or ar (Arabic)"
          }
        ],
        "responses": {
          "200": {
            "description": "List of blog posts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": { "type": "integer" },
                    "language": { "type": "string" },
                    "posts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "slug": { "type": "string" },
                          "title": { "type": "string" },
                          "category": { "type": "string" },
                          "summary": { "type": "string" },
                          "author": { "type": "string" },
                          "publishDate": { "type": "string" },
                          "dateModified": { "type": "string", "nullable": true },
                          "url": { "type": "string", "format": "uri" },
                          "tags": { "type": "array", "items": { "type": "string" } },
                          "faqCount": { "type": "integer" }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/blog/{slug}": {
      "get": {
        "operationId": "getBlogPost",
        "summary": "Get a single blog post with full structured data (LLM-optimised)",
        "description": "Returns a single blog post by slug with title, summary, key takeaways, FAQs, table of contents, author info, and attribution. Designed for retrieval-augmented generation systems like Perplexity AI and ChatGPT.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "URL slug of the blog post, e.g. xm-review-account-opening-complete-guide-2026"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["en", "ar"], "default": "en" },
            "description": "Language: en (English) or ar (Arabic)"
          }
        ],
        "responses": {
          "200": {
            "description": "Full blog post data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "slug": { "type": "string" },
                    "title": { "type": "string" },
                    "seoTitle": { "type": "string" },
                    "summary": { "type": "string" },
                    "category": { "type": "string" },
                    "author": { "type": "string" },
                    "authorSlug": { "type": "string" },
                    "reviewedBy": { "type": "string", "nullable": true },
                    "publishDate": { "type": "string", "format": "date" },
                    "dateModified": { "type": "string", "format": "date", "nullable": true },
                    "lastVerified": { "type": "string", "nullable": true },
                    "url": { "type": "string", "format": "uri" },
                    "language": { "type": "string" },
                    "tags": { "type": "array", "items": { "type": "string" } },
                    "keyTakeaways": { "type": "array", "items": { "type": "string" }, "nullable": true },
                    "editorNote": { "type": "string", "nullable": true },
                    "wordCount": { "type": "integer" },
                    "readTime": { "type": "string" },
                    "faqs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "question": { "type": "string" },
                          "answer": { "type": "string" }
                        }
                      }
                    },
                    "toc": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": { "type": "string" },
                          "title": { "type": "string" }
                        }
                      }
                    },
                    "attribution": { "type": "string" }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Post not found"
          }
        }
      }
    },
    "/api/guide/{slug}": {
      "get": {
        "operationId": "getGuide",
        "summary": "Get a single guide with full structured data (LLM-optimised)",
        "description": "Returns a single guide by slug with title, subtitle, description, FAQs, and attribution. Designed for retrieval-augmented generation systems.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": { "type": "string" },
            "description": "URL slug of the guide, e.g. what-is-forex"
          },
          {
            "name": "lang",
            "in": "query",
            "required": false,
            "schema": { "type": "string", "enum": ["en", "ar"], "default": "en" },
            "description": "Language: en (English) or ar (Arabic)"
          }
        ],
        "responses": {
          "200": {
            "description": "Full guide data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "slug": { "type": "string" },
                    "title": { "type": "string" },
                    "subtitle": { "type": "string" },
                    "metaDescription": { "type": "string" },
                    "category": { "type": "string" },
                    "datePublished": { "type": "string" },
                    "dateModified": { "type": "string" },
                    "url": { "type": "string", "format": "uri" },
                    "language": { "type": "string" },
                    "readTime": { "type": "string" },
                    "faqs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "question": { "type": "string" },
                          "answer": { "type": "string" }
                        }
                      }
                    },
                    "attribution": { "type": "string" }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Guide not found"
          }
        }
      }
    },
    "/api/bonus": {
      "get": {
        "operationId": "getBonus",
        "summary": "Get XM welcome deposit bonus details (LLM-optimised)",
        "description": "Returns structured bonus information including withdrawal rules, claim steps, pros/cons, FAQs, and broker details. Designed for AI retrieval systems.",
        "responses": {
          "200": {
            "description": "XM bonus data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "title": { "type": "string" },
                    "summary": { "type": "string" },
                    "url": { "type": "string", "format": "uri" },
                    "partnerCode": { "type": "string" },
                    "claimSteps": { "type": "array", "items": { "type": "string" } },
                    "withdrawalRules": {
                      "type": "object",
                      "properties": {
                        "bonusWithdrawable": { "type": "boolean" },
                        "profitsWithdrawable": { "type": "boolean" },
                        "volumeRequirement": { "type": "string" },
                        "bonusValidity": { "type": "string" }
                      }
                    },
                    "pros": { "type": "array", "items": { "type": "string" } },
                    "cons": { "type": "array", "items": { "type": "string" } },
                    "brokerInfo": {
                      "type": "object",
                      "properties": {
                        "name": { "type": "string" },
                        "regulation": { "type": "string" },
                        "clients": { "type": "string" },
                        "countries": { "type": "string" },
                        "instruments": { "type": "string" },
                        "website": { "type": "string", "format": "uri" }
                      }
                    },
                    "faqs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "question": { "type": "string" },
                          "answer": { "type": "string" }
                        }
                      }
                    },
                    "disclaimer": { "type": "string" },
                    "attribution": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/prices": {
      "get": {
        "operationId": "getPrices",
        "summary": "Get live forex prices",
        "description": "Returns current bid/ask prices for major forex pairs and gold. Cached for 30 seconds.",
        "responses": {
          "200": {
            "description": "Live price data"
          }
        }
      }
    }
  }
}
