Policy Sets: Backup & Version Control via API

Gomboc's Policy Sets can be fully managed through the Rules Service API, giving you programmatic access to export, back up, and restore your policy configuration. This is useful for:

  • Disaster recovery — quickly restore your configuration after accidental changes.

  • Environment promotion — copy policy sets from a staging org to production.

  • Audit trails — track every change to your policy configuration in Git history.

  • GitOps workflows — store the desired state of your policy sets in a repository and reconcile it on a schedule.


Prerequisites

Personal Access Token (PAT)

All Rules Service API calls require a Bearer token. Generate one from the Gomboc Portal:

  1. Open the account dropdown (top-right corner) → Settings.

  2. Select Personal Access Tokens.

  3. Click Generate Token, give it a name and an expiry, then click Create.

  4. Copy the token somewhere safe — it is shown only once.

Set it as an environment variable for the examples below:

export GOMBOC_TOKEN="<your-personal-access-token>"

The scripts on this page also require jq and curl.

API Base URL

All Rules Service endpoints are served at:


Concepts

In the Gomboc Portal, a Policy Set is shown under Policy Management → Policy Sets.

Internally — and through the API — each policy set is a Channel: a named, saved search over the policy library that determines which rules are applied to your workspaces.

A channel has the following fields:

Field
Type
Description

name

string

Unique identifier (also used as the human-readable label)

query

string (optional)

ORL search query that selects rules

filters

array of strings

Additional filter expressions

annotations

object (optional)

Arbitrary key/value metadata tags


Exporting Policy Sets (Backup)

Use GET /api/v1/channels/search to retrieve all policy sets defined in your account. The endpoint supports pagination — iterate over pages until you have collected every record.

Shell export script

Example output (policy-sets.json)


Restoring Policy Sets

Use POST /api/v1/channels/batch/upsert to restore from a backup file. This endpoint creates or updates up to 200 channels in a single request.

Note: Only name, query, filters, and annotations are writable. The id, accountId, createdAt, and updatedAt fields are read-only and are stripped automatically by the script below.

Shell restore script

If the backup file contains more than 200 policy sets, split it into chunks of 200 and call the script once per chunk.


Version Control with Git

Combine the export script with a Git repository to maintain a full history of every change to your policy configuration.

GitHub Actions: automated daily backup

Add GOMBOC_TOKEN as a repository secret in your GitHub repository settings.


Restoring to a Different Environment

You can use the same backup file to copy policy sets across Gomboc organizations (e.g., from staging to production):


API Quick Reference

All endpoints are on https://rules.app.gomboc.ai. Authentication: Authorization: Bearer <PAT>.

Operation
Method
Path
Key parameters

List all policy sets

GET

/api/v1/channels/search

page, perPage, query

Get one policy set

GET

/api/v1/channels/get

name (query param)

Create a policy set

POST

/api/v1/channels/create

name, query, filters, annotations

Update a policy set

PUT

/api/v1/channels/update

name, query, filters, annotations

Batch create

POST

/api/v1/channels/batch/create

array of channels, onConflict

Batch upsert (restore)

POST

/api/v1/channels/batch/upsert

array of channels

Delete a policy set

DELETE

/api/v1/channels/delete

name (query param)

List rules in a policy set

GET

/api/v1/channels/rules

name, page, perPage

For the full OpenAPI specification, see the Rule Service API reference.


FAQ

Will restoring a policy set overwrite the existing one? Yes. batch/upsert updates existing channels matched by name and creates any that do not exist yet. To add new channels without touching existing ones, use batch/create with "onConflict": "skip" instead.

Do I need to back up the rules themselves? Built-in Gomboc rules are managed by Gomboc and do not need to be backed up. If you have published custom ORL rules, those can be exported separately using the /api/v1/rules/search endpoint — see the Rule Service API documentation.

What happens to workspaces if I delete and re-create a policy set? Workspace assignments are stored separately. Deleting and re-creating a policy set with the same name may require you to re-assign it to workspaces in the Portal. Use batch/upsert (update-in-place) to avoid this.

Last updated