{"openapi":"3.0.3","info":{"title":"FTCTOKEN API","version":"1.0.0","description":"RESTful API for the FTCTOKEN Creator platform on Binance Smart Chain (BSC) Testnet and multi-chain EVM networks. Supports gasless deployments via backend relayer, direct token indexing, real-time analytics, and platform status.","contact":{"name":"Fiotech Core Team","url":"https://www.fiotech.org"}},"servers":[{"url":"/","description":"Current Environment Server"},{"url":"https://token-creator.fiotech.org","description":"Production Server"}],"tags":[{"name":"Tokens","description":"Token deployment, retrieval, and indexing operations"},{"name":"Analytics","description":"Platform statistics and metrics"},{"name":"System","description":"System health, database, and Redis cache diagnostics"}],"paths":{"/api/tokens/deploy":{"post":{"tags":["Tokens"],"summary":"Deploy token via backend relayer (Gasless)","description":"Deploys an ERC-20 token contract onto BSC Testnet using the system relayer key, transfers the full supply to the recipient address, and persists the token in Vercel Postgres.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeployTokenRequest"},"example":{"name":"Fiotech Meme Coin","symbol":"FMC","initialSupply":"1000000","decimals":18,"recipientAddress":"0x1234567890123456789012345678901234567890","revokeFreeze":true,"revokeMint":true,"revokeUpdate":false}}}},"responses":{"200":{"description":"Token successfully deployed and indexed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"400":{"description":"Invalid input parameters or validation failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Relayer deployment transaction failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tokens":{"get":{"tags":["Tokens"],"summary":"List tokens with search, pagination, and caching","description":"Returns a paginated list of created tokens stored in Vercel Postgres (with Redis caching).","parameters":[{"name":"limit","in":"query","description":"Number of items per page (default: 20)","schema":{"type":"integer","default":20}},{"name":"offset","in":"query","description":"Number of items to skip (default: 0)","schema":{"type":"integer","default":0}},{"name":"search","in":"query","description":"Search token by name, symbol, or contract address","schema":{"type":"string"}},{"name":"deployerAddress","in":"query","description":"Filter tokens by recipient/deployer wallet address","schema":{"type":"string"}}],"responses":{"200":{"description":"List of tokens retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenListResponse"}}}}}},"post":{"tags":["Tokens"],"summary":"Index a token deployed directly by a client wallet","description":"Records an ERC-20 token contract deployed directly through MetaMask to Vercel Postgres database.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordTokenRequest"},"example":{"name":"Community Token","symbol":"COMM","totalSupply":"500000","decimals":18,"contractAddress":"0x9876543210987654321098765432109876543210","deployerAddress":"0x1234567890123456789012345678901234567890","txHash":"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890","network":"BSC Testnet"}}}},"responses":{"200":{"description":"Token successfully recorded in database","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"400":{"description":"Invalid input","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/tokens/{address}":{"get":{"tags":["Tokens"],"summary":"Get token details by contract address","parameters":[{"name":"address","in":"path","required":true,"description":"Ethereum-style contract address (0x...)","schema":{"type":"string"}}],"responses":{"200":{"description":"Token details found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"404":{"description":"Token not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/stats":{"get":{"tags":["Analytics"],"summary":"Get platform metrics and relayer status","description":"Returns total tokens created, tokens deployed in past 24 hours, BSC RPC connectivity, and Relayer wallet balance.","responses":{"200":{"description":"Platform statistics retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsResponse"}}}}}}},"/api/system/status":{"get":{"tags":["System"],"summary":"System health check and infrastructure connectivity","description":"Checks connectivity status of Vercel Postgres, Vercel KV / Upstash Redis, and BSC Testnet RPC node.","responses":{"200":{"description":"System health check report","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemStatusResponse"}}}}}}}},"components":{"schemas":{"DeployTokenRequest":{"type":"object","required":["name","symbol","initialSupply","decimals","recipientAddress"],"properties":{"name":{"type":"string","example":"Fiotech Meme"},"symbol":{"type":"string","example":"FTM"},"initialSupply":{"type":"string","example":"1000000"},"decimals":{"type":"integer","minimum":0,"maximum":18,"example":18},"recipientAddress":{"type":"string","example":"0x1234567890123456789012345678901234567890"},"revokeFreeze":{"type":"boolean","example":false},"revokeMint":{"type":"boolean","example":false},"revokeUpdate":{"type":"boolean","example":false}}},"RecordTokenRequest":{"type":"object","required":["name","symbol","totalSupply","decimals","contractAddress","deployerAddress","txHash"],"properties":{"name":{"type":"string"},"symbol":{"type":"string"},"totalSupply":{"type":"string"},"decimals":{"type":"integer"},"contractAddress":{"type":"string"},"deployerAddress":{"type":"string"},"txHash":{"type":"string"},"network":{"type":"string","default":"BSC Testnet"},"revokeFreeze":{"type":"boolean"},"revokeMint":{"type":"boolean"},"revokeUpdate":{"type":"boolean"}}},"TokenResult":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"totalSupply":{"type":"string"},"decimals":{"type":"integer"},"contractAddress":{"type":"string"},"deployerAddress":{"type":"string"},"txHash":{"type":"string"},"network":{"type":"string"},"revokeFreeze":{"type":"boolean"},"revokeMint":{"type":"boolean"},"revokeUpdate":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"explorerUrl":{"type":"string"}}},"TokenResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"$ref":"#/components/schemas/TokenResult"}}},"TokenListResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"tokens":{"type":"array","items":{"$ref":"#/components/schemas/TokenResult"}},"total":{"type":"integer","example":42},"limit":{"type":"integer","example":20},"offset":{"type":"integer","example":0}}}}},"StatsResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"totalTokensCreated":{"type":"integer","example":128},"tokensCreated24h":{"type":"integer","example":14},"network":{"type":"string","example":"BSC Testnet"},"chainId":{"type":"integer","example":97},"rpcStatus":{"type":"string","example":"CONNECTED"},"relayerAddress":{"type":"string","example":"0xabc...def"},"relayerBalanceBNB":{"type":"string","example":"0.4521"},"databaseStatus":{"type":"string","example":"ONLINE"},"cacheStatus":{"type":"string","example":"ONLINE"}}}}},"SystemStatusResponse":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object","properties":{"status":{"type":"string","example":"UP"},"postgres":{"type":"string","example":"ONLINE"},"redis":{"type":"string","example":"ONLINE"},"rpc":{"type":"string","example":"CONNECTED"},"timestamp":{"type":"string","format":"date-time"}}}}},"ErrorResponse":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"Detailed error message"}}}}}}