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

# Create automation

> Creates a new automation that triggers an action when an email matching 
the specified criteria is received.




## OpenAPI

````yaml /openapi.yaml post /automations
openapi: 3.0.0
info:
  title: MailCare API
  version: '1.0'
  description: API documentation for MailCare
servers:
  - url: https://mailcare.io/api/teams/{teamId}
    variables:
      teamId:
        default: '0'
        description: The team identifier
security: []
paths:
  /automations:
    post:
      tags:
        - Automations
      summary: Create automation
      description: |
        Creates a new automation that triggers an action when an email matching 
        the specified criteria is received.
      requestBody:
        required: true
        content:
          application/vnd.mailcare.v1+json:
            schema:
              type: object
              required:
                - title
              properties:
                title:
                  type: string
                  description: Title of the automation
                  example: Save pdf invoices
                sender:
                  type: string
                  format: email
                  description: Sender that should match (optional)
                  example: shop@example.com
                inbox:
                  type: string
                  format: email
                  description: Inbox that should match (optional)
                  example: claire@example.com
                subject:
                  type: string
                  description: Subject that should match (optional)
                  example: New invoice
                has_attachments:
                  type: boolean
                  description: Email should have at least one attachment (optional)
                  example: true
                action_url:
                  type: string
                  format: uri
                  description: URL that will be called (optional)
                  example: https://example.com/webhooks/save-pdf-invoices
                action_secret_token:
                  type: string
                  description: Use this token to validate received payloads (optional)
                  example: SECRET12345$
                notification_email:
                  type: string
                  format: email
                  nullable: true
                  description: >-
                    Email address to notify on webhook failures (optional). If
                    empty, no notification is sent. At most one notification is
                    sent per automation per UTC day.
                  example: ops@example.com
                action_delete_email:
                  type: boolean
                  description: Email should be deleted after processing (optional)
                  example: true
                disabled:
                  type: boolean
                  description: Disable this automation without deleting it (optional)
                  example: false
                payload_format:
                  type: string
                  description: Payload format to use (optional)
                  enum:
                    - json
                    - raw
                    - json_with_bodies
                  example: json
      responses:
        '201':
          description: Automation successfully created.
        '400':
          description: Bad request. Invalid input data.
        '401':
          description: Unauthorized. Authentication is required.
        '403':
          description: Forbidden. Insufficient permissions.
      security:
        - bearer_auth: []
components:
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````