PPanel Edge

distribution

由 openapi.json 自动生成的 35 个端点及其请求、响应和权限元数据。

此参考由已发布 API 契约生成。字段、请求头和权限要求如下。

下载完整 OpenAPI 文档 · SHA-256: ccaa20cec11fad96e369b88073ce3608a5b071ce55d6dc03fa31df7b0f08c525

标识符和数据结构与公开契约一致,说明直接给出调用规则。共享模型见 数据模型.

GET /api/v1/admin/access-logs

GET /api/v1/admin/access-logs

Subscription link access history

{
  "parameters": [
    {
      "in": "query",
      "name": "subscription_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "pattern": "^[1-9]\\d{0,18}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "properties": {
                    "accessed_at": {
                      "type": "string"
                    },
                    "asn": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "carrier": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "client_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "ip_masked": {
                      "type": "string"
                    },
                    "result": {
                      "type": "string"
                    },
                    "subscription_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "token_fingerprint": {
                      "type": "string"
                    },
                    "user_agent_summary": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "via_node": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "accessed_at",
                    "subscription_id",
                    "token_fingerprint",
                    "client_key",
                    "result",
                    "ip_masked",
                    "user_agent_summary",
                    "asn",
                    "carrier",
                    "via_node"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "items",
              "has_more",
              "next_cursor"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Subscription link access history",
  "tags": [
    "distribution"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-permission": "distribution.log.read",
  "effectiveSecurity": []
}

POST /api/v1/admin/distribution/canaries/{clientKey}/{action}

POST /api/v1/admin/distribution/canaries/{clientKey}/{action}

Promote a canary to all subscriptions or roll it back

{
  "parameters": [
    {
      "in": "path",
      "name": "clientKey",
      "required": true,
      "schema": {
        "enum": [
          "mihomo",
          "sing_box@1.11",
          "sing_box@1.12",
          "sing_box@1.13",
          "uri_base64",
          "hiddify",
          "stash",
          "surge",
          "quantumult_x",
          "loon",
          "surfboard",
          "shadowrocket"
        ],
        "type": "string"
      }
    },
    {
      "in": "path",
      "name": "action",
      "required": true,
      "schema": {
        "enum": [
          "promote",
          "rollback"
        ],
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "policy": {
                "additionalProperties": false,
                "properties": {
                  "canaries": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "client": {
                          "enum": [
                            "mihomo",
                            "sing_box@1.11",
                            "sing_box@1.12",
                            "sing_box@1.13",
                            "uri_base64",
                            "hiddify",
                            "stash",
                            "surge",
                            "quantumult_x",
                            "loon",
                            "surfboard",
                            "shadowrocket"
                          ],
                          "type": "string"
                        },
                        "percentage_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "subscription_ids": {
                          "default": [],
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        },
                        "template_id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "user_ids": {
                          "default": [],
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        }
                      },
                      "required": [
                        "client",
                        "template_id",
                        "percentage_bps"
                      ],
                      "type": "object"
                    },
                    "maxItems": 50,
                    "type": "array"
                  },
                  "rules": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "client": {
                          "enum": [
                            "mihomo",
                            "sing_box@1.11",
                            "sing_box@1.12",
                            "sing_box@1.13",
                            "uri_base64",
                            "hiddify",
                            "stash",
                            "surge",
                            "quantumult_x",
                            "loon",
                            "surfboard",
                            "shadowrocket"
                          ],
                          "type": "string"
                        },
                        "id": {
                          "pattern": "^[a-z0-9_-]{1,64}$",
                          "type": "string"
                        },
                        "max_version": {
                          "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "min_version": {
                          "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "template_id": {
                          "format": "uuid",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "client",
                        "min_version",
                        "max_version",
                        "template_id"
                      ],
                      "type": "object"
                    },
                    "maxItems": 200,
                    "type": "array"
                  }
                },
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "policy",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Promote a canary to all subscriptions or roll it back",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.canary.finish",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "optional",
  "x-permission": "distribution.template.manage",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/carriers

GET /api/v1/admin/distribution/carriers

