v17

latestOpenAPI 3.0.1raw.githubusercontent.com2026-07-08165682.0 MB
Traffic rules

Create a traffic rule

Authorization

A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

Service Token Accesses write_database

OAuth Scopes

ResourceScopes
Organizationwrite_databases
Databasewrite_database
post/organizations/{organization}/databases/{database}/branches/{branch}/traffic/budgets/{budget_id}/rules

Path parameters

organizationstring required

Organization name slug from list_organizations. Example: acme.

databasestring required

Database name slug from list_databases. Example: app-db.

branchstring required

Branch name from list_branches. Example: main.

budget_idstring required

The ID of the traffic budget

Request body

kind'match' | 'each'

Kind of rule

keyspacestring

The keyspace to apply a query pattern rule to

fingerprintstring

Query pattern fingerprint to apply rule to

tagsstring[]

Optional array of tags for this rule. Each rules take exactly one tag.

Response

Returns the created traffic rule

idstring required

The ID of the traffic rule

kind'match' | 'each' required

The kind of rule

fingerprintstring nullable

The query fingerprint targeted by this rule

keyspacestring nullable

The keyspace of the fingerprint

syntax_highlighted_sqlstring required

Syntax highlighted SQL for rules with SQL keys

created_atstring required

When the rule was created

updated_atstring required

When the rule was updated