> ## Documentation Index
> Fetch the complete documentation index at: https://conductorone-docs-mcp-bridge-private-server.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Automation

> Create an automation rule for an app entitlement. Automations automatically provision or revoke access based on defined conditions.



## OpenAPI

````yaml https://spec.speakeasy.com/conductor-one/conductorone/my-source-with-code-samples post /api/v1/apps/{app_id}/entitlements/{app_entitlement_id}/automation/create
openapi: 3.1.0
info:
  description: The C1 API is a HTTP API for managing C1 resources.
  title: C1 API
  version: 0.1.0-alpha
servers:
  - description: The C1 API server for the current tenant.
    url: https://{tenantDomain}.conductor.one
    variables:
      tenantDomain:
        default: example
        description: The domain of the tenant to use for this request.
security:
  - bearerAuth: []
    oauth: []
paths:
  /api/v1/apps/{app_id}/entitlements/{app_entitlement_id}/automation/create:
    post:
      tags:
        - App Entitlement Automation
      summary: Create Automation
      description: >-
        Create an automation rule for an app entitlement. Automations
        automatically provision or revoke access based on defined conditions.
      operationId: c1.api.app.v1.AppEntitlements.CreateAutomation
      parameters:
        - in: path
          name: app_id
          required: true
          schema:
            description: The ID of the app that contains the entitlement.
            type: string
        - in: path
          name: app_entitlement_id
          required: true
          schema:
            description: The ID of the app entitlement to create an automation for.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/c1.api.app.v1.CreateAutomationRequestInput'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/c1.api.app.v1.CreateAutomationResponse'
          description: Successful response
      x-codeSamples:
        - lang: go
          label: CreateAutomation
          source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/conductorone/conductorone-sdk-go/pkg/models/shared\"\n\tconductoronesdkgo \"github.com/conductorone/conductorone-sdk-go\"\n\t\"github.com/conductorone/conductorone-sdk-go/pkg/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := conductoronesdkgo.New(\n        conductoronesdkgo.WithSecurity(shared.Security{\n            BearerAuth: \"<YOUR_BEARER_TOKEN_HERE>\",\n            Oauth: \"<YOUR_OAUTH_HERE>\",\n        }),\n    )\n\n    res, err := s.AppEntitlements.CreateAutomation(ctx, operations.C1APIAppV1AppEntitlementsCreateAutomationRequest{\n        AppEntitlementID: \"<id>\",\n        AppID: \"<id>\",\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.CreateAutomationResponse != nil {\n        // handle response\n    }\n}"
        - lang: typescript
          label: Typescript (SDK)
          source: >-
            import { ConductoroneSDKTypescript } from
            "conductorone-sdk-typescript";


            const conductoroneSDKTypescript = new ConductoroneSDKTypescript({
              security: {
                bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
                oauth: "<YOUR_OAUTH_HERE>",
              },
            });


            async function run() {
              const result = await conductoroneSDKTypescript.appEntitlements.createAutomation({
                appId: "<id>",
                appEntitlementId: "<id>",
              });

              console.log(result);
            }


            run();