Observed carriers and preserved operator overrides

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "items": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "asns": {
                      "items": {
                        "maximum": 2147483647,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "maxItems": 1000,
                      "type": "array"
                    },
                    "hidden": {
                      "default": false,
                      "type": "boolean"
                    },
                    "key": {
                      "pattern": "^[a-z0-9_-]{1,64}$",
                      "type": "string"
                    },
                    "merge_into": {
                      "default": null,
                      "pattern": "^[a-z0-9_-]{1,64}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "maxLength": 200,
                      "minLength": 1,
                      "type": "string"
                    }
                  },
                  "required": [
                    "key",
                    "name",
                    "asns"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "stats": {
                "additionalProperties": {},
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "items",
              "stats",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Observed carriers and preserved operator overrides",
  "tags": [
    "distribution"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-permission": "distribution.filter.manage",
  "effectiveSecurity": []
}

PUT /api/v1/admin/distribution/carriers

PUT /api/v1/admin/distribution/carriers

Rename, merge or hide carriers with If-Match

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "items": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "asns": {
                    "items": {
                      "maximum": 2147483647,
                      "minimum": 1,
                      "type": "integer"
                    },
                    "maxItems": 1000,
                    "type": "array"
                  },
                  "hidden": {
                    "default": false,
                    "type": "boolean"
                  },
                  "key": {
                    "pattern": "^[a-z0-9_-]{1,64}$",
                    "type": "string"
                  },
                  "merge_into": {
                    "default": null,
                    "pattern": "^[a-z0-9_-]{1,64}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "name": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "key",
                  "name",
                  "asns"
                ],
                "type": "object"
              },
              "maxItems": 2000,
              "type": "array"
            }
          },
          "required": [
            "items"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "items": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "asns": {
                      "items": {
                        "maximum": 2147483647,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "maxItems": 1000,
                      "type": "array"
                    },
                    "hidden": {
                      "default": false,
                      "type": "boolean"
                    },
                    "key": {
                      "pattern": "^[a-z0-9_-]{1,64}$",
                      "type": "string"
                    },
                    "merge_into": {
                      "default": null,
                      "pattern": "^[a-z0-9_-]{1,64}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "name": {
                      "maxLength": 200,
                      "minLength": 1,
                      "type": "string"
                    }
                  },
                  "required": [
                    "key",
                    "name",
                    "asns"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "stats": {
                "additionalProperties": {},
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "items",
              "stats",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Rename, merge or hide carriers with If-Match",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.carriers.update",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "optional",
  "x-permission": "distribution.filter.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/compatibility

GET /api/v1/admin/distribution/compatibility

Export client version ranges, revision IDs, precedence and protocols

{
  "parameters": [
    {
      "in": "query",
      "name": "format",
      "required": false,
      "schema": {
        "default": "json",
        "enum": [
          "json",
          "csv"
        ],
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "items": {
                "items": {
                  "properties": {
                    "client": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "max_version": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "min_version": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "percentage_bps": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "priority": {
                      "type": "integer"
                    },
                    "protocols": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "source": {
                      "enum": [
                        "default",
                        "version_rule",
                        "canary"
                      ],
                      "type": "string"
                    },
                    "targeted_subscriptions": {
                      "type": "integer"
                    },
                    "targeted_users": {
                      "type": "integer"
                    },
                    "template_revision": {
                      "type": "string"
                    },
                    "template_version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "client",
                    "min_version",
                    "max_version",
                    "template_revision",
                    "template_version",
                    "protocols",
                    "source",
                    "priority",
                    "percentage_bps",
                    "targeted_subscriptions",
                    "targeted_users"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "items"
            ],
            "type": "object"
          }
        },
        "text/csv": {
          "schema": {
            "type": "string"
          }
        }
      },
      "description": "Compatibility matrix"
    }
  },
  "summary": "Export client version ranges, revision IDs, precedence and protocols",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.template_policy.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "distribution.template.manage",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/admin/distribution/filter-preview

POST /api/v1/admin/distribution/filter-preview

Preview proposed rules without saving them

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "carrier": {
              "maxLength": 64,
              "type": [
                "string",
                "null"
              ]
            },
            "conditions": {
              "default": {},
              "properties": {
                "client": {
                  "maxLength": 64,
                  "type": "string"
                },
                "exclude_keyword": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "ip_family": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "isp": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "kind": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "limit": {
                  "maxLength": 128,
                  "type": "string"
                },
                "protocol": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "region": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "sort": {
                  "maxLength": 128,
                  "type": "string"
                },
                "tag": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "ver": {
                  "maxLength": 32,
                  "type": "string"
                }
              },
              "type": "object"
            },
            "region_code": {
              "maxLength": 64,
              "type": [
                "string",
                "null"
              ]
            },
            "rules": {
              "additionalProperties": false,
              "properties": {
                "default_client": {
                  "default": "mihomo",
                  "pattern": "^[a-z0-9_.@-]{1,64}$",
                  "type": "string"
                },
                "exclusions": {
                  "default": [],
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "carriers": {
                        "default": [],
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "clients": {
                        "default": [],
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "match": {
                        "additionalProperties": false,
                        "properties": {
                          "keywords": {
                            "default": [],
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "kinds": {
                            "default": [],
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "node_ids": {
                            "default": [],
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "maxItems": 1000,
                            "type": "array"
                          },
                          "protocols": {
                            "default": [],
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "regions": {
                            "default": [],
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "tags": {
                            "default": [],
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          }
                        },
                        "type": "object"
                      }
                    },
                    "required": [
                      "match"
                    ],
                    "type": "object"
                  },
                  "maxItems": 200,
                  "type": "array"
                },
                "hide_high_load": {
                  "default": false,
                  "type": "boolean"
                },
                "hide_offline": {
                  "default": false,
                  "type": "boolean"
                },
                "lines": {
                  "default": [],
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "carrier": {
                        "maxLength": 64,
                        "minLength": 1,
                        "type": "string"
                      },
                      "mode": {
                        "enum": [
                          "only",
                          "prefer"
                        ],
                        "type": "string"
                      },
                      "node_ids": {
                        "items": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "maxItems": 1000,
                        "type": "array"
                      },
                      "region_code": {
                        "default": null,
                        "maxLength": 64,
                        "minLength": 1,
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    },
                    "required": [
                      "carrier",
                      "node_ids",
                      "mode"
                    ],
                    "type": "object"
                  },
                  "maxItems": 500,
                  "type": "array"
                },
                "max_nodes": {
                  "default": 200,
                  "maximum": 1000,
                  "minimum": 1,
                  "type": "integer"
                },
                "name_template": {
                  "default": "{region_flag} {name}",
                  "maxLength": 512,
                  "minLength": 1,
                  "type": "string"
                },
                "show_node_load": {
                  "default": true,
                  "type": "boolean"
                },
                "subscription_url": {
                  "default": null,
                  "format": "uri",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "update_interval_hours": {
                  "default": 12,
                  "maximum": 168,
                  "minimum": 1,
                  "type": "integer"
                },
                "user_params": {
                  "default": {
                    "exclude_keyword": [
                      "*"
                    ],
                    "ip_family": [
                      "ipv4",
                      "ipv6"
                    ],
                    "isp": [
                      "*"
                    ],
                    "kind": [
                      "direct",
                      "relay",
                      "cdn"
                    ],
                    "limit": [
                      "*"
                    ],
                    "protocol": [
                      "*"
                    ],
                    "region": [
                      "*"
                    ],
                    "sort": [
                      "sort",
                      "name",
                      "region"
                    ],
                    "tag": [
                      "*"
                    ]
                  },
                  "properties": {
                    "exclude_keyword": {
                      "items": {
                        "maxLength": 128,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "ip_family": {
                      "items": {
                        "maxLength": 128,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "isp": {
                      "items": {
                        "maxLength": 128,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "kind": {
                      "items": {
                        "maxLength": 128,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "limit": {
                      "items": {
                        "maxLength": 128,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "protocol": {
                      "items": {
                        "maxLength": 128,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "region": {
                      "items": {
                        "maxLength": 128,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "sort": {
                      "items": {
                        "maxLength": 128,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "tag": {
                      "items": {
                        "maxLength": 128,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 200,
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              },
              "type": "object"
            },
            "subscription_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "required": [
            "subscription_id"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "client": {
                "enum": [
                  "mihomo",
                  "sing_box@1.11",
                  "sing_box@1.12",
                  "sing_box@1.13",
                  "uri_base64",
                  "hiddify",
                  "stash",
                  "surge",
                  "quantumult_x",
                  "loon",
                  "surfboard",
                  "shadowrocket"
                ],
                "type": "string"
              },
              "failed_nodes": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "fallback": {
                "type": "boolean"
              },
              "format": {
                "enum": [
                  "yaml",
                  "json",
                  "conf",
                  "text",
                  "base64"
                ],
                "type": "string"
              },
              "nodes": {
                "items": {
                  "properties": {
                    "address_family": {
                      "type": "string"
                    },
                    "health": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "load": {
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "type": "object"
                    },
                    "name": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "region": {
                      "type": "string"
                    },
                    "tags": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "protocol",
                    "region",
                    "tags"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "output": {
                "type": "string"
              },
              "result": {
                "type": "string"
              }
            },
            "required": [
              "client",
              "format",
              "output",
              "result",
              "nodes",
              "fallback",
              "failed_nodes"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Preview proposed rules without saving them",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.filters.preview",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "none",
  "x-permission": "distribution.filter.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/filters

GET /api/v1/admin/distribution/filters

Read distribution rules

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "rules": {
                "additionalProperties": false,
                "properties": {
                  "default_client": {
                    "default": "mihomo",
                    "pattern": "^[a-z0-9_.@-]{1,64}$",
                    "type": "string"
                  },
                  "exclusions": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "carriers": {
                          "default": [],
                          "items": {
                            "maxLength": 128,
                            "minLength": 1,
                            "type": "string"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "clients": {
                          "default": [],
                          "items": {
                            "maxLength": 128,
                            "minLength": 1,
                            "type": "string"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "match": {
                          "additionalProperties": false,
                          "properties": {
                            "keywords": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "kinds": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "node_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 1000,
                              "type": "array"
                            },
                            "protocols": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "regions": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "tags": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "required": [
                        "match"
                      ],
                      "type": "object"
                    },
                    "maxItems": 200,
                    "type": "array"
                  },
                  "hide_high_load": {
                    "default": false,
                    "type": "boolean"
                  },
                  "hide_offline": {
                    "default": false,
                    "type": "boolean"
                  },
                  "lines": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "carrier": {
                          "maxLength": 64,
                          "minLength": 1,
                          "type": "string"
                        },
                        "mode": {
                          "enum": [
                            "only",
                            "prefer"
                          ],
                          "type": "string"
                        },
                        "node_ids": {
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        },
                        "region_code": {
                          "default": null,
                          "maxLength": 64,
                          "minLength": 1,
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "carrier",
                        "node_ids",
                        "mode"
                      ],
                      "type": "object"
                    },
                    "maxItems": 500,
                    "type": "array"
                  },
                  "max_nodes": {
                    "default": 200,
                    "maximum": 1000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "name_template": {
                    "default": "{region_flag} {name}",
                    "maxLength": 512,
                    "minLength": 1,
                    "type": "string"
                  },
                  "show_node_load": {
                    "default": true,
                    "type": "boolean"
                  },
                  "subscription_url": {
                    "default": null,
                    "format": "uri",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "update_interval_hours": {
                    "default": 12,
                    "maximum": 168,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "user_params": {
                    "default": {
                      "exclude_keyword": [
                        "*"
                      ],
                      "ip_family": [
                        "ipv4",
                        "ipv6"
                      ],
                      "isp": [
                        "*"
                      ],
                      "kind": [
                        "direct",
                        "relay",
                        "cdn"
                      ],
                      "limit": [
                        "*"
                      ],
                      "protocol": [
                        "*"
                      ],
                      "region": [
                        "*"
                      ],
                      "sort": [
                        "sort",
                        "name",
                        "region"
                      ],
                      "tag": [
                        "*"
                      ]
                    },
                    "properties": {
                      "exclude_keyword": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "ip_family": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "isp": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "kind": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "limit": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "protocol": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "region": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "sort": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "tag": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      }
                    },
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "rules",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Read distribution rules",
  "tags": [
    "distribution"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-permission": "distribution.filter.manage",
  "effectiveSecurity": []
}

PUT /api/v1/admin/distribution/filters

PUT /api/v1/admin/distribution/filters

Save distribution rules with If-Match

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "default_client": {
              "default": "mihomo",
              "pattern": "^[a-z0-9_.@-]{1,64}$",
              "type": "string"
            },
            "exclusions": {
              "default": [],
              "items": {
                "additionalProperties": false,
                "properties": {
                  "carriers": {
                    "default": [],
                    "items": {
                      "maxLength": 128,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 200,
                    "type": "array"
                  },
                  "clients": {
                    "default": [],
                    "items": {
                      "maxLength": 128,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 200,
                    "type": "array"
                  },
                  "match": {
                    "additionalProperties": false,
                    "properties": {
                      "keywords": {
                        "default": [],
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "kinds": {
                        "default": [],
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "node_ids": {
                        "default": [],
                        "items": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "maxItems": 1000,
                        "type": "array"
                      },
                      "protocols": {
                        "default": [],
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "regions": {
                        "default": [],
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "tags": {
                        "default": [],
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      }
                    },
                    "type": "object"
                  }
                },
                "required": [
                  "match"
                ],
                "type": "object"
              },
              "maxItems": 200,
              "type": "array"
            },
            "hide_high_load": {
              "default": false,
              "type": "boolean"
            },
            "hide_offline": {
              "default": false,
              "type": "boolean"
            },
            "lines": {
              "default": [],
              "items": {
                "additionalProperties": false,
                "properties": {
                  "carrier": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "mode": {
                    "enum": [
                      "only",
                      "prefer"
                    ],
                    "type": "string"
                  },
                  "node_ids": {
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 1000,
                    "type": "array"
                  },
                  "region_code": {
                    "default": null,
                    "maxLength": 64,
                    "minLength": 1,
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "carrier",
                  "node_ids",
                  "mode"
                ],
                "type": "object"
              },
              "maxItems": 500,
              "type": "array"
            },
            "max_nodes": {
              "default": 200,
              "maximum": 1000,
              "minimum": 1,
              "type": "integer"
            },
            "name_template": {
              "default": "{region_flag} {name}",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            },
            "show_node_load": {
              "default": true,
              "type": "boolean"
            },
            "subscription_url": {
              "default": null,
              "format": "uri",
              "type": [
                "string",
                "null"
              ]
            },
            "update_interval_hours": {
              "default": 12,
              "maximum": 168,
              "minimum": 1,
              "type": "integer"
            },
            "user_params": {
              "default": {
                "exclude_keyword": [
                  "*"
                ],
                "ip_family": [
                  "ipv4",
                  "ipv6"
                ],
                "isp": [
                  "*"
                ],
                "kind": [
                  "direct",
                  "relay",
                  "cdn"
                ],
                "limit": [
                  "*"
                ],
                "protocol": [
                  "*"
                ],
                "region": [
                  "*"
                ],
                "sort": [
                  "sort",
                  "name",
                  "region"
                ],
                "tag": [
                  "*"
                ]
              },
              "properties": {
                "exclude_keyword": {
                  "items": {
                    "maxLength": 128,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 200,
                  "type": "array"
                },
                "ip_family": {
                  "items": {
                    "maxLength": 128,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 200,
                  "type": "array"
                },
                "isp": {
                  "items": {
                    "maxLength": 128,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 200,
                  "type": "array"
                },
                "kind": {
                  "items": {
                    "maxLength": 128,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 200,
                  "type": "array"
                },
                "limit": {
                  "items": {
                    "maxLength": 128,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 200,
                  "type": "array"
                },
                "protocol": {
                  "items": {
                    "maxLength": 128,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 200,
                  "type": "array"
                },
                "region": {
                  "items": {
                    "maxLength": 128,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 200,
                  "type": "array"
                },
                "sort": {
                  "items": {
                    "maxLength": 128,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 200,
                  "type": "array"
                },
                "tag": {
                  "items": {
                    "maxLength": 128,
                    "minLength": 1,
                    "type": "string"
                  },
                  "maxItems": 200,
                  "type": "array"
                }
              },
              "type": "object"
            }
          },
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "rules": {
                "additionalProperties": false,
                "properties": {
                  "default_client": {
                    "default": "mihomo",
                    "pattern": "^[a-z0-9_.@-]{1,64}$",
                    "type": "string"
                  },
                  "exclusions": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "carriers": {
                          "default": [],
                          "items": {
                            "maxLength": 128,
                            "minLength": 1,
                            "type": "string"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "clients": {
                          "default": [],
                          "items": {
                            "maxLength": 128,
                            "minLength": 1,
                            "type": "string"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "match": {
                          "additionalProperties": false,
                          "properties": {
                            "keywords": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "kinds": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "node_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 1000,
                              "type": "array"
                            },
                            "protocols": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "regions": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "tags": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "required": [
                        "match"
                      ],
                      "type": "object"
                    },
                    "maxItems": 200,
                    "type": "array"
                  },
                  "hide_high_load": {
                    "default": false,
                    "type": "boolean"
                  },
                  "hide_offline": {
                    "default": false,
                    "type": "boolean"
                  },
                  "lines": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "carrier": {
                          "maxLength": 64,
                          "minLength": 1,
                          "type": "string"
                        },
                        "mode": {
                          "enum": [
                            "only",
                            "prefer"
                          ],
                          "type": "string"
                        },
                        "node_ids": {
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        },
                        "region_code": {
                          "default": null,
                          "maxLength": 64,
                          "minLength": 1,
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "carrier",
                        "node_ids",
                        "mode"
                      ],
                      "type": "object"
                    },
                    "maxItems": 500,
                    "type": "array"
                  },
                  "max_nodes": {
                    "default": 200,
                    "maximum": 1000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "name_template": {
                    "default": "{region_flag} {name}",
                    "maxLength": 512,
                    "minLength": 1,
                    "type": "string"
                  },
                  "show_node_load": {
                    "default": true,
                    "type": "boolean"
                  },
                  "subscription_url": {
                    "default": null,
                    "format": "uri",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "update_interval_hours": {
                    "default": 12,
                    "maximum": 168,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "user_params": {
                    "default": {
                      "exclude_keyword": [
                        "*"
                      ],
                      "ip_family": [
                        "ipv4",
                        "ipv6"
                      ],
                      "isp": [
                        "*"
                      ],
                      "kind": [
                        "direct",
                        "relay",
                        "cdn"
                      ],
                      "limit": [
                        "*"
                      ],
                      "protocol": [
                        "*"
                      ],
                      "region": [
                        "*"
                      ],
                      "sort": [
                        "sort",
                        "name",
                        "region"
                      ],
                      "tag": [
                        "*"
                      ]
                    },
                    "properties": {
                      "exclude_keyword": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "ip_family": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "isp": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "kind": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "limit": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "protocol": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "region": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "sort": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "tag": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      }
                    },
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "rules",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Save distribution rules with If-Match",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.filters.update",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "optional",
  "x-permission": "distribution.filter.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/leak-settings

GET /api/v1/admin/distribution/leak-settings

Read link leak thresholds

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "settings": {
                "additionalProperties": false,
                "properties": {
                  "auto_rotate": {
                    "default": false,
                    "type": "boolean"
                  },
                  "enabled": {
                    "default": false,
                    "type": "boolean"
                  },
                  "max_asns": {
                    "default": 10,
                    "maximum": 10000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "max_countries": {
                    "default": 5,
                    "maximum": 250,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "max_fingerprints": {
                    "default": 10,
                    "maximum": 10000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "max_ips": {
                    "default": 20,
                    "maximum": 100000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "window_seconds": {
                    "default": 3600,
                    "maximum": 86400,
                    "minimum": 3600,
                    "type": "integer"
                  }
                },
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "settings",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Read link leak thresholds",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.template_policy.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "distribution.filter.manage",
  "x-reauth": false,
  "effectiveSecurity": []
}

PUT /api/v1/admin/distribution/leak-settings

PUT /api/v1/admin/distribution/leak-settings

Configure opt-in link leak detection

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "auto_rotate": {
              "default": false,
              "type": "boolean"
            },
            "enabled": {
              "default": false,
              "type": "boolean"
            },
            "max_asns": {
              "default": 10,
              "maximum": 10000,
              "minimum": 1,
              "type": "integer"
            },
            "max_countries": {
              "default": 5,
              "maximum": 250,
              "minimum": 1,
              "type": "integer"
            },
            "max_fingerprints": {
              "default": 10,
              "maximum": 10000,
              "minimum": 1,
              "type": "integer"
            },
            "max_ips": {
              "default": 20,
              "maximum": 100000,
              "minimum": 1,
              "type": "integer"
            },
            "window_seconds": {
              "default": 3600,
              "maximum": 86400,
              "minimum": 3600,
              "type": "integer"
            }
          },
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "settings": {
                "additionalProperties": false,
                "properties": {
                  "auto_rotate": {
                    "default": false,
                    "type": "boolean"
                  },
                  "enabled": {
                    "default": false,
                    "type": "boolean"
                  },
                  "max_asns": {
                    "default": 10,
                    "maximum": 10000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "max_countries": {
                    "default": 5,
                    "maximum": 250,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "max_fingerprints": {
                    "default": 10,
                    "maximum": 10000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "max_ips": {
                    "default": 20,
                    "maximum": 100000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "window_seconds": {
                    "default": 3600,
                    "maximum": 86400,
                    "minimum": 3600,
                    "type": "integer"
                  }
                },
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "settings",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Configure opt-in link leak detection",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.leak_settings.update",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "optional",
  "x-permission": "distribution.filter.manage",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/leak-signals/{id}

GET /api/v1/admin/distribution/leak-signals/{id}

Aggregate existing access-log signals for the current link

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "asns": {
                "type": "integer"
              },
              "countries": {
                "type": "integer"
              },
              "exceeded": {
                "items": {
                  "enum": [
                    "ips",
                    "asns",
                    "countries",
                    "fingerprints"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              "fingerprints": {
                "type": "integer"
              },
              "ips": {
                "type": "integer"
              },
              "requests": {
                "type": "integer"
              },
              "subscription_id": {
                "format": "uuid",
                "type": "string"
              }
            },
            "required": [
              "subscription_id",
              "ips",
              "asns",
              "countries",
              "fingerprints",
              "requests",
              "exceeded"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Aggregate existing access-log signals for the current link",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.template_policy.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "distribution.log.read",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/template-policy

GET /api/v1/admin/distribution/template-policy

Read ordered version rules and canary targets

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "policy": {
                "additionalProperties": false,
                "properties": {
                  "canaries": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "client": {
                          "enum": [
                            "mihomo",
                            "sing_box@1.11",
                            "sing_box@1.12",
                            "sing_box@1.13",
                            "uri_base64",
                            "hiddify",
                            "stash",
                            "surge",
                            "quantumult_x",
                            "loon",
                            "surfboard",
                            "shadowrocket"
                          ],
                          "type": "string"
                        },
                        "percentage_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "subscription_ids": {
                          "default": [],
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        },
                        "template_id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "user_ids": {
                          "default": [],
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        }
                      },
                      "required": [
                        "client",
                        "template_id",
                        "percentage_bps"
                      ],
                      "type": "object"
                    },
                    "maxItems": 50,
                    "type": "array"
                  },
                  "rules": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "client": {
                          "enum": [
                            "mihomo",
                            "sing_box@1.11",
                            "sing_box@1.12",
                            "sing_box@1.13",
                            "uri_base64",
                            "hiddify",
                            "stash",
                            "surge",
                            "quantumult_x",
                            "loon",
                            "surfboard",
                            "shadowrocket"
                          ],
                          "type": "string"
                        },
                        "id": {
                          "pattern": "^[a-z0-9_-]{1,64}$",
                          "type": "string"
                        },
                        "max_version": {
                          "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "min_version": {
                          "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "template_id": {
                          "format": "uuid",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "client",
                        "min_version",
                        "max_version",
                        "template_id"
                      ],
                      "type": "object"
                    },
                    "maxItems": 200,
                    "type": "array"
                  }
                },
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "policy",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Read ordered version rules and canary targets",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.template_policy.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "distribution.template.manage",
  "x-reauth": false,
  "effectiveSecurity": []
}

PUT /api/v1/admin/distribution/template-policy

PUT /api/v1/admin/distribution/template-policy

Validate revisions and save version rules and canaries with If-Match

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "canaries": {
              "default": [],
              "items": {
                "additionalProperties": false,
                "properties": {
                  "client": {
                    "enum": [
                      "mihomo",
                      "sing_box@1.11",
                      "sing_box@1.12",
                      "sing_box@1.13",
                      "uri_base64",
                      "hiddify",
                      "stash",
                      "surge",
                      "quantumult_x",
                      "loon",
                      "surfboard",
                      "shadowrocket"
                    ],
                    "type": "string"
                  },
                  "percentage_bps": {
                    "maximum": 10000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "subscription_ids": {
                    "default": [],
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 1000,
                    "type": "array"
                  },
                  "template_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "user_ids": {
                    "default": [],
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 1000,
                    "type": "array"
                  }
                },
                "required": [
                  "client",
                  "template_id",
                  "percentage_bps"
                ],
                "type": "object"
              },
              "maxItems": 50,
              "type": "array"
            },
            "rules": {
              "default": [],
              "items": {
                "additionalProperties": false,
                "properties": {
                  "client": {
                    "enum": [
                      "mihomo",
                      "sing_box@1.11",
                      "sing_box@1.12",
                      "sing_box@1.13",
                      "uri_base64",
                      "hiddify",
                      "stash",
                      "surge",
                      "quantumult_x",
                      "loon",
                      "surfboard",
                      "shadowrocket"
                    ],
                    "type": "string"
                  },
                  "id": {
                    "pattern": "^[a-z0-9_-]{1,64}$",
                    "type": "string"
                  },
                  "max_version": {
                    "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "min_version": {
                    "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "template_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "client",
                  "min_version",
                  "max_version",
                  "template_id"
                ],
                "type": "object"
              },
              "maxItems": 200,
              "type": "array"
            }
          },
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "policy": {
                "additionalProperties": false,
                "properties": {
                  "canaries": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "client": {
                          "enum": [
                            "mihomo",
                            "sing_box@1.11",
                            "sing_box@1.12",
                            "sing_box@1.13",
                            "uri_base64",
                            "hiddify",
                            "stash",
                            "surge",
                            "quantumult_x",
                            "loon",
                            "surfboard",
                            "shadowrocket"
                          ],
                          "type": "string"
                        },
                        "percentage_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "subscription_ids": {
                          "default": [],
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        },
                        "template_id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "user_ids": {
                          "default": [],
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        }
                      },
                      "required": [
                        "client",
                        "template_id",
                        "percentage_bps"
                      ],
                      "type": "object"
                    },
                    "maxItems": 50,
                    "type": "array"
                  },
                  "rules": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "client": {
                          "enum": [
                            "mihomo",
                            "sing_box@1.11",
                            "sing_box@1.12",
                            "sing_box@1.13",
                            "uri_base64",
                            "hiddify",
                            "stash",
                            "surge",
                            "quantumult_x",
                            "loon",
                            "surfboard",
                            "shadowrocket"
                          ],
                          "type": "string"
                        },
                        "id": {
                          "pattern": "^[a-z0-9_-]{1,64}$",
                          "type": "string"
                        },
                        "max_version": {
                          "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "min_version": {
                          "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "template_id": {
                          "format": "uuid",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "client",
                        "min_version",
                        "max_version",
                        "template_id"
                      ],
                      "type": "object"
                    },
                    "maxItems": 200,
                    "type": "array"
                  }
                },
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "policy",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Validate revisions and save version rules and canaries with If-Match",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.template_policy.update",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "optional",
  "x-permission": "distribution.template.manage",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/templates

GET /api/v1/admin/distribution/templates

Template versions and drafts

{
  "parameters": [
    {
      "in": "query",
      "name": "client",
      "required": false,
      "schema": {
        "enum": [
          "mihomo",
          "sing_box@1.11",
          "sing_box@1.12",
          "sing_box@1.13",
          "uri_base64",
          "hiddify",
          "stash",
          "surge",
          "quantumult_x",
          "loon",
          "surfboard",
          "shadowrocket"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "pattern": "^[a-z0-9_.@-]{1,64}~[1-9]\\d{0,9}$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "properties": {
                    "checksum": {
                      "type": "string"
                    },
                    "client_key": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_builtin": {
                      "type": "boolean"
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "output_format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "published_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "client_key",
                    "version",
                    "output_format",
                    "status",
                    "is_builtin",
                    "checksum",
                    "notes",
                    "published_at"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "items",
              "has_more",
              "next_cursor"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Template versions and drafts",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.templates.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-permission": "distribution.template.manage",
  "effectiveSecurity": []
}

POST /api/v1/admin/distribution/templates

POST /api/v1/admin/distribution/templates

Create a template draft

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "body": {
              "minLength": 1,
              "type": "string"
            },
            "client_key": {
              "enum": [
                "mihomo",
                "sing_box@1.11",
                "sing_box@1.12",
                "sing_box@1.13",
                "uri_base64",
                "hiddify",
                "stash",
                "surge",
                "quantumult_x",
                "loon",
                "surfboard",
                "shadowrocket"
              ],
              "type": "string"
            },
            "notes": {
              "default": null,
              "maxLength": 2000,
              "type": [
                "string",
                "null"
              ]
            },
            "params": {
              "additionalProperties": {},
              "default": {},
              "type": "object"
            }
          },
          "required": [
            "client_key",
            "body"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "body": {
                "type": "string"
              },
              "checksum": {
                "type": "string"
              },
              "client_key": {
                "enum": [
                  "mihomo",
                  "sing_box@1.11",
                  "sing_box@1.12",
                  "sing_box@1.13",
                  "uri_base64",
                  "hiddify",
                  "stash",
                  "surge",
                  "quantumult_x",
                  "loon",
                  "surfboard",
                  "shadowrocket"
                ],
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "is_builtin": {
                "type": "boolean"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "output_format": {
                "enum": [
                  "yaml",
                  "json",
                  "conf",
                  "text",
                  "base64"
                ],
                "type": "string"
              },
              "params": {
                "additionalProperties": {},
                "type": "object"
              },
              "published_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "enum": [
                  "draft",
                  "published",
                  "archived"
                ],
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "client_key",
              "version",
              "output_format",
              "body",
              "params",
              "status",
              "is_builtin",
              "checksum",
              "notes",
              "published_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Create a template draft",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.templates.update",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "optional",
  "x-permission": "distribution.template.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/templates/builtins

GET /api/v1/admin/distribution/templates/builtins

Built-in template sources, available before database seeding

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "items": {
                "items": {
                  "properties": {
                    "body": {
                      "type": "string"
                    },
                    "client_key": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "format": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "client_key",
                    "body",
                    "format"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "items"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Built-in template sources, available before database seeding",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.templates.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-permission": "distribution.template.manage",
  "effectiveSecurity": []
}

POST /api/v1/admin/distribution/templates/{clientKey}/rollback

POST /api/v1/admin/distribution/templates/{clientKey}/rollback

Restore the preceding published version

{
  "parameters": [
    {
      "in": "path",
      "name": "clientKey",
      "required": true,
      "schema": {
        "enum": [
          "mihomo",
          "sing_box@1.11",
          "sing_box@1.12",
          "sing_box@1.13",
          "uri_base64",
          "hiddify",
          "stash",
          "surge",
          "quantumult_x",
          "loon",
          "surfboard",
          "shadowrocket"
        ],
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "body": {
                "type": "string"
              },
              "checksum": {
                "type": "string"
              },
              "client_key": {
                "enum": [
                  "mihomo",
                  "sing_box@1.11",
                  "sing_box@1.12",
                  "sing_box@1.13",
                  "uri_base64",
                  "hiddify",
                  "stash",
                  "surge",
                  "quantumult_x",
                  "loon",
                  "surfboard",
                  "shadowrocket"
                ],
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "is_builtin": {
                "type": "boolean"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "output_format": {
                "enum": [
                  "yaml",
                  "json",
                  "conf",
                  "text",
                  "base64"
                ],
                "type": "string"
              },
              "params": {
                "additionalProperties": {},
                "type": "object"
              },
              "published_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "enum": [
                  "draft",
                  "published",
                  "archived"
                ],
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "client_key",
              "version",
              "output_format",
              "body",
              "params",
              "status",
              "is_builtin",
              "checksum",
              "notes",
              "published_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Restore the preceding published version",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.templates.rollback",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "optional",
  "x-permission": "distribution.template.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/templates/{clientKey}/versions

GET /api/v1/admin/distribution/templates/{clientKey}/versions

Versions of a client template

{
  "parameters": [
    {
      "in": "path",
      "name": "clientKey",
      "required": true,
      "schema": {
        "enum": [
          "mihomo",
          "sing_box@1.11",
          "sing_box@1.12",
          "sing_box@1.13",
          "uri_base64",
          "hiddify",
          "stash",
          "surge",
          "quantumult_x",
          "loon",
          "surfboard",
          "shadowrocket"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "pattern": "^[a-z0-9_.@-]{1,64}~[1-9]\\d{0,9}$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "properties": {
                    "checksum": {
                      "type": "string"
                    },
                    "client_key": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_builtin": {
                      "type": "boolean"
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "output_format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "published_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "client_key",
                    "version",
                    "output_format",
                    "status",
                    "is_builtin",
                    "checksum",
                    "notes",
                    "published_at"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "items",
              "has_more",
              "next_cursor"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Versions of a client template",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.templates.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-permission": "distribution.template.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/templates/{id}

GET /api/v1/admin/distribution/templates/{id}

A template version

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "body": {
                "type": "string"
              },
              "checksum": {
                "type": "string"
              },
              "client_key": {
                "enum": [
                  "mihomo",
                  "sing_box@1.11",
                  "sing_box@1.12",
                  "sing_box@1.13",
                  "uri_base64",
                  "hiddify",
                  "stash",
                  "surge",
                  "quantumult_x",
                  "loon",
                  "surfboard",
                  "shadowrocket"
                ],
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "is_builtin": {
                "type": "boolean"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "output_format": {
                "enum": [
                  "yaml",
                  "json",
                  "conf",
                  "text",
                  "base64"
                ],
                "type": "string"
              },
              "params": {
                "additionalProperties": {},
                "type": "object"
              },
              "published_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "enum": [
                  "draft",
                  "published",
                  "archived"
                ],
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "client_key",
              "version",
              "output_format",
              "body",
              "params",
              "status",
              "is_builtin",
              "checksum",
              "notes",
              "published_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "A template version",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.templates.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-permission": "distribution.template.manage",
  "effectiveSecurity": []
}

PUT /api/v1/admin/distribution/templates/{id}

PUT /api/v1/admin/distribution/templates/{id}

Replace a draft with a new immutable revision

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "body": {
              "minLength": 1,
              "type": "string"
            },
            "client_key": {
              "enum": [
                "mihomo",
                "sing_box@1.11",
                "sing_box@1.12",
                "sing_box@1.13",
                "uri_base64",
                "hiddify",
                "stash",
                "surge",
                "quantumult_x",
                "loon",
                "surfboard",
                "shadowrocket"
              ],
              "type": "string"
            },
            "notes": {
              "default": null,
              "maxLength": 2000,
              "type": [
                "string",
                "null"
              ]
            },
            "params": {
              "additionalProperties": {},
              "default": {},
              "type": "object"
            }
          },
          "required": [
            "client_key",
            "body"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "body": {
                "type": "string"
              },
              "checksum": {
                "type": "string"
              },
              "client_key": {
                "enum": [
                  "mihomo",
                  "sing_box@1.11",
                  "sing_box@1.12",
                  "sing_box@1.13",
                  "uri_base64",
                  "hiddify",
                  "stash",
                  "surge",
                  "quantumult_x",
                  "loon",
                  "surfboard",
                  "shadowrocket"
                ],
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "is_builtin": {
                "type": "boolean"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "output_format": {
                "enum": [
                  "yaml",
                  "json",
                  "conf",
                  "text",
                  "base64"
                ],
                "type": "string"
              },
              "params": {
                "additionalProperties": {},
                "type": "object"
              },
              "published_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "enum": [
                  "draft",
                  "published",
                  "archived"
                ],
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "client_key",
              "version",
              "output_format",
              "body",
              "params",
              "status",
              "is_builtin",
              "checksum",
              "notes",
              "published_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Replace a draft with a new immutable revision",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.templates.update",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "optional",
  "x-permission": "distribution.template.manage",
  "effectiveSecurity": []
}

POST /api/v1/admin/distribution/templates/{id}/preview

POST /api/v1/admin/distribution/templates/{id}/preview

Render a draft with sample or selected subscription data

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "conditions": {
              "default": {},
              "properties": {
                "client": {
                  "maxLength": 64,
                  "type": "string"
                },
                "exclude_keyword": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "ip_family": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "isp": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "kind": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "limit": {
                  "maxLength": 128,
                  "type": "string"
                },
                "protocol": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "region": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "sort": {
                  "maxLength": 128,
                  "type": "string"
                },
                "tag": {
                  "maxLength": 2048,
                  "type": "string"
                },
                "ver": {
                  "maxLength": 32,
                  "type": "string"
                }
              },
              "type": "object"
            },
            "subscription_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "format": {
                "type": "string"
              },
              "output": {
                "type": "string"
              }
            },
            "required": [
              "output",
              "format"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Render a draft with sample or selected subscription data",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.templates.preview",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "none",
  "x-permission": "distribution.template.manage",
  "effectiveSecurity": []
}

POST /api/v1/admin/distribution/templates/{id}/publish

POST /api/v1/admin/distribution/templates/{id}/publish

Validate samples and atomically publish a draft

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "body": {
                "type": "string"
              },
              "checksum": {
                "type": "string"
              },
              "client_key": {
                "enum": [
                  "mihomo",
                  "sing_box@1.11",
                  "sing_box@1.12",
                  "sing_box@1.13",
                  "uri_base64",
                  "hiddify",
                  "stash",
                  "surge",
                  "quantumult_x",
                  "loon",
                  "surfboard",
                  "shadowrocket"
                ],
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "is_builtin": {
                "type": "boolean"
              },
              "notes": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "output_format": {
                "enum": [
                  "yaml",
                  "json",
                  "conf",
                  "text",
                  "base64"
                ],
                "type": "string"
              },
              "params": {
                "additionalProperties": {},
                "type": "object"
              },
              "published_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "enum": [
                  "draft",
                  "published",
                  "archived"
                ],
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "client_key",
              "version",
              "output_format",
              "body",
              "params",
              "status",
              "is_builtin",
              "checksum",
              "notes",
              "published_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Validate samples and atomically publish a draft",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.templates.publish",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "optional",
  "x-permission": "distribution.template.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/distribution/user-routing-policy

GET /api/v1/admin/distribution/user-routing-policy

Read user routing controls

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "policy": {
                "additionalProperties": false,
                "properties": {
                  "allowed_types": {
                    "default": [
                      "domain",
                      "domain-suffix",
                      "domain-keyword",
                      "IP-CIDR",
                      "GEOIP",
                      "GEOSITE",
                      "process-name"
                    ],
                    "items": {
                      "enum": [
                        "domain",
                        "domain-suffix",
                        "domain-keyword",
                        "IP-CIDR",
                        "GEOIP",
                        "GEOSITE",
                        "process-name"
                      ],
                      "type": "string"
                    },
                    "maxItems": 7,
                    "type": "array"
                  },
                  "denied_targets": {
                    "default": [],
                    "items": {
                      "maxLength": 200,
                      "minLength": 1,
                      "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                      "type": "string"
                    },
                    "maxItems": 200,
                    "type": "array"
                  },
                  "enabled": {
                    "default": true,
                    "type": "boolean"
                  },
                  "max_count": {
                    "default": 200,
                    "maximum": 200,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "protected_domains": {
                    "default": [],
                    "items": {
                      "maxLength": 253,
                      "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  }
                },
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "policy",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Read user routing controls",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.user_routing.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "distribution.filter.manage",
  "x-rate-limit": "distribution.user_routing.user",
  "x-reauth": false,
  "effectiveSecurity": []
}

PUT /api/v1/admin/distribution/user-routing-policy

PUT /api/v1/admin/distribution/user-routing-policy

Set allowed rule types, count and denied targets

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "allowed_types": {
              "default": [
                "domain",
                "domain-suffix",
                "domain-keyword",
                "IP-CIDR",
                "GEOIP",
                "GEOSITE",
                "process-name"
              ],
              "items": {
                "enum": [
                  "domain",
                  "domain-suffix",
                  "domain-keyword",
                  "IP-CIDR",
                  "GEOIP",
                  "GEOSITE",
                  "process-name"
                ],
                "type": "string"
              },
              "maxItems": 7,
              "type": "array"
            },
            "denied_targets": {
              "default": [],
              "items": {
                "maxLength": 200,
                "minLength": 1,
                "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                "type": "string"
              },
              "maxItems": 200,
              "type": "array"
            },
            "enabled": {
              "default": true,
              "type": "boolean"
            },
            "max_count": {
              "default": 200,
              "maximum": 200,
              "minimum": 0,
              "type": "integer"
            },
            "protected_domains": {
              "default": [],
              "items": {
                "maxLength": 253,
                "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i",
                "type": "string"
              },
              "maxItems": 100,
              "type": "array"
            }
          },
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "policy": {
                "additionalProperties": false,
                "properties": {
                  "allowed_types": {
                    "default": [
                      "domain",
                      "domain-suffix",
                      "domain-keyword",
                      "IP-CIDR",
                      "GEOIP",
                      "GEOSITE",
                      "process-name"
                    ],
                    "items": {
                      "enum": [
                        "domain",
                        "domain-suffix",
                        "domain-keyword",
                        "IP-CIDR",
                        "GEOIP",
                        "GEOSITE",
                        "process-name"
                      ],
                      "type": "string"
                    },
                    "maxItems": 7,
                    "type": "array"
                  },
                  "denied_targets": {
                    "default": [],
                    "items": {
                      "maxLength": 200,
                      "minLength": 1,
                      "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                      "type": "string"
                    },
                    "maxItems": 200,
                    "type": "array"
                  },
                  "enabled": {
                    "default": true,
                    "type": "boolean"
                  },
                  "max_count": {
                    "default": 200,
                    "maximum": 200,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "protected_domains": {
                    "default": [],
                    "items": {
                      "maxLength": 253,
                      "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  }
                },
                "type": "object"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "policy",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Set allowed rule types, count and denied targets",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.user_routing.update",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "optional",
  "x-permission": "distribution.filter.manage",
  "x-rate-limit": "distribution.user_routing.user",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/subscriptions/{id}/preview

GET /api/v1/admin/subscriptions/{id}/preview

Preview a subscription using the delivery selector

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "client",
      "required": false,
      "schema": {
        "maxLength": 64,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "ver",
      "required": false,
      "schema": {
        "maxLength": 32,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "region",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "protocol",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "kind",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "tag",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "ip_family",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "isp",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "exclude_keyword",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "sort",
      "required": false,
      "schema": {
        "maxLength": 128,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "limit",
      "required": false,
      "schema": {
        "maxLength": 128,
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "client": {
                "enum": [
                  "mihomo",
                  "sing_box@1.11",
                  "sing_box@1.12",
                  "sing_box@1.13",
                  "uri_base64",
                  "hiddify",
                  "stash",
                  "surge",
                  "quantumult_x",
                  "loon",
                  "surfboard",
                  "shadowrocket"
                ],
                "type": "string"
              },
              "failed_nodes": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "fallback": {
                "type": "boolean"
              },
              "format": {
                "enum": [
                  "yaml",
                  "json",
                  "conf",
                  "text",
                  "base64"
                ],
                "type": "string"
              },
              "nodes": {
                "items": {
                  "properties": {
                    "address_family": {
                      "type": "string"
                    },
                    "health": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "load": {
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "type": "object"
                    },
                    "name": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "region": {
                      "type": "string"
                    },
                    "tags": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "protocol",
                    "region",
                    "tags"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "output": {
                "type": "string"
              },
              "result": {
                "type": "string"
              }
            },
            "required": [
              "client",
              "format",
              "output",
              "result",
              "nodes",
              "fallback",
              "failed_nodes"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Preview a subscription using the delivery selector",
  "tags": [
    "distribution"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-permission": "distribution.preview",
  "effectiveSecurity": []
}

POST /api/v1/admin/subscriptions/{id}/rotate-link

POST /api/v1/admin/subscriptions/{id}/rotate-link

Replace a subscription link token immediately

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "rotated_at": {
                "type": "string"
              },
              "token_fingerprint": {
                "type": "string"
              }
            },
            "required": [
              "token_fingerprint",
              "rotated_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Replace a subscription link token immediately",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.link.rotate",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "required",
  "x-permission": "distribution.token.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/subscriptions/{id}/routing-rules

GET /api/v1/admin/subscriptions/{id}/routing-rules

Read subscription routing rules without editing

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "rules": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "target": {
                      "maxLength": 200,
                      "minLength": 1,
                      "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                      "type": "string"
                    },
                    "type": {
                      "enum": [
                        "domain",
                        "domain-suffix",
                        "domain-keyword",
                        "IP-CIDR",
                        "GEOIP",
                        "GEOSITE",
                        "process-name"
                      ],
                      "type": "string"
                    },
                    "value": {
                      "maxLength": 253,
                      "minLength": 1,
                      "pattern": "^[^\\s,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "value",
                    "target"
                  ],
                  "type": "object"
                },
                "maxItems": 200,
                "type": "array"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "rules",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Read subscription routing rules without editing",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.user_routing.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "distribution.preview",
  "x-rate-limit": "distribution.user_routing.user",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/me/subscriptions/{id}/access-logs

GET /api/v1/me/subscriptions/{id}/access-logs

My subscription link access history

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "subscription_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "pattern": "^[1-9]\\d{0,18}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "properties": {
                    "accessed_at": {
                      "type": "string"
                    },
                    "asn": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "carrier": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "client_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "ip_masked": {
                      "type": "string"
                    },
                    "result": {
                      "type": "string"
                    },
                    "subscription_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "token_fingerprint": {
                      "type": "string"
                    },
                    "user_agent_summary": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "via_node": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "accessed_at",
                    "subscription_id",
                    "token_fingerprint",
                    "client_key",
                    "result",
                    "ip_masked",
                    "user_agent_summary",
                    "asn",
                    "carrier",
                    "via_node"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "items",
              "has_more",
              "next_cursor"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "My subscription link access history",
  "tags": [
    "distribution"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "effectiveSecurity": []
}

GET /api/v1/me/subscriptions/{id}/link-options

Build a subscription link with permitted conditions

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "client",
      "required": false,
      "schema": {
        "maxLength": 64,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "ver",
      "required": false,
      "schema": {
        "maxLength": 32,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "region",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "protocol",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "kind",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "tag",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "ip_family",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "isp",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "exclude_keyword",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "sort",
      "required": false,
      "schema": {
        "maxLength": 128,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "limit",
      "required": false,
      "schema": {
        "maxLength": 128,
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "url": {
                "type": "string"
              },
              "user_params": {
                "additionalProperties": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "type": "object"
              }
            },
            "required": [
              "url",
              "user_params"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Build a subscription link with permitted conditions",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.link.build",
  "x-body": "none",
  "x-body-limit": 0,
  "effectiveSecurity": []
}

GET /api/v1/me/subscriptions/{id}/nodes

GET /api/v1/me/subscriptions/{id}/nodes

My selected subscription nodes

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "client",
      "required": false,
      "schema": {
        "maxLength": 64,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "ver",
      "required": false,
      "schema": {
        "maxLength": 32,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "region",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "protocol",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "kind",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "tag",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "ip_family",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "isp",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "exclude_keyword",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "sort",
      "required": false,
      "schema": {
        "maxLength": 128,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "limit",
      "required": false,
      "schema": {
        "maxLength": 128,
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "client": {
                "enum": [
                  "mihomo",
                  "sing_box@1.11",
                  "sing_box@1.12",
                  "sing_box@1.13",
                  "uri_base64",
                  "hiddify",
                  "stash",
                  "surge",
                  "quantumult_x",
                  "loon",
                  "surfboard",
                  "shadowrocket"
                ],
                "type": "string"
              },
              "failed_nodes": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "fallback": {
                "type": "boolean"
              },
              "format": {
                "enum": [
                  "yaml",
                  "json",
                  "conf",
                  "text",
                  "base64"
                ],
                "type": "string"
              },
              "nodes": {
                "items": {
                  "properties": {
                    "address_family": {
                      "type": "string"
                    },
                    "health": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "load": {
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "type": "object"
                    },
                    "name": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "region": {
                      "type": "string"
                    },
                    "tags": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "protocol",
                    "region",
                    "tags"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "output": {
                "type": "string"
              },
              "result": {
                "type": "string"
              }
            },
            "required": [
              "client",
              "format",
              "output",
              "result",
              "nodes",
              "fallback",
              "failed_nodes"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "My selected subscription nodes",
  "tags": [
    "distribution"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "effectiveSecurity": []
}

GET /api/v1/me/subscriptions/{id}/preview

GET /api/v1/me/subscriptions/{id}/preview

Preview my subscription using the delivery selector

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "client",
      "required": false,
      "schema": {
        "maxLength": 64,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "ver",
      "required": false,
      "schema": {
        "maxLength": 32,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "region",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "protocol",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "kind",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "tag",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "ip_family",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "isp",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "exclude_keyword",
      "required": false,
      "schema": {
        "maxLength": 2048,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "sort",
      "required": false,
      "schema": {
        "maxLength": 128,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "limit",
      "required": false,
      "schema": {
        "maxLength": 128,
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "client": {
                "enum": [
                  "mihomo",
                  "sing_box@1.11",
                  "sing_box@1.12",
                  "sing_box@1.13",
                  "uri_base64",
                  "hiddify",
                  "stash",
                  "surge",
                  "quantumult_x",
                  "loon",
                  "surfboard",
                  "shadowrocket"
                ],
                "type": "string"
              },
              "failed_nodes": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "fallback": {
                "type": "boolean"
              },
              "format": {
                "enum": [
                  "yaml",
                  "json",
                  "conf",
                  "text",
                  "base64"
                ],
                "type": "string"
              },
              "nodes": {
                "items": {
                  "properties": {
                    "address_family": {
                      "type": "string"
                    },
                    "health": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string"
                    },
                    "load": {
                      "additionalProperties": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "number"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "type": "object"
                    },
                    "name": {
                      "type": "string"
                    },
                    "protocol": {
                      "type": "string"
                    },
                    "region": {
                      "type": "string"
                    },
                    "tags": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "protocol",
                    "region",
                    "tags"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "output": {
                "type": "string"
              },
              "result": {
                "type": "string"
              }
            },
            "required": [
              "client",
              "format",
              "output",
              "result",
              "nodes",
              "fallback",
              "failed_nodes"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Preview my subscription using the delivery selector",
  "tags": [
    "distribution"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "effectiveSecurity": []
}

POST /api/v1/me/subscriptions/{id}/preview

POST /api/v1/me/subscriptions/{id}/preview

Preview unsaved routing rules for my subscription

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "client": {
              "default": "mihomo",
              "enum": [
                "mihomo",
                "sing_box@1.11",
                "sing_box@1.12",
                "sing_box@1.13",
                "uri_base64",
                "hiddify",
                "stash",
                "surge",
                "quantumult_x",
                "loon",
                "surfboard",
                "shadowrocket"
              ],
              "type": "string"
            },
            "rules": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "target": {
                    "maxLength": 200,
                    "minLength": 1,
                    "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "domain",
                      "domain-suffix",
                      "domain-keyword",
                      "IP-CIDR",
                      "GEOIP",
                      "GEOSITE",
                      "process-name"
                    ],
                    "type": "string"
                  },
                  "value": {
                    "maxLength": 253,
                    "minLength": 1,
                    "pattern": "^[^\\s,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "value",
                  "target"
                ],
                "type": "object"
              },
              "maxItems": 200,
              "type": "array"
            }
          },
          "required": [
            "rules"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "fallback": {
                "type": "boolean"
              },
              "format": {
                "type": "string"
              },
              "output": {
                "type": "string"
              }
            },
            "required": [
              "output",
              "format",
              "fallback"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Preview unsaved routing rules for my subscription",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.user_routing.preview",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "none",
  "x-rate-limit": "distribution.user_routing.user",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/me/subscriptions/{id}/rotate-link

POST /api/v1/me/subscriptions/{id}/rotate-link

Replace my link token immediately

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "rotated_at": {
                "type": "string"
              },
              "token_fingerprint": {
                "type": "string"
              }
            },
            "required": [
              "token_fingerprint",
              "rotated_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Replace my link token immediately",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.link.rotate",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "required",
  "effectiveSecurity": []
}

GET /api/v1/me/subscriptions/{id}/routing-rules

GET /api/v1/me/subscriptions/{id}/routing-rules

Read my ordered subscription routing rules

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "groups": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "policy": {
                "additionalProperties": false,
                "properties": {
                  "allowed_types": {
                    "default": [
                      "domain",
                      "domain-suffix",
                      "domain-keyword",
                      "IP-CIDR",
                      "GEOIP",
                      "GEOSITE",
                      "process-name"
                    ],
                    "items": {
                      "enum": [
                        "domain",
                        "domain-suffix",
                        "domain-keyword",
                        "IP-CIDR",
                        "GEOIP",
                        "GEOSITE",
                        "process-name"
                      ],
                      "type": "string"
                    },
                    "maxItems": 7,
                    "type": "array"
                  },
                  "denied_targets": {
                    "default": [],
                    "items": {
                      "maxLength": 200,
                      "minLength": 1,
                      "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                      "type": "string"
                    },
                    "maxItems": 200,
                    "type": "array"
                  },
                  "enabled": {
                    "default": true,
                    "type": "boolean"
                  },
                  "max_count": {
                    "default": 200,
                    "maximum": 200,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "protected_domains": {
                    "default": [],
                    "items": {
                      "maxLength": 253,
                      "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  }
                },
                "type": "object"
              },
              "rules": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "target": {
                      "maxLength": 200,
                      "minLength": 1,
                      "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                      "type": "string"
                    },
                    "type": {
                      "enum": [
                        "domain",
                        "domain-suffix",
                        "domain-keyword",
                        "IP-CIDR",
                        "GEOIP",
                        "GEOSITE",
                        "process-name"
                      ],
                      "type": "string"
                    },
                    "value": {
                      "maxLength": 253,
                      "minLength": 1,
                      "pattern": "^[^\\s,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "value",
                    "target"
                  ],
                  "type": "object"
                },
                "maxItems": 200,
                "type": "array"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "rules",
              "version",
              "groups",
              "policy"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Read my ordered subscription routing rules",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.user_routing.read",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-rate-limit": "distribution.user_routing.user",
  "x-reauth": false,
  "effectiveSecurity": []
}

PUT /api/v1/me/subscriptions/{id}/routing-rules

PUT /api/v1/me/subscriptions/{id}/routing-rules

Replace my ordered routing rules with If-Match

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "client": {
              "default": "mihomo",
              "enum": [
                "mihomo",
                "sing_box@1.11",
                "sing_box@1.12",
                "sing_box@1.13",
                "uri_base64",
                "hiddify",
                "stash",
                "surge",
                "quantumult_x",
                "loon",
                "surfboard",
                "shadowrocket"
              ],
              "type": "string"
            },
            "rules": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "target": {
                    "maxLength": 200,
                    "minLength": 1,
                    "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "domain",
                      "domain-suffix",
                      "domain-keyword",
                      "IP-CIDR",
                      "GEOIP",
                      "GEOSITE",
                      "process-name"
                    ],
                    "type": "string"
                  },
                  "value": {
                    "maxLength": 253,
                    "minLength": 1,
                    "pattern": "^[^\\s,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "value",
                  "target"
                ],
                "type": "object"
              },
              "maxItems": 200,
              "type": "array"
            }
          },
          "required": [
            "rules"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "rules": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "target": {
                      "maxLength": 200,
                      "minLength": 1,
                      "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                      "type": "string"
                    },
                    "type": {
                      "enum": [
                        "domain",
                        "domain-suffix",
                        "domain-keyword",
                        "IP-CIDR",
                        "GEOIP",
                        "GEOSITE",
                        "process-name"
                      ],
                      "type": "string"
                    },
                    "value": {
                      "maxLength": 253,
                      "minLength": 1,
                      "pattern": "^[^\\s,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "value",
                    "target"
                  ],
                  "type": "object"
                },
                "maxItems": 200,
                "type": "array"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "rules",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Distribution result"
    }
  },
  "summary": "Replace my ordered routing rules with If-Match",
  "tags": [
    "distribution"
  ],
  "x-audit": "distribution.user_routing.update",
  "x-body": "json",
  "x-body-limit": 524288,
  "x-idempotency": "optional",
  "x-rate-limit": "distribution.user_routing.user",
  "x-reauth": false,
  "effectiveSecurity": []
}

本页目录

GET /api/v1/admin/access-logsPOST /api/v1/admin/distribution/canaries/{clientKey}/{action}GET /api/v1/admin/distribution/carriersPUT /api/v1/admin/distribution/carriersGET /api/v1/admin/distribution/compatibilityPOST /api/v1/admin/distribution/filter-previewGET /api/v1/admin/distribution/filtersPUT /api/v1/admin/distribution/filtersGET /api/v1/admin/distribution/leak-settingsPUT /api/v1/admin/distribution/leak-settingsGET /api/v1/admin/distribution/leak-signals/{id}GET /api/v1/admin/distribution/template-policyPUT /api/v1/admin/distribution/template-policyGET /api/v1/admin/distribution/templatesPOST /api/v1/admin/distribution/templatesGET /api/v1/admin/distribution/templates/builtinsPOST /api/v1/admin/distribution/templates/{clientKey}/rollbackGET /api/v1/admin/distribution/templates/{clientKey}/versionsGET /api/v1/admin/distribution/templates/{id}PUT /api/v1/admin/distribution/templates/{id}POST /api/v1/admin/distribution/templates/{id}/previewPOST /api/v1/admin/distribution/templates/{id}/publishGET /api/v1/admin/distribution/user-routing-policyPUT /api/v1/admin/distribution/user-routing-policyGET /api/v1/admin/subscriptions/{id}/previewPOST /api/v1/admin/subscriptions/{id}/rotate-linkGET /api/v1/admin/subscriptions/{id}/routing-rulesGET /api/v1/me/subscriptions/{id}/access-logsGET /api/v1/me/subscriptions/{id}/link-optionsGET /api/v1/me/subscriptions/{id}/nodesGET /api/v1/me/subscriptions/{id}/previewPOST /api/v1/me/subscriptions/{id}/previewPOST /api/v1/me/subscriptions/{id}/rotate-linkGET /api/v1/me/subscriptions/{id}/routing-rulesPUT /api/v1/me/subscriptions/{id}/routing-rules