{
    "openapi": "3.1.0",
    "info": {
        "title": "WikiXchange Rates API",
        "version": "1.0.0",
        "description": "نرخ فروش لحظه‌ای ارزهای دیجیتال در صرافی ویکی‌اکسچنج. فقط نرخ فروش منتشر می‌شود (مبلغی که کاربر برای خرید می‌پردازد). داده هر ۱۰ دقیقه به‌روز می‌شود و هر ارز مهر زمان مستقل دارد.",
        "contact": {
            "url": "https://wikixchange.com/contact/"
        }
    },
    "servers": [
        {
            "url": "https://wikixchange.com/wp-json/wx/v1"
        }
    ],
    "components": {
        "securitySchemes": {
            "ApiKey": {
                "type": "apiKey",
                "in": "header",
                "name": "X-API-Key"
            }
        },
        "schemas": {
            "Rate": {
                "type": "object",
                "properties": {
                    "symbol": {
                        "type": "string",
                        "example": "BTC"
                    },
                    "name_fa": {
                        "type": "string",
                        "example": "بیت‌کوین"
                    },
                    "sell_usdt": {
                        "type": "number",
                        "description": "نرخ فروش بر حسب تتر"
                    },
                    "sell_irt": {
                        "type": "integer",
                        "nullable": true,
                        "description": "نرخ فروش بر حسب تومان"
                    },
                    "change_24h": {
                        "type": "number",
                        "nullable": true
                    },
                    "as_of": {
                        "type": "string",
                        "format": "date-time",
                        "description": "زمان آخرین تیک همین ارز — نه زمان کل پاسخ"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    }
                }
            }
        }
    },
    "security": [
        {
            "ApiKey": []
        }
    ],
    "paths": {
        "/rates": {
            "get": {
                "summary": "نرخ فروش ارزها",
                "operationId": "getRates",
                "parameters": [
                    {
                        "name": "symbol",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "محدود کردن به یک نماد، مثلاً BTC"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "فهرست نرخ‌ها",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "source": {
                                            "type": "string"
                                        },
                                        "side": {
                                            "type": "string",
                                            "enum": [
                                                "sell"
                                            ]
                                        },
                                        "usdt_irt": {
                                            "type": "integer",
                                            "nullable": true
                                        },
                                        "updated_at": {
                                            "type": "string",
                                            "format": "date-time"
                                        },
                                        "disclaimer": {
                                            "type": "string"
                                        },
                                        "count": {
                                            "type": "integer"
                                        },
                                        "rates": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Rate"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "کلید ارسال نشده"
                    },
                    "403": {
                        "description": "کلید نامعتبر"
                    },
                    "429": {
                        "description": "سقف ۶۰ درخواست در دقیقه رد شده"
                    }
                }
            }
        }
    }
}