Get started with the SDKs

Download the TypeScript or Python SDK from the OpenWAF API, configure an API token and list your zones.

  1. Download the SDK into your project. The files are public and need no token.

    curl -fsSLO https://dash.openwaf.dev/v1/sdk/openwaf.ts

    Commit the file with your code. To update it, download it again; see How the SDKs are generated.

  2. Create an API token in the dashboard under API tokens. Read only is enough for this guide; use Tech to make changes. Tokens start with owf_.

  3. Configure the client through the environment, so the token stays out of your code:

    export OPENWAF_API_URL=https://dash.openwaf.dev
    read -rs OPENWAF_TOKEN && export OPENWAF_TOKEN
  4. List your zones.

    list-zones.ts
    import { OpenWAF } from "./openwaf.ts";
    
    const owf = new OpenWAF();
    const { items = [] } = await owf.listZones();
    for (const z of items) {
      console.log([z.name, z.status, "v" + z.config_version].join("\t"));
    }
    bun list-zones.ts        # or: node --experimental-strip-types list-zones.ts

The client finds your organisation from the token. Every zone has an id: zone methods take that id, not the domain name. Next: Create a DNS record.

Last updated:

↑↓ to navigate↵ to openesc to close