---
title: "Create a pool rule"
method: POST
path: "/api/pool_rules"
tags: ["Pool"]
---

# Create a pool rule

`POST /api/pool_rules`

Create a rule that assigns an attempt to a pool based on conditions. A rule consists of a priority, conditions, and a pool ID. Rules are evaluated in priority order, from the lowest value to the highest value. Multiple rules cannot have the same priority. If all of a rule's conditions are met, an attempt is assigned to its pool. If none of the rules are met, an attempt is assigned to a default pool.

## Request body

- RestPoolRuleCreateRequest
  - `conditions` RestPoolRuleCondition[], required — Conditions that must be met for the rule to assign an attempt to a pool. If multiple conditions are specified, all conditions must be met.
    - union
      - object
        - `type` 'invocation_type' | 'project_name' | 'workflow_name' | 'workflow_type', required — Type of the condition.
        - `values` string[], required — Invocation types to match against. If multiple values are provided, the condition is met if the invocation type is one of the provided invocation types.
      - object
        - `operator` 'starts_with', required — Operator to use for matching the project name.
        - `type` 'invocation_type' | 'project_name' | 'workflow_name' | 'workflow_type', required — Type of the condition.
        - `values` string[], required — Values to match against the project name. If multiple values are provided, the condition is met if the project name matches one of the provided values.
      - object
        - `operator` 'starts_with', required — Operator to use for matching the workflow name.
        - `type` 'invocation_type' | 'project_name' | 'workflow_name' | 'workflow_type', required — Type of the condition.
        - `values` string[], required — Values to match against the workflow name. If multiple values are provided, the condition is met if the workflow name matches one of the provided values.
      - object
        - `type` 'invocation_type' | 'project_name' | 'workflow_name' | 'workflow_type', required — Type of the condition.
        - `values` string[], required — Workflow types to match against. If multiple values are provided, the condition is met if the workflow type is one of the provided workflow types.
  - `poolId` string, required — ID of the pool that this rule assigns attempts to.
  - `priority` integer, required — Priority of the rule. Rules are evaluated in priority order, from the lowest value to the highest value. Multiple rules cannot have the same priority.

## Response `201`

Pool rule created

- RestPoolRule
  - `conditions` RestPoolRuleCondition[], required — Conditions that must be met for the rule to assign an attempt to a pool. If multiple conditions are specified, all conditions must be met.
    - union
      - object
        - `type` 'invocation_type' | 'project_name' | 'workflow_name' | 'workflow_type', required — Type of the condition.
        - `values` string[], required — Invocation types to match against. If multiple values are provided, the condition is met if the invocation type is one of the provided invocation types.
      - object
        - `operator` 'starts_with', required — Operator to use for matching the project name.
        - `type` 'invocation_type' | 'project_name' | 'workflow_name' | 'workflow_type', required — Type of the condition.
        - `values` string[], required — Values to match against the project name. If multiple values are provided, the condition is met if the project name matches one of the provided values.
      - object
        - `operator` 'starts_with', required — Operator to use for matching the workflow name.
        - `type` 'invocation_type' | 'project_name' | 'workflow_name' | 'workflow_type', required — Type of the condition.
        - `values` string[], required — Values to match against the workflow name. If multiple values are provided, the condition is met if the workflow name matches one of the provided values.
      - object
        - `type` 'invocation_type' | 'project_name' | 'workflow_name' | 'workflow_type', required — Type of the condition.
        - `values` string[], required — Workflow types to match against. If multiple values are provided, the condition is met if the workflow type is one of the provided workflow types.
  - `id` string, required — ID of the pool rule.
  - `poolId` string, required — ID of the pool that this rule assigns attempts to.
  - `priority` integer, required — Priority of the rule. Rules are evaluated in priority order, from the lowest value to the highest value. Multiple rules cannot have the same priority.

## Other responses

- `400` — Invalid request
- `403` — Forbidden

---

[API](https://skmtc.net/treasure/apis/treasure-workflow.md) · [All operations](https://skmtc.net/treasure/apis/treasure-workflow/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/treasure/treasure-workflow/revisions/4eedf1838ef4/schema)
