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

# Create OpalScript

> Creates a new `OpalScript`.



## OpenAPI

````yaml https://app.opal.dev/openapi.yaml post /opal-scripts
openapi: 3.1.0
info:
  contact:
    email: hello@opal.dev
    name: Opal Team
    url: https://www.opal.dev/
  description: >-
    The Opal API is a RESTful API that allows you to interact with the Opal
    Security platform programmatically.
  title: Opal API
  version: '1.0'
servers:
  - description: Production
    url: https://api.opal.dev/v1
security: []
tags:
  - name: access-rules
    description: Operations related to access rules
  - name: apps
    description: Operations related to apps
  - name: bundles
    description: Operations related to bundles
  - name: campaigns
    description: Operations related to access review campaigns
  - name: configuration-templates
    description: Operations related to configuration templates
  - name: delegations
    description: Operations related to request reviewer delegations
  - name: event-streams
    description: Operations related to event streaming connections
  - name: events
    description: Operations related to events
  - name: groups
    description: Operations related to groups
  - name: group-bindings
    description: Operations related to group bindings
  - name: idp-group-mappings
    description: Operations related to IDP group mappings
  - name: message-channels
    description: Operations related to message channels
  - name: non-human-identities
    description: Operations related to non-human identities
  - name: on-call-schedules
    description: Operations related to on-call schedules
  - name: opal-queries
    description: Operations related to OpalQuery
  - name: opal-scripts
    description: Operations related to OpalScripts
  - name: owners
    description: Operations related to owners
  - name: requests
    description: Operations related to requests
  - name: resources
    description: Operations related to resources
  - name: paladin
    description: Operations related to Paladin
  - name: sessions
    description: Operations related to sessions
  - name: tags
    description: Operations related to tags
  - name: tokens
    description: Operations related to API tokens
  - name: uars
    description: Operations related to UARs. Deprecated in favor of the `campaigns` API.
  - name: users
    description: Operations related to users
paths:
  /opal-scripts:
    post:
      tags:
        - opal-scripts
      summary: Create OpalScript
      description: Creates a new `OpalScript`.
      operationId: createOpalScript
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOpalScriptInfo'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpalScript'
          description: The created OpalScript.
      security:
        - BearerAuth: []
components:
  schemas:
    CreateOpalScriptInfo:
      description: Information for creating an OpalScript.
      example:
        name: MFA check
        script_type: REQUEST_REVIEW
        owner_id: 7c86c85d-0651-43e2-a748-d69d658418e8
      properties:
        name:
          description: The name of the OpalScript.
          example: MFA check
          type: string
        script_type:
          $ref: '#/components/schemas/OpalScriptTypeEnum'
        script:
          description: The source of the OpalScript.
          type: string
        owner_id:
          description: >-
            The owner of the service user Opal provisions for a `REQUEST_REVIEW`
            script. Required for that script type and ignored for the others,
            which have no reviewer identity.
          example: 7c86c85d-0651-43e2-a748-d69d658418e8
          format: uuid
          type: string
      required:
        - name
        - script_type
        - script
      type: object
    OpalScript:
      description: |-
        # OpalScript Object
        ### Description
        The `OpalScript` object represents an OpalScript: a Starlark script that
        automates part of Opal's access lifecycle.
      example:
        opal_script_id: 32acc112-21ff-4669-91c2-21e27683eaa1
        name: MFA check
        script_type: REQUEST_REVIEW
        version: 3
      properties:
        opal_script_id:
          description: The ID of the OpalScript.
          example: 32acc112-21ff-4669-91c2-21e27683eaa1
          format: uuid
          type: string
        name:
          description: The name of the OpalScript.
          example: MFA check
          type: string
        script_type:
          $ref: '#/components/schemas/OpalScriptTypeEnum'
        script:
          description: The source of the OpalScript's latest version.
          type: string
        version:
          description: The version number of the OpalScript's latest version.
          example: 3
          type: integer
        updated_at:
          description: The date the OpalScript was last updated.
          format: date-time
          type: string
      required:
        - opal_script_id
        - name
        - script_type
        - script
        - version
      type: object
    OpalScriptTypeEnum:
      description: The kind of automation an OpalScript performs.
      enum:
        - REQUEST_REVIEW
        - REQUEST_DELEGATION_CONDITION
        - CONTEXT_PROVIDER
      example: REQUEST_REVIEW
      type: string
  securitySchemes:
    BearerAuth:
      scheme: bearer
      type: http

````

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