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

# Get an action

> Returns one action, including when the agent should use it, the fields it collects and the channels it can run on. Other configuration is not included.



## OpenAPI

````yaml /api-v2-openapi.json get /agents/{agentId}/actions/{actionId}
openapi: 3.1.0
info:
  title: Chatbase API v2
  version: 2.0.0
  description: >-
    Chatbase API v2 - A robust, structured API for managing agents,
    conversations, and the helpdesk.
servers:
  - url: https://www.chatbase.co/api/v2
    description: Chatbase API v2
security: []
paths:
  /agents/{agentId}/actions/{actionId}:
    get:
      tags:
        - Actions
      summary: Get an action
      description: >-
        Returns one action, including when the agent should use it, the fields
        it collects and the channels it can run on. Other configuration is not
        included.
      operationId: getAction
      parameters:
        - schema:
            type: string
            minLength: 1
            description: The agent ID
            example: 5QHA6VB-DIAbBhxwqxfdi
          required: true
          description: The agent ID
          name: agentId
          in: path
        - schema:
            type: string
            format: uuid
            description: The action ID
            example: 3f1c2a9e-8b7d-4c1e-9f0a-2d6b7e8c9a10
          required: true
          description: The action ID
          name: actionId
          in: path
      responses:
        '200':
          description: The action
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Action'
        '400':
          description: >-
            The request body failed schema validation. Inspect the `details`
            object in the error response for field-level errors.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: VALIDATION_INVALID_BODY
                  message: Invalid request
        '401':
          description: >-
            No Authorization header present. Provide a valid API key as a Bearer
            token in the Authorization header: `Authorization: Bearer
            <api-key>`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: AUTH_MISSING_API_KEY
                  message: Authentication required
        '403':
          description: >-
            Your current plan does not include API access. Upgrade to the Basic
            plan or higher to use the API.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: SUBSCRIPTION_API_RESTRICTED_PLAN
                  message: A Basic plan or higher is required to access the API
        '404':
          description: >-
            No action matches the provided `actionId` on this agent, or it does
            not belong to the authenticated account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: ACTION_NOT_FOUND
                  message: Action not found
        '429':
          description: >-
            Rate limit exceeded. Check the `X-RateLimit-Reset` response header
            for the Unix epoch seconds when the limit resets.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: RATE_LIMIT_TOO_MANY_REQUESTS
                  message: Too many requests, please try again later
        '500':
          description: >-
            An unhandled server error occurred. If the issue persists, contact
            support with the `x-request-id` response header value for debugging.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: Something went wrong, please try again
        '503':
          description: >-
            Chatbase is undergoing scheduled maintenance and the API is
            temporarily rejecting requests. This is transient; retry after a
            short delay. Requests are rejected before any data is read or
            written, so no partial changes are applied.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: SERVICE_UNDER_MAINTENANCE
                  message: >-
                    The API is temporarily unavailable for scheduled
                    maintenance, please try again later
      security:
        - bearerAuth: []
