> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adsmcp.si/llms.txt
> Use this file to discover all available pages before exploring further.

# create_automation_rule

> Create an approval-first automation rule.

> [!NOTE]
>
> **ADSMCP setting.** Reads or changes ADSMCP's own records (monitors, schedules, rules, queue views). It does not change an ad account.

Create an approval-first automation rule.

**Platform:** ADSMCP (registered under `meta`) · **Type:** Control

## How to call it

* **MCP:** on `https://mcp.adsmcp.si/mcp`, run it through the `meta_ads_write` tool with `{"action": "execute", "tool_name": "create_automation_rule", "arguments": { ... }}`, or call `create_automation_rule` by name. `search_tools` finds it and `get_tool_schema` returns its arguments; `https://mcp.adsmcp.si/mcp/flat` lists every tool by name.
* **REST:** `POST https://mcp.adsmcp.si/api/v1/tools/create_automation_rule/execute` with `Authorization: Bearer sk_live_...` and a JSON body `{"platform": "meta", "arguments": { ... }}`. The arguments are listed below; they are exactly the tool's input schema.


## OpenAPI

````yaml api-reference/openapi.json POST /api/v1/tools/create_automation_rule/execute
openapi: 3.1.0
info:
  title: ADSMCP REST API
  version: 0.1.0
  description: >-
    ADSMCP REST API: every public ADSMCP tool as POST
    /api/v1/tools/{name}/execute. Generated from the ADSMCP code (the service
    serves the same document at GET /api/v1/openapi.json). Changes to ad
    accounts are staged for approval by a person on the ADSMCP dashboard;
    nothing in this API can approve them.
servers:
  - url: https://mcp.adsmcp.si
    description: ADSMCP MCP and REST service
security: []
paths:
  /api/v1/tools/create_automation_rule/execute:
    post:
      tags:
        - meta
      summary: Create an approval-first automation rule.
      description: >-
        Create an approval-first automation rule. Use this when you intend that
        change. Write tools create paused objects or wait for approval, and a
        failed spend-affecting call is not retried automatically.
      operationId: execute_create_automation_rule
      parameters:
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
          description: Bearer token
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                platform:
                  type: string
                  default: meta
                arguments:
                  type: object
                  properties:
                    name:
                      type: string
                    platform:
                      type: string
                    metric:
                      type: string
                    operator:
                      type: string
                      enum:
                        - gt
                        - gte
                        - lt
                        - lte
                        - eq
                    threshold:
                      type: number
                    lookback_window:
                      type: string
                    action:
                      type: string
                      enum:
                        - notify
                        - create_pending_action
                        - pause_campaign
                        - update_budget
                    action_arguments:
                      type: object
                      additionalProperties: true
                    cooldown_minutes:
                      type: number
                  required:
                    - name
                    - platform
                    - metric
                    - operator
                    - threshold
                    - action
                  additionalProperties: false
              additionalProperties: false
      responses:
        '200':
          description: Tool execution result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExecuteToolResponse'
        '400':
          description: Invalid JSON input.
        '401':
          description: Authentication error.
      security:
        - bearerAuth: []
components:
  schemas:
    ExecuteToolResponse:
      type: object
      properties:
        ok:
          type: boolean
        platform:
          type: string
        tool:
          type: string
        data: {}
        error:
          anyOf:
            - type: 'null'
            - $ref: '#/components/schemas/ErrorResponse'
        mcp_response: {}
      required:
        - ok
        - platform
        - tool
        - error
        - mcp_response
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        code: {}
        message:
          type: string
        details: {}
      required:
        - message
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.