---
title: "Create script rule"
method: POST
path: "/organizations/{organization_id}/scripts/{script_id}/rules"
tags: ["Scripts"]
---

# Create script rule

`POST /organizations/{organization_id}/scripts/{script_id}/rules`

Create script rule to associate the specified script with resources.

## Path parameters

- `organization_id` string, required
- `script_id` string, required

## Request body

- object
  - `regions` string[]
  - `resource_types` string[]
  - `id` integer
  - `rule_type` string
  - `exclude` boolean
  - `all_accounts` boolean
  - `all_regions` boolean
  - `all_resource_types` boolean
  - `accounts` object[]
    - `rule_id` integer
    - `account_id` string
  - `tags` object[]
    - `Key` string
    - `Value` string
  - `resources` object[]
    - `rule_id` integer
    - `resource_id` string
    - `resource_name` string
    - `account_id` string
    - `type` string
    - `region` string

## Response `200`

200 response

- PostOrganizationsScriptsRulesResponse
  - `model` object
    - `regions` string[]
    - `id` integer
    - `rule_type` string
    - `accounts` object[]
      - `rule_id` integer
      - `account_id` string
      - `ruleId` integer
    - `all_accounts` boolean
    - `all_regions` boolean
    - `resources` object[]
      - `rule_id` integer
      - `type` string
      - `resource_id` string
      - `resource_name` string
      - `account_id` string
      - `region` string
      - `ruleId` integer
    - `tags` string[]
    - `execution_type` string
    - `script_id` integer
    - `updatedAt` string, date-time
    - `createdAt` string, date-time
  - `id` integer
  - `script_id` integer
  - `rule_type` string
  - `execution_type` string
  - `all_accounts` boolean
  - `all_regions` boolean
  - `regions` string[]
  - `resources` object[]
    - `model` object
      - `rule_id` integer
      - `type` string
      - `resource_id` string
      - `resource_name` string
      - `account_id` string
      - `region` string
      - `ruleId` integer
    - `rule_id` integer
    - `resource_id` string
    - `account_id` string
    - `type` string
    - `region` string
    - `resource_name` string
  - `tags` string[]
  - `accounts` object[]
    - `model` object
      - `rule_id` integer
      - `account_id` string
      - `ruleId` integer
    - `rule_id` integer
    - `account_id` string

## Other responses

- `201` — 201 response
- `401` — 401 response
- `403` — 403 response
- `404` — 404 response

---

[API](https://skmtc.dev/druva/apis/authentication.md) · [All operations](https://skmtc.dev/druva/apis/authentication/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/druva/authentication/revisions/2af2bf148b25/schema)
