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

> Create a new action that the AI agent can call during conversations. Use when programmatically managing the AI actions (tools) your agents can call, typically as part of a deploy…

# Create an action



## OpenAPI

````yaml post /actions
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /actions:
    post:
      summary: Create an action
      description: >-
        Create a new action that the AI agent can call during conversations. The
        payload field uses OpenAPI-style parameter and request body
        specifications to define how the API call should be constructed.
      operationId: createAction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateActionPublicDto'
      responses:
        '201':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionPublicResponseDto'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    CreateActionPublicDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/CreateActionPublicDtoInput'
      type: object
      properties:
        name:
          type: string
          description: Action display name
        description:
          description: What this action does
          type: string
        api_endpoint:
          type: string
          format: uri
          description: The full API endpoint URL to call
        request_type:
          type: string
          enum:
            - GET
            - POST
            - PUT
            - PATCH
            - DELETE
          description: HTTP method
        operation_id:
          description: Unique operation ID (auto-generated from name if omitted)
          type: string
        payload:
          type: object
          properties:
            base_url:
              description: Base URL for the API endpoint
              type: string
            path:
              description: API path (e.g. "/api/v1/bookings")
              type: string
            method:
              description: HTTP method (get, post, put, delete, patch)
              type: string
            operationId:
              description: OpenAPI operation ID
              type: string
            summary:
              type: string
            description:
              type: string
            parameters:
              description: Request parameters
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    description: Parameter name
                  in:
                    type: string
                    enum:
                      - query
                      - path
                      - header
                      - cookie
                    description: Where the parameter is sent
                  description:
                    type: string
                  required:
                    type: boolean
                  schema:
                    description: JSON Schema for the parameter value
                    type: object
                    propertyNames:
                      type: string
                    additionalProperties: {}
                required:
                  - name
                  - in
            requestBody:
              description: Request body specification
              type: object
              properties:
                description:
                  type: string
                required:
                  type: boolean
                content:
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties:
                    type: object
                    properties:
                      schema:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                  description: >-
                    Content type to schema mapping (e.g. "application/json": {
                    schema: {...} })
              required:
                - content
            responses:
              description: Response specifications keyed by status code
              type: object
              propertyNames:
                type: string
              additionalProperties: {}
          additionalProperties: {}
          description: >-
            OpenAPI-style operation spec: parameters, requestBody, responses,
            etc.
        enabled_on_channel:
          description: Channel restrictions (defaults to web only)
          type: object
          properties:
            channels:
              type: array
              items:
                $ref: '#/components/schemas/SessionChannel'
              description: >-
                Channels where this action is available (e.g. ["web", "email",
                "whatsapp"])
          required:
            - channels
        pinned:
          description: Whether to pin this action prominently
          type: boolean
        tags:
          description: Tags for organizing actions
          type: array
          items:
            type: string
        require_form_submission:
          description: Require the user to submit a form before executing
          type: boolean
      required:
        - name
        - api_endpoint
        - request_type
        - payload
    ActionPublicResponseDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/ActionPublicResponseDto'
      type: object
      properties:
        id:
          type: string
          description: Unique action ID
        name:
          type: string
          description: Action display name
        description:
          anyOf:
            - type: string
            - type: 'null'
          description: What this action does
        api_endpoint:
          anyOf:
            - type: string
            - type: 'null'
          description: The API endpoint URL this action calls
        request_type:
          anyOf:
            - type: string
            - type: 'null'
          description: HTTP method (GET, POST, PUT, PATCH, DELETE)
        operation_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Unique operation ID used to reference this action
        payload:
          anyOf:
            - type: object
              properties:
                base_url:
                  description: Base URL for the API endpoint
                  type: string
                path:
                  description: API path (e.g. "/api/v1/bookings")
                  type: string
                method:
                  description: HTTP method (get, post, put, delete, patch)
                  type: string
                operationId:
                  description: OpenAPI operation ID
                  type: string
                summary:
                  type: string
                description:
                  type: string
                parameters:
                  description: Request parameters
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        description: Parameter name
                      in:
                        type: string
                        enum:
                          - query
                          - path
                          - header
                          - cookie
                        description: Where the parameter is sent
                      description:
                        type: string
                      required:
                        type: boolean
                      schema:
                        description: JSON Schema for the parameter value
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                    required:
                      - name
                      - in
                    additionalProperties: false
                requestBody:
                  description: Request body specification
                  type: object
                  properties:
                    description:
                      type: string
                    required:
                      type: boolean
                    content:
                      type: object
                      propertyNames:
                        type: string
                      additionalProperties:
                        type: object
                        properties:
                          schema:
                            type: object
                            propertyNames:
                              type: string
                            additionalProperties: {}
                        additionalProperties: false
                      description: >-
                        Content type to schema mapping (e.g. "application/json":
                        { schema: {...} })
                  required:
                    - content
                  additionalProperties: false
                responses:
                  description: Response specifications keyed by status code
                  type: object
                  propertyNames:
                    type: string
                  additionalProperties: {}
              additionalProperties: {}
              description: OpenAPI-style operation specification for the action
            - type: 'null'
          description: >-
            OpenAPI-style operation spec defining parameters, request body, and
            responses
        status:
          anyOf:
            - type: string
            - type: 'null'
          description: Action status (e.g. "live")
        pinned:
          type: boolean
          description: Whether this action is pinned prominently
        tags:
          description: Tags for organizing actions
          type: array
          items:
            type: string
        enabled_on_channel:
          type: object
          properties:
            channels:
              type: array
              items:
                $ref: '#/components/schemas/SessionChannel'
              description: Channels where this action is available
          required:
            - channels
          additionalProperties: false
          description: Channel restrictions
        is_handoff_like:
          type: boolean
          description: Whether this action behaves like a handoff to a human agent
        require_form_submission:
          anyOf:
            - type: boolean
            - type: 'null'
          description: Whether a form must be submitted before the action executes
        created_at:
          description: When the action was created
          type: string
          format: date-time
        updated_at:
          description: When the action was last updated
          type: string
          format: date-time
      required:
        - id
        - name
        - description
        - api_endpoint
        - request_type
        - operation_id
        - payload
        - status
        - pinned
        - tags
        - enabled_on_channel
        - is_handoff_like
        - require_form_submission
        - created_at
        - updated_at
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
    SessionChannel:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/SessionChannel'
      type: string
      enum:
        - web
        - email
        - phone_voice
        - slack
        - sms
        - whatsapp
        - instagram
        - messenger
        - api
        - web_voice
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````