---
title: "Check traffic rules before publishing them"
method: POST
path: "/v1/spaces/{spaceId}/rules/validate"
tags: ["Spaces"]
---

# Check traffic rules before publishing them

`POST /v1/spaces/{spaceId}/rules/validate`

## Request

- Base URL: `https://api.spacefast.com`
- URL: `https://api.spacefast.com/v1/spaces/{spaceId}/rules/validate`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://api.spacefast.com/v1/auth/oauth2/authorize`, token URL `https://api.spacefast.com/v1/auth/oauth2/token`; client credentials, token URL `https://api.spacefast.com/v1/auth/oauth2/token`, scopes: `spaces:write`)

Checks the rules against the rule grammar and then against the edge, and returns every problem with the field it is in. Writes nothing. A rule the grammar refuses is reported here as an issue, so one request answers for the whole list.

## Path parameters

- `spaceId` string, required

## Request body

- object: Traffic rules to check before you publish them.
  - `firewall` unknown[]: Firewall rules to check, in the shape `config.firewall` takes.
    - unknown
  - `cache` object
    - `bypass` unknown[]: Cache-bypass rules to check, in the shape `config.cache.bypass` takes.
      - unknown

## Response `200`

Response for status 200

- object
  - `$schema` string, uri: Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.
  - `data` object, required
    - `valid` boolean, required: True when every rule is one the edge accepts.
    - `issues` TrafficRuleIssue[], required: Every problem found, in rule order.
      - `path` string, required: Which rule and which field the problem is in, for example `firewall[0].match.country`.
      - `message` string, required: What is wrong, and what to write instead.

## Other responses

- `default`: Problem details (RFC 9457). Any 4xx/5xx response is one `application/problem+json` document.

---

[API](https://skmtc.dev/spacefast/apis/spacefast-api.md) · [All operations](https://skmtc.dev/spacefast/apis/spacefast-api/llms.txt) · [OpenAPI document](https://skmtc.dev/spacefast/apis/spacefast-api/revisions/bd165bc7c983?raw)