components:
  schemas:
    c1.api.app.v1.CreateAutomationRequestInput:
      description: The CreateAutomationRequest message.
      properties:
        automation:
          oneOf:
            - $ref: '#/components/schemas/c1.api.app.v1.AppEntitlementAutomation'
            - type: 'null'
      title: Create Automation Request
      type: object
      x-speakeasy-name-override: CreateAutomationRequest
    c1.api.app.v1.CreateAutomationResponse:
      description: The CreateAutomationResponse message.
      properties:
        automation:
          oneOf:
            - $ref: '#/components/schemas/c1.api.app.v1.AppEntitlementAutomation'
            - type: 'null'
      title: Create Automation Response
      type: object
      x-speakeasy-name-override: CreateAutomationResponse
    c1.api.app.v1.AppEntitlementAutomation:
      description: >
        The AppEntitlementAutomation message.


        This message contains a oneof named conditions. Only a single field of
        the following list may be set at a time:
          - none
          - entitlements
          - cel
          - basic
      properties:
        appEntitlementId:
          description: The unique ID for the App Entitlement.
          readOnly: true
          type:
            - string
            - 'null'
        appId:
          description: The ID of the app that is associated with the app entitlement.
          readOnly: true
          type:
            - string
            - 'null'
        basic:
          oneOf:
            - $ref: >-
                #/components/schemas/c1.api.app.v1.AppEntitlementAutomationRuleBasic
            - type: 'null'
        cel:
          oneOf:
            - $ref: >-
                #/components/schemas/c1.api.app.v1.AppEntitlementAutomationRuleCEL
            - type: 'null'
        createdAt:
          format: date-time
          readOnly: true
          type:
            - string
            - 'null'
        deletedAt:
          format: date-time
          readOnly: true
          type:
            - string
            - 'null'
        description:
          description: The description of the app entitlement.
          type:
            - string
            - 'null'
        displayName:
          description: The display name of the app entitlement.
          type:
            - string
            - 'null'
        entitlements:
          oneOf:
            - $ref: >-
                #/components/schemas/c1.api.app.v1.AppEntitlementAutomationRuleEntitlement
            - type: 'null'
        lastRunStatus:
          oneOf:
            - $ref: >-
                #/components/schemas/c1.api.app.v1.AppEntitlementAutomationLastRunStatus
            - type: 'null'
        managedByRequestCatalogId:
          description: >-
            When set, this automation is managed by an access profile's bundle
            automation.
             Read-only. Not settable via this API.
          readOnly: true
          type:
            - string
            - 'null'
        none:
          oneOf:
            - $ref: >-
                #/components/schemas/c1.api.app.v1.AppEntitlementAutomationRuleNone
            - type: 'null'
        updatedAt:
          format: date-time
          readOnly: true
          type:
            - string
            - 'null'
      title: App Entitlement Automation
      type: object
      x-speakeasy-entity: App Entitlement Automation
      x-speakeasy-name-override: AppEntitlementAutomation
    c1.api.app.v1.AppEntitlementAutomationRuleBasic:
      description: The AppEntitlementAutomationRuleBasic message.
      properties:
        expression:
          description: The expression field.
          type:
            - string
            - 'null'
      title: App Entitlement Automation Rule Basic
      type: object
      x-speakeasy-name-override: AppEntitlementAutomationRuleBasic
    c1.api.app.v1.AppEntitlementAutomationRuleCEL:
      description: The AppEntitlementAutomationRuleCEL message.
      properties:
        expression:
          description: The expression field.
          type:
            - string
            - 'null'
      title: App Entitlement Automation Rule Cel
      type: object
      x-speakeasy-name-override: AppEntitlementAutomationRuleCEL
    c1.api.app.v1.AppEntitlementAutomationRuleEntitlement:
      description: The AppEntitlementAutomationRuleEntitlement message.
      properties:
        entitlementRefs:
          description: The entitlementRefs field.
          items:
            $ref: '#/components/schemas/c1.api.app.v1.AppEntitlementRef'
          type:
            - array
            - 'null'
      title: App Entitlement Automation Rule Entitlement
      type: object
      x-speakeasy-name-override: AppEntitlementAutomationRuleEntitlement
    c1.api.app.v1.AppEntitlementAutomationLastRunStatus:
      description: The AppEntitlementAutomationLastRunStatus message.
      properties:
        errorMessage:
          description: The errorMessage field.
          readOnly: true
          type:
            - string
            - 'null'
        lastCompletedAt:
          format: date-time
          readOnly: true
          type:
            - string
            - 'null'
        status:
          description: The status field.
          enum:
            - APP_ENTITLEMENT_AUTOMATION_RUN_STATUS_UNSPECIFIED
            - APP_ENTITLEMENT_AUTOMATION_RUN_STATUS_SUCCESS
            - APP_ENTITLEMENT_AUTOMATION_RUN_STATUS_FAILED
            - APP_ENTITLEMENT_AUTOMATION_RUN_STATUS_IN_PROGRESS
          readOnly: true
          type:
            - string
            - 'null'
          x-speakeasy-unknown-values: allow
      title: App Entitlement Automation Last Run Status
      type: object
      x-speakeasy-name-override: AppEntitlementAutomationLastRunStatus
    c1.api.app.v1.AppEntitlementAutomationRuleNone:
      description: The AppEntitlementAutomationRuleNone message.
      title: App Entitlement Automation Rule None
      type: object
      x-speakeasy-name-override: AppEntitlementAutomationRuleNone
    c1.api.app.v1.AppEntitlementRef:
      description: The AppEntitlementRef message.
      properties:
        appId:
          description: The appId field.
          type:
            - string
            - 'null'
        id:
          description: The id field.
          type:
            - string
            - 'null'
      title: App Entitlement Ref
      type: object
      x-speakeasy-name-override: AppEntitlementRef
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http
    oauth:
      description: >-
        This API uses OAuth2 with the Client Credential flow.

        Client Credentials must be sent in the BODY, not the headers.

        For an example of how to implement this, refer to the
        [c1TokenSource.Token()](https://github.com/ConductorOne/conductorone-sdk-go/blob/3375fe7c0126d17e7ec4e711693dee7b791023aa/token_source.go#L101-L187)
        function.
      flows:
        clientCredentials:
          scopes: {}
          tokenUrl: /auth/v1/token
      type: oauth2

````