{
  "openapi": "3.1.0",
  "info": {
    "title": "ECHO Proxy API",
    "version": "1.0.0",
    "summary": "Free, live-checked Telegram MTProto and SOCKS5 proxies.",
    "description": "Read-only public API behind telegramvpn.org. Proxies are community-submitted and re-checked every few minutes. No key or sign-up. Limit: 60 requests per minute per IP; please cache responses for at least 30 seconds.",
    "contact": {
      "name": "ECHO Proxy",
      "url": "https://telegramvpn.org/"
    },
    "license": {
      "name": "CC BY 4.0 (proxy data)",
      "identifier": "CC-BY-4.0"
    }
  },
  "servers": [
    {
      "url": "https://api.telegramvpn.org"
    }
  ],
  "externalDocs": {
    "description": "API documentation",
    "url": "https://telegramvpn.org/docs/api/"
  },
  "paths": {
    "/proxies": {
      "get": {
        "operationId": "listProxies",
        "summary": "List proxies, fastest working first",
        "parameters": [
          {
            "name": "for",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            },
            "description": "Visitor country (ISO alpha-2). Ranks proxies that people in that country report working first."
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "all",
                "dead"
              ],
              "default": "active"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ping",
                "uptime",
                "added"
              ],
              "default": "ping"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "mtproto",
                "socks5"
              ],
              "default": "all"
            }
          },
          {
            "name": "cc",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[A-Za-z]{2}$"
            },
            "description": "Only proxies whose server is in this country"
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 64
            },
            "description": "Search country, city or server name"
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "per",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of proxies",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "proxies": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Proxy"
                      }
                    },
                    "total": {
                      "type": "integer"
                    },
                    "online": {
                      "type": "integer"
                    },
                    "page": {
                      "type": "integer"
                    },
                    "pages": {
                      "type": "integer"
                    },
                    "per": {
                      "type": "integer"
                    },
                    "cached": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests"
          }
        }
      }
    },
    "/proxy": {
      "get": {
        "operationId": "getProxy",
        "summary": "One proxy with its check history",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The proxy",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "proxy": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Proxy"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "checks": {
                              "type": "object",
                              "properties": {
                                "total": {
                                  "type": "integer"
                                },
                                "success": {
                                  "type": "integer"
                                },
                                "last_check": {
                                  "type": "integer"
                                },
                                "last_ping": {
                                  "type": "integer"
                                }
                              }
                            }
                          }
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/stats": {
      "get": {
        "operationId": "getStats",
        "summary": "Totals; also used as the health/status endpoint",
        "responses": {
          "200": {
            "description": "Totals",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "stats": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer"
                        },
                        "online": {
                          "type": "integer"
                        },
                        "dead": {
                          "type": "integer"
                        },
                        "total_added": {
                          "type": "integer"
                        },
                        "total_served": {
                          "type": "integer"
                        },
                        "countries": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Proxy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "8201"
          },
          "server": {
            "type": "string",
            "example": "p1.eyoo.org"
          },
          "port": {
            "type": "integer",
            "example": 443
          },
          "type": {
            "type": "string",
            "enum": [
              "mtproto",
              "socks5"
            ]
          },
          "url": {
            "type": "string",
            "description": "Telegram link that adds the proxy (tg://proxy?... or tg://socks?...). Replace tg:// with https://t.me/ for a web link.",
            "example": "tg://proxy?server=p1.eyoo.org&port=443&secret=ee…"
          },
          "country": {
            "type": "string",
            "description": "ISO 3166-1 alpha-2 code of the proxy server",
            "example": "NL"
          },
          "country_name": {
            "type": "string",
            "example": "Netherlands"
          },
          "flag": {
            "type": "string",
            "example": "🇳🇱"
          },
          "city": {
            "type": "string",
            "example": "Amsterdam"
          },
          "ping": {
            "type": "integer",
            "description": "Latest check latency from our checker in ms (0 = unknown)"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "dead"
            ]
          },
          "uptime": {
            "type": "integer",
            "description": "Percent of recent checks that succeeded"
          },
          "votes": {
            "type": "integer"
          },
          "added_at": {
            "type": "integer",
            "description": "Unix time the proxy was added"
          },
          "local": {
            "type": "integer",
            "enum": [
              -1,
              1
            ],
            "description": "Only with ?for=CC: 1 = visitors in that country report it works, -1 = they report it does not"
          },
          "pinned": {
            "type": "boolean",
            "description": "Shown first for the requested country while healthy"
          }
        },
        "required": [
          "id",
          "server",
          "port",
          "type",
          "url",
          "status"
        ]
      }
    }
  }
}
