ZH
EUR
免费版免费 安装

API 与 CLI

Everything the console does is also available through a REST API and the toutwafctl command-line tool, with scoped tokens: to script, to plug into a SOAR or to drive from CI.

All functions

Where to find it in the console : Console: Administration > Users and access (API tokens); API: /api/v1; tool: toutwafctl.

What it is for

One API

The console and toutwafctl use only the control plane's REST API: what you do in the interface also exists as an API call.

Scoped tokens

A token carries a list of permissions (resource:action), can be limited to some sites and can expire. It never exceeds the permissions of its creator.

Readable errors

Every error has a TW-xxxx code, a message in the requested language and, in the documentation, a cause and a fix.

In your scripts and CI

toutwafctl has JSON output, exit codes usable in CI and messages in ten languages.

What toutwafctl does

It talks to the API with a token; the full reference is in the documentation.

Log in

login (with the TOTP code when two-factor authentication is on) exchanges the session for a long-lived token, or stores an existing one.

Sites and policy

apps (list, create, detect/block mode); policy (export, validate, diff, apply, publish, roll back).

Test and simulate

test runs rule tests with JUnit output; simulate replays stored traffic against a policy.

Ban, enrol, token

ban and unban for an address; nodes for the nodes and their enrolment tokens; token to create, list and revoke API tokens.

Back up and restore

backup (create, list, download, targets) and restore, including offline with the service stopped.

Diagnose

doctor reads the local installation even when the console does not answer, or asks the console with a token; the exit code is 1 when a check fails.

The REST API

Base path /api/v1.

  • Authentication: cookie session with a CSRF header on state-changing requests, or a bearer token (Authorization: Bearer).
  • Lists return items and a total; the language of messages follows Accept-Language or the lang parameter.
  • Data-plane endpoints are served separately, on an internal port, with a node token.
  • The reference is generated from the product's OpenAPI contract.

Token good practice

A CI token does not need everything.

  • Create a dedicated token per use, with only the permissions needed and an expiry.
  • Avoid the “*” token created by an interactive login for CI.
  • A token can be limited to given sites and revoked at any time.

What is not done, or not proven

We prefer to say it plainly.

  • The --insecure option of toutwafctl turns off verification of the console's TLS certificate: keep it for a lab.
  • The API reference is generated from a snapshot of the product; when in doubt, the OpenAPI contract of the installed product prevails.
  • A token never exceeds its creator's permissions, and a role without a permission does not get it through the API.

Use cases

Ban from a SOAR

A playbook calls the API to ban an address for a given time, with a reason recorded in the audit.

An operations script

A script creates a site, sets it to detection and publishes it with toutwafctl.

A CI that tests rules

Rule tests run on every change, with a JUnit report.

What is included, by edition

The basics are free; the advanced options need a paid offer. An option under licence stays visible in the console, locked, never hidden.

版本免费 包含在所有方案中,包括两个免费方案(Free 和 Free +)Pro 及以上 付费方案:在控制台中可见,无许可证时被锁定。从 Pro 起,另有标注 Agency 或 Enterprise 的除外
  • 控制台能做的一切都有对应的 REST API,令牌可限定权限范围免费
  • 命令行工具:策略、测试、模拟、备份、诊断免费
  • 节点总览页:节点、版本、注册令牌,以及按序编排的节点更新免费

随时都可以把高级选项恢复为默认值。付费许可证结束后会发生什么,见定价页的常见问题:48 小时宽限期、48 小时只读,之后 WAF 防护关闭,直到续订。

价格 Read the documentation

今天就为您的应用加上一道防护盾

把它安装在您自己的服务器上,或来信咨询许可证事宜。

Learn more in the documentation