{
    "openapi": "3.0.3",
    "info": {
        "title": "CripChain API",
        "version": "1.0.0",
        "description": "BNB Smart Chain token API. Non-custodial: swap endpoints return unsigned transactions."
    },
    "servers": [
        {
            "url": "https://token.cripchain.com/api/v1"
        }
    ],
    "paths": {
        "/health": {
            "get": {
                "tags": [
                    "Status"
                ],
                "summary": "API and chain status.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/token": {
            "get": {
                "tags": [
                    "Token & Price"
                ],
                "summary": "On-chain token metadata (name, symbol, decimals, total supply).",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/price": {
            "get": {
                "tags": [
                    "Token & Price"
                ],
                "summary": "Live CRIP price from the PancakeSwap V2 pool, in BNB and USD. Cached 10 s.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/quote/buy": {
            "get": {
                "tags": [
                    "Buy & Sell"
                ],
                "summary": "Quote for buying CRIP with BNB.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                },
                "parameters": [
                    {
                        "name": "bnb",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number"
                        },
                        "description": "BNB to spend"
                    },
                    {
                        "name": "slippage",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "number"
                        },
                        "description": "Percent, 0\u201350. Default 1"
                    }
                ]
            }
        },
        "/quote/sell": {
            "get": {
                "tags": [
                    "Buy & Sell"
                ],
                "summary": "Quote for selling CRIP for BNB.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                },
                "parameters": [
                    {
                        "name": "amount",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "number"
                        },
                        "description": "CRIP to sell"
                    },
                    {
                        "name": "slippage",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "number"
                        },
                        "description": "Percent, 0\u201350. Default 1"
                    }
                ]
            }
        },
        "/swap/buy": {
            "post": {
                "tags": [
                    "Buy & Sell"
                ],
                "summary": "Builds an unsigned buy transaction. Send tx with the user's wallet (eth_sendTransaction).",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "address": {
                                        "type": "string"
                                    },
                                    "bnb": {
                                        "type": "number"
                                    },
                                    "slippage": {
                                        "type": "number"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/swap/sell": {
            "post": {
                "tags": [
                    "Buy & Sell"
                ],
                "summary": "Builds an unsigned sell transaction. If the router allowance is too low, approveTx is returned and must be sent and confirmed first.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "address": {
                                        "type": "string"
                                    },
                                    "amount": {
                                        "type": "number"
                                    },
                                    "slippage": {
                                        "type": "number"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/balance/{address}": {
            "get": {
                "tags": [
                    "Wallet & Transactions"
                ],
                "summary": "CRIP and BNB balance of a wallet.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                },
                "parameters": [
                    {
                        "name": "address",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Wallet address (in the path)"
                    }
                ]
            }
        },
        "/tx/{hash}": {
            "get": {
                "tags": [
                    "Wallet & Transactions"
                ],
                "summary": "Transaction status: pending, success or failed, with confirmations.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                },
                "parameters": [
                    {
                        "name": "hash",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Transaction hash (in the path)"
                    }
                ]
            }
        },
        "/transfers/{address}": {
            "get": {
                "tags": [
                    "Wallet & Transactions"
                ],
                "summary": "CRIP transfer history for a wallet. Needs CRIP_EXPLORER_KEY on the server.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                },
                "parameters": [
                    {
                        "name": "address",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Wallet address (in the path)"
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Default 1"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "integer"
                        },
                        "description": "1\u2013100, default 20"
                    }
                ]
            }
        },
        "/market/tickers": {
            "get": {
                "tags": [
                    "Market data"
                ],
                "summary": "Live 24h stats for major pairs (BTC, ETH, BNB, SOL, XRP, ADA, DOGE, TRX, AVAX, LINK vs USDT). Source: Binance public feed, cached 10 s.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/market/klines": {
            "get": {
                "tags": [
                    "Market data"
                ],
                "summary": "Candlestick (OHLCV) data, last 200 candles.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                },
                "parameters": [
                    {
                        "name": "symbol",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "e.g. BNBUSDT (default)"
                    },
                    {
                        "name": "interval",
                        "in": "query",
                        "required": false,
                        "schema": {
                            "type": "string"
                        },
                        "description": "5m, 15m, 1h (default), 4h, 1d"
                    }
                ]
            }
        },
        "/site": {
            "get": {
                "tags": [
                    "Site content"
                ],
                "summary": "Public site content (tokenomics, roadmap, FAQ, buy links) managed in the admin panel.",
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    }
}