{
  "openapi": "3.1.0",
  "info": {
    "title": "CoinXview API",
    "version": "1.0.0",
    "summary": "Free crypto market data API: prices, market cap, risk score, Fear & Greed, OHLC.",
    "description": "Live prices for 1,200+ coins aggregated directly from 22 exchanges (volume-weighted, outliers removed), CoinXview Risk Score, global market data, CoinXview's own Fear & Greed index and OHLC candles.\n\n- No API key, no sign-up. CORS is open (`Access-Control-Allow-Origin: *`).\n- Rate limit: 60 requests per minute per IP. Responses carry `X-RateLimit-Limit` / `X-RateLimit-Remaining`; over the limit you get HTTP 429 with `Retry-After: 60`.\n- Responses are cached for 30-300 seconds.\n- Attribution required: show \"Data: CoinXview\" with a link to https://coinxview.com wherever the data is displayed. Not investment advice.",
    "termsOfService": "https://coinxview.com/dieu-khoan",
    "contact": {
      "name": "CoinXview",
      "url": "https://coinxview.com/lien-he"
    },
    "x-logo": {
      "url": "https://coinxview.com/static/icon-512.png"
    }
  },
  "externalDocs": {
    "description": "API documentation with live examples",
    "url": "https://coinxview.com/free-crypto-api"
  },
  "servers": [
    {
      "url": "https://coinxview.com/api/v1"
    }
  ],
  "security": [],
  "tags": [
    {
      "name": "Coins"
    },
    {
      "name": "Market"
    },
    {
      "name": "Risk"
    },
    {
      "name": "Candles"
    }
  ],
  "paths": {
    "/coins": {
      "get": {
        "tags": [
          "Coins"
        ],
        "operationId": "listCoins",
        "summary": "Coins ranked by market cap",
        "description": "Stablecoins and wrapped coins are included and flagged. With `symbols`, returns only those coins in the order asked (start / limit are ignored).",
        "parameters": [
          {
            "name": "start",
            "in": "query",
            "description": "Rank to start from.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Number of coins.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "symbols",
            "in": "query",
            "description": "Comma-separated symbols, up to 50.",
            "schema": {
              "type": "string"
            },
            "example": "BTC,ETH"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "updated",
                    "total",
                    "start",
                    "limit",
                    "data"
                  ],
                  "properties": {
                    "updated": {
                      "type": "integer",
                      "description": "Server time when the response was built (unix milliseconds)."
                    },
                    "total": {
                      "type": "integer",
                      "description": "Number of coins available (or returned, with symbols)."
                    },
                    "start": {
                      "type": "integer"
                    },
                    "limit": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Coin"
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/coins/{symbol}": {
      "get": {
        "tags": [
          "Coins"
        ],
        "operationId": "getCoin",
        "summary": "One coin with per-exchange prices",
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "required": true,
            "description": "Coin symbol (case-insensitive).",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9]{1,20}$"
            },
            "example": "ETH"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "updated",
                    "data"
                  ],
                  "properties": {
                    "updated": {
                      "type": "integer",
                      "description": "Server time when the response was built (unix milliseconds)."
                    },
                    "data": {
                      "$ref": "#/components/schemas/CoinDetail"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/risk/{symbol}": {
      "get": {
        "tags": [
          "Risk"
        ],
        "operationId": "getRisk",
        "summary": "CoinXview Risk Score with its components",
        "description": "Embeddable badge: https://coinxview.com/badge/risk/{symbol}.svg",
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "required": true,
            "description": "Coin symbol (case-insensitive).",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9]{1,20}$"
            },
            "example": "SOL"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "updated",
                    "data"
                  ],
                  "properties": {
                    "updated": {
                      "type": "integer",
                      "description": "Server time when the response was built (unix milliseconds)."
                    },
                    "data": {
                      "$ref": "#/components/schemas/Risk"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/global": {
      "get": {
        "tags": [
          "Market"
        ],
        "operationId": "getGlobal",
        "summary": "Total market cap, volume, dominance, Fear & Greed",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "updated",
                    "data"
                  ],
                  "properties": {
                    "updated": {
                      "type": "integer",
                      "description": "Server time when the response was built (unix milliseconds)."
                    },
                    "data": {
                      "$ref": "#/components/schemas/Global"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/fear-greed": {
      "get": {
        "tags": [
          "Market"
        ],
        "operationId": "getFearGreed",
        "summary": "Fear & Greed index: current value and 90-day history",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FearGreed"
                }
              }
            }
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/ohlc/{symbol}": {
      "get": {
        "tags": [
          "Candles"
        ],
        "operationId": "getOhlc",
        "summary": "OHLC candles",
        "description": "Candles from the exchange with the most volume for that coin (`source_exchange`).",
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "required": true,
            "description": "Coin symbol (case-insensitive).",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z0-9]{1,20}$"
            },
            "example": "BTC"
          },
          {
            "name": "interval",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "4h",
                "1d",
                "1w"
              ],
              "default": "1d"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Newest N candles.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 1000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ohlc"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Coin": {
        "type": "object",
        "properties": {
          "rank": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Display rank by market cap (null for wrapped coins and tokenized stocks)."
          },
          "symbol": {
            "type": "string",
            "description": "Ticker symbol."
          },
          "name": {
            "type": "string",
            "description": "Coin name."
          },
          "price_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "Volume-weighted price across tracked exchanges, in USD."
          },
          "change_1h": {
            "type": [
              "number",
              "null"
            ],
            "description": "Price change over 1 hour, percent."
          },
          "change_24h": {
            "type": [
              "number",
              "null"
            ],
            "description": "Price change over 24 hours, percent."
          },
          "change_7d": {
            "type": [
              "number",
              "null"
            ],
            "description": "Price change over 7 days, percent."
          },
          "market_cap_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "Market cap in USD."
          },
          "volume_24h_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "24h trading volume in USD."
          },
          "circulating_supply": {
            "type": [
              "number",
              "null"
            ],
            "description": "Circulating supply."
          },
          "ath_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "All-time high on the exchanges CoinXview tracks, in USD."
          },
          "ath_change_pct": {
            "type": [
              "number",
              "null"
            ],
            "description": "Percent below (negative) the all-time high."
          },
          "exchanges": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Number of exchanges listing the coin."
          },
          "stablecoin": {
            "type": "boolean",
            "description": "True for stablecoins."
          },
          "wrapped": {
            "type": "boolean",
            "description": "True for wrapped / staked derivative tokens."
          },
          "url": {
            "type": "string",
            "description": "Coin page on coinxview.com.",
            "format": "uri"
          },
          "risk": {
            "type": [
              "integer",
              "null"
            ],
            "description": "CoinXview Risk Score, 0-100 (higher = riskier).",
            "minimum": 0,
            "maximum": 100
          },
          "risk_level": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "low",
              "medium",
              "high",
              "very_high",
              null
            ],
            "description": "low <= 40, medium <= 60, high <= 80, otherwise very_high."
          }
        }
      },
      "CoinDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Coin"
          },
          {
            "type": "object",
            "properties": {
              "high_24h_usd": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "24h high in USD."
              },
              "low_24h_usd": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "24h low in USD."
              },
              "change_30d": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Price change over 30 days, percent."
              },
              "total_supply": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Total supply."
              },
              "max_supply": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Maximum supply."
              },
              "risk_score": {
                "type": [
                  "integer",
                  "null"
                ],
                "description": "Same value as risk (kept for compatibility)."
              },
              "markets": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Market"
                }
              }
            }
          }
        ]
      },
      "Market": {
        "type": "object",
        "properties": {
          "exchange": {
            "type": "string",
            "description": "Exchange name."
          },
          "quote": {
            "type": "string",
            "description": "Quote currency of the pair, e.g. USDT."
          },
          "price_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "Price on this exchange in USD."
          },
          "volume_24h_usd": {
            "type": [
              "number",
              "null"
            ],
            "description": "24h volume on this exchange in USD."
          },
          "share_pct": {
            "type": [
              "number",
              "null"
            ],
            "description": "Share of the coin's total volume, percent."
          }
        }
      },
      "Risk": {
        "type": "object",
        "properties": {
          "symbol": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "risk": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "risk_level": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high",
              "very_high"
            ]
          },
          "partial": {
            "type": "boolean",
            "description": "True when some components lack data yet."
          },
          "components": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "enum": [
                    "liq",
                    "vol",
                    "ex",
                    "spread",
                    "age"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "weight_pct": {
                  "type": "number"
                },
                "score": {
                  "type": "number",
                  "description": "0-100, higher = riskier."
                }
              }
            }
          },
          "hack_penalty": {
            "type": "integer",
            "description": "Points added when the project lost $1M+ to a hack in the last 12 months."
          },
          "method": {
            "type": "string",
            "description": "How the score is calculated."
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "about": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "Global": {
        "type": "object",
        "properties": {
          "coins": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Number of coins tracked."
          },
          "exchanges": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Number of exchanges tracked."
          },
          "total_market_cap_usd": {
            "type": [
              "number",
              "null"
            ]
          },
          "total_volume_24h_usd": {
            "type": [
              "number",
              "null"
            ]
          },
          "btc_dominance_pct": {
            "type": [
              "number",
              "null"
            ]
          },
          "eth_dominance_pct": {
            "type": [
              "number",
              "null"
            ]
          },
          "fear_greed": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "value": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "label": {
                "type": "string"
              }
            }
          }
        }
      },
      "FearGreed": {
        "type": "object",
        "properties": {
          "updated": {
            "type": "integer",
            "description": "Server time when the response was built (unix milliseconds)."
          },
          "now": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "value": {
                "type": "integer",
                "minimum": 0,
                "maximum": 100
              },
              "label": {
                "type": "string",
                "enum": [
                  "Extreme fear",
                  "Fear",
                  "Neutral",
                  "Greed",
                  "Extreme greed"
                ]
              },
              "time": {
                "type": "integer",
                "description": "Unix seconds."
              }
            }
          },
          "history": {
            "type": "array",
            "maxItems": 90,
            "items": {
              "type": "object",
              "properties": {
                "time": {
                  "type": "integer",
                  "description": "Unix seconds."
                },
                "value": {
                  "type": "integer"
                }
              }
            }
          },
          "method": {
            "type": "string",
            "description": "Methodology page.",
            "format": "uri"
          }
        }
      },
      "Ohlc": {
        "type": "object",
        "properties": {
          "symbol": {
            "type": "string"
          },
          "interval": {
            "type": "string",
            "enum": [
              "1h",
              "4h",
              "1d",
              "1w"
            ]
          },
          "source_exchange": {
            "type": [
              "string",
              "null"
            ]
          },
          "data": {
            "type": "array",
            "description": "Each row: [time (unix seconds), open, high, low, close, quote volume].",
            "items": {
              "type": "array",
              "minItems": 6,
              "maxItems": 6,
              "items": {
                "type": "number"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    },
    "responses": {
      "NotFound": {
        "description": "Unknown symbol (or no data yet).",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "More than 60 requests per minute from this IP.",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait (60)."
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}