---
title: "Create a New Action"
method: POST
path: "/v1/actions"
tags: ["Actions"]
---

# Create a New Action

`POST /v1/actions`

Create a New Action

## Request body

- ActionInput
  - `name` string, required — Name of the action
  - `description` string, nullable — Description about the action and it should also contain when the action should be triggered
  - `parameters` object, required — Parameters for the action. It should be a JSON schema object
  - `endpoint` union, required — Endpoint for the action
    - HttpActionEndpoint
      - `url` string, required — Action endpoint URL
      - `method` 'GET' | 'POST' — Method to be used for invoking the endpoint
      - `headers` object, nullable — Headers for the endpoint
      - `payload` object, nullable — Payload for the endpoint
    - InternalActionEndpoint — Internal action endpoint to be used for calling the action inside the module. Not used by external users
      - `module` string, required — Module where the action is defined
      - `function` string, required — Function to be called inside the module
  - `userWaitingText` string, nullable — Text to be rendered to user when action is invoked
  - `userSuccessText` string, nullable — Text to be rendered to user when action is successful
  - `userErrorText` string, nullable — Text to be rendered to user when action is not successful
  - `invocationTrigger` 'user_query' | 'webhook.conversation_start' | 'webhook.conversation_end', required

## Response `200`

Action created successfully

- BackendDbModelsAction — Action entity to store the actions which can be performed by ai agents
  - `id` string
  - `orgId` string
  - `name` string
  - `description` string, nullable
  - `parameters` object, nullable
  - `endpoint` object, nullable
  - `invocationTrigger` string, nullable
  - `userWaitingText` string, nullable
  - `userSuccessText` string, nullable
  - `userErrorText` string, nullable
  - `createdBy` string
  - `createdAt` string, date-time
  - `updatedBy` string
  - `updatedAt` string, date-time

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/tratahq/apis/trata-ai-api.md) · [All operations](https://skmtc.net/tratahq/apis/trata-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tratahq/trata-ai-api/revisions/8f7b69ee5a90/schema)