components:
  schemas:
    Action:
      allOf:
        - $ref: '#/components/schemas/ActionListItem'
        - type: object
          properties:
            whenToUse:
              type:
                - string
                - 'null'
              description: >-
                Tells the agent when to call the action. Null when it is not
                set.
            fields:
              type: array
              items:
                $ref: '#/components/schemas/ActionField'
              description: >-
                What the action collects. `input` fields are the editable list,
                except on create-ticket actions, where they cannot be changed.
                `form` fields are the collect-leads form (description is the
                label) and `widget` fields are the linked widget variables; both
                are shown and cannot be changed. Built-in fields and a shared
                ticket form are not included.
            channels:
              type: array
              items:
                type: object
                properties:
                  channel:
                    type: string
                    enum:
                      - chat_widget
                      - help_page
                      - center_stage
                      - side_panel
                      - slack
                      - whatsapp
                      - messenger
                      - instagram
                      - salesforce
                      - zendesk
                      - zendesk_messaging
                      - api
                      - email
                      - android_sdk
                      - ios_sdk
                      - phone
                      - search
                  connected:
                    type: boolean
                    description: Whether the channel is deployed on the agent
                  setup:
                    type: boolean
                    description: Whether the channel is set up for the action to run
                  enabled:
                    type: boolean
                    description: >-
                      Whether the action is switched on for this channel. It
                      runs only when its status is also `enabled`.
                required:
                  - channel
                  - connected
                  - setup
                  - enabled
              description: >-
                Channels the action can be switched on or off for, as on the
                Deploy page. New channels may be added.
          required:
            - whenToUse
            - fields
            - channels
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code
            message:
              type: string
              description: Human-readable error message
            details:
              type: object
              additionalProperties:
                type: string
              description: Field-level validation errors
          required:
            - code
            - message
      required:
        - error
    ActionListItem:
      type: object
      properties:
        id:
          type: string
          description: Action ID
        name:
          type: string
          description: Action name, unique within the agent
        type:
          type: string
          enum:
            - collect-leads
            - collect-data
            - custom-button
            - custom-action
            - shopify-get-cart
            - shopify-update-cart
            - shopify-place-order
            - shopify-exchange
            - shopify-show-product
            - shopify-show-order
            - shopify-update-profile
            - shopify-update-address
            - shopify-account-access
            - shopify-get-metafields
            - shopify-tag-order
            - shopify-create-return
            - magento-show-product
            - slack-notify
            - stripe-get-subscription-info
            - stripe-get-invoices
            - stripe-change-billing-address
            - stripe-manage-subscription
            - stripe-find-payments
            - stripe-refund-payment
            - chatbase-update-chatbot-settings
            - calcom-get-slots
            - calendly-get-slots
            - tavily-web-search
            - sunshine-live-chat
            - zendesk-messaging-live-chat
            - freshchat-live-chat
            - salesforce-live-chat
            - chatbase-live-chat
            - customize-suggested-messages
            - custom-form
            - create-ticket
            - transfer-to-phone-number
            - human-in-the-loop
          description: Action type
          example: custom-action
        status:
          type: string
          enum:
            - enabled
            - disabled
            - draft
          description: >-
            Whether the agent can use the action. `draft` means its setup isn't
            complete, so the agent can't use it.
        procedureOnly:
          type: boolean
          description: Whether the action runs only when a procedure calls it
      required:
        - id
        - name
        - type
        - status
        - procedureOnly
    ActionField:
      oneOf:
        - $ref: '#/components/schemas/ActionInputField'
        - $ref: '#/components/schemas/ActionFormField'
        - $ref: '#/components/schemas/ActionWidgetField'
      discriminator:
        propertyName: source
        mapping:
          input: '#/components/schemas/ActionInputField'
          form: '#/components/schemas/ActionFormField'
          widget: '#/components/schemas/ActionWidgetField'
    ActionInputField:
      type: object
      properties:
        source:
          type: string
          enum:
            - input
        name:
          type: string
        type:
          type: string
          example: text
        description:
          type: string
        required:
          type: boolean
        array:
          type: boolean
        default:
          type:
            - string
            - 'null'
      required:
        - source
        - name
        - type
        - description
        - required
        - array
    ActionFormField:
      type: object
      properties:
        source:
          type: string
          enum:
            - form
        name:
          type: string
        type:
          type: string
        description:
          type: string
          description: The label shown on the collect-leads form
        required:
          type: boolean
      required:
        - source
        - name
        - type
        - description
        - required
    ActionWidgetField:
      type: object
      properties:
        source:
          type: string
          enum:
            - widget
        name:
          type: string
        type:
          type: string
        description:
          type: string
        required:
          type: boolean
      required:
        - source
        - name
        - type
        - description
        - required
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key from your account settings

````

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