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

# Create a standing optimisation rule (see get_automation_rule_schema). Two-step: the first call validates the rule, dry-runs it, and returns a preview + confirmationToken; after the user approves, call again with the token to save. suggest_only rules queue matches for approval; auto_run rules act on their own and need an owner/admin.

> Create a standing optimisation rule (see get_automation_rule_schema). Two-step: the first call validates the rule, dry-runs it, and returns a preview + confirmationToken; after the user approves, call again with the token to save. suggest_only rules queue matches for approval; auto_run rules act on their own and need an owner/admin.



## OpenAPI

````yaml /openapi.json post /tools/create_automation_rule
openapi: 3.1.0
info:
  title: AdStellar API
  version: 1.0.0
  description: >-
    Public REST API for AdStellar — creative generation, video generation,
    campaign management, and analytics. Every endpoint maps 1:1 to an AdStellar
    MCP tool.
servers:
  - url: https://app.adstellar.ai/api/v1
security: []
paths:
  /tools/create_automation_rule:
    post:
      summary: >-
        Create a standing optimisation rule (see get_automation_rule_schema).
        Two-step: the first call validates the rule, dry-runs it, and returns a
        preview + confirmationToken; after the user approves, call again with
        the token to save. suggest_only rules queue matches for approval;
        auto_run rules act on their own and need an owner/admin.
      description: >-
        Create a standing optimisation rule (see get_automation_rule_schema).
        Two-step: the first call validates the rule, dry-runs it, and returns a
        preview + confirmationToken; after the user approves, call again with
        the token to save. suggest_only rules queue matches for approval;
        auto_run rules act on their own and need an owner/admin.
      operationId: create_automation_rule
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              type: object
              properties:
                rule:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties: {}
                  description: Rule object matching get_automation_rule_schema.
                workspaceId:
                  description: >-
                    Workspace to act in (must be granted to this credential).
                    Omit for the primary workspace.
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                confirmationToken:
                  description: >-
                    Omit on the first call to get a preview + token; pass the
                    token back to execute.
                  type: string
              required:
                - rule
              additionalProperties: false
      responses:
        '200':
          description: Tool result
        '401':
          description: Missing or invalid API key
        '403':
          description: Missing required scope
        '429':
          description: Rate limit exceeded
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: AdStellar API key (ast_live_...)

````

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