# Create Agent Action

POST https://services.leadconnectorhq.com/voice-ai/actions

Create a new action for a voice AI agent. Actions define specific behaviors and capabilities for the agent during calls.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `voice-ai-agent-goals.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/voice-ai/actions": {
      "post": {
        "summary": "Create Agent Action",
        "operationId": "createAgentAction",
        "description": "Create a new action for a voice AI agent. Actions define specific behaviors and capabilities for the agent during calls.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSingleActionDTO"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Action created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateActionResponseDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "voice-ai-agent-goals.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "CreateSingleActionDTO": {
        "type": "object",
        "properties": {
          "agentId": {
            "type": "string",
            "description": "Agent ID to attach the action to",
            "example": "507f1f77bcf86cd799439011"
          },
          "locationId": {
            "type": "string",
            "description": "Location ID",
            "example": "507f1f77bcf86cd799439012"
          },
          "actionType": {
            "type": "string",
            "description": "Type of action",
            "enum": [
              "CALL_TRANSFER",
              "DATA_EXTRACTION",
              "IN_CALL_DATA_EXTRACTION",
              "WORKFLOW_TRIGGER",
              "SMS",
              "APPOINTMENT_BOOKING",
              "CUSTOM_ACTION",
              "KNOWLEDGE_BASE"
            ],
            "example": "CALL_TRANSFER"
          },
          "name": {
            "type": "string",
            "description": "Human-readable name for this action",
            "example": "Transfer to Manager"
          },
          "actionParameters": {
            "description": "Action parameters - structure varies by actionType",
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "triggerPrompt": {
                    "type": "string",
                    "description": "When to trigger this action during the call",
                    "example": "When the caller asks to speak to a manager"
                  },
                  "transferToType": {
                    "type": "string",
                    "description": "Type of transfer destination (currently only \"number\" is supported)",
                    "enum": [
                      "number"
                    ],
                    "example": "number"
                  },
                  "transferToValue": {
                    "type": "string",
                    "description": "Phone number to transfer to. Must start with +, include country code, contain only numbers, and be 11-16 characters long (e.g., +12345678901).",
                    "example": "+12345678901"
                  },
                  "triggerMessage": {
                    "type": "string",
                    "description": "Message to tell the caller before transferring",
                    "example": "Let me transfer you to a manager right away"
                  },
                  "hearWhisperMessage": {
                    "type": "boolean",
                    "description": "Whether to play whisper message to the receiving party",
                    "example": true
                  }
                },
                "required": [
                  "triggerPrompt",
                  "transferToType",
                  "transferToValue",
                  "triggerMessage"
                ],
                "title": "CallTransferActionParameters"
              },
              {
                "type": "object",
                "properties": {
                  "contactFieldId": {
                    "type": "string",
                    "description": "ID of the contact field to be updated with the extracted data",
                    "example": "507f1f77bcf86cd799439011"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of what data to extract",
                    "example": "Caller's phone number"
                  },
                  "examples": {
                    "description": "Example values to help Agent understand the expected format. At least one example is required, maximum 5 examples allowed.",
                    "example": [
                      "+1234567890",
                      "+9876543210"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "overwriteExistingValue": {
                    "type": "boolean",
                    "description": "Whether to overwrite existing field value if already set, default is false",
                    "example": false,
                    "default": false
                  }
                },
                "required": [
                  "contactFieldId",
                  "description",
                  "examples"
                ],
                "title": "DataExtractionActionParameters"
              },
              {
                "type": "object",
                "properties": {
                  "contactFieldId": {
                    "type": "string",
                    "description": "ID of the contact field to be updated with the extracted data",
                    "example": "507f1f77bcf86cd799439011"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of what data to extract",
                    "example": "Caller's phone number"
                  },
                  "examples": {
                    "description": "Example values to help Agent understand the expected format. At least one example is required, maximum 5 examples allowed.",
                    "example": [
                      "+1234567890",
                      "+9876543210"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "overwriteExistingValue": {
                    "type": "boolean",
                    "description": "Whether to overwrite existing field value if already set, default is false",
                    "example": false,
                    "default": false
                  }
                },
                "required": [
                  "contactFieldId",
                  "description",
                  "examples"
                ],
                "title": "InCallDataExtractionActionParameters"
              },
              {
                "type": "object",
                "properties": {
                  "triggerPrompt": {
                    "type": "string",
                    "description": "When to trigger this workflow",
                    "example": "When caller requests a quote"
                  },
                  "triggerMessage": {
                    "type": "string",
                    "description": "Message to tell the caller",
                    "example": "Let me start that process for you"
                  },
                  "workflowId": {
                    "type": "string",
                    "description": "Workflow ID to trigger",
                    "example": "507f1f77bcf86cd799439011"
                  }
                },
                "required": [
                  "triggerPrompt",
                  "triggerMessage",
                  "workflowId"
                ],
                "title": "WorkflowTriggerParameters"
              },
              {
                "type": "object",
                "properties": {
                  "triggerPrompt": {
                    "type": "string",
                    "description": "When to send the SMS",
                    "example": "When caller asks for booking confirmation"
                  },
                  "triggerMessage": {
                    "type": "string",
                    "description": "Message to tell the caller",
                    "example": "I'll send you a confirmation text"
                  },
                  "messageBody": {
                    "type": "string",
                    "description": "SMS message content to send",
                    "example": "Your appointment is confirmed for tomorrow at 2 PM"
                  }
                },
                "required": [
                  "triggerPrompt",
                  "triggerMessage",
                  "messageBody"
                ],
                "title": "SMSParameters"
              },
              {
                "type": "object",
                "properties": {
                  "calendarId": {
                    "type": "string",
                    "description": "Calendar ID to book appointments in",
                    "example": "507f1f77bcf86cd799439011"
                  },
                  "daysOfOfferingDates": {
                    "type": "number",
                    "description": "Number of days ahead to offer booking dates",
                    "example": 3
                  },
                  "slotsPerDay": {
                    "type": "number",
                    "description": "Number of available slots per day",
                    "example": 3
                  },
                  "hoursBetweenSlots": {
                    "type": "number",
                    "description": "Hours between available slots",
                    "example": 1
                  }
                },
                "required": [
                  "calendarId",
                  "daysOfOfferingDates",
                  "slotsPerDay",
                  "hoursBetweenSlots"
                ],
                "title": "AppointmentBookingActionParameters"
              },
              {
                "type": "object",
                "properties": {
                  "triggerPrompt": {
                    "type": "string",
                    "description": "When to call the custom API",
                    "example": "When caller provides order number"
                  },
                  "triggerMessage": {
                    "type": "string",
                    "description": "Message to tell the caller",
                    "example": "Let me check that order status"
                  },
                  "apiDetails": {
                    "description": "API endpoint configuration",
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "description": "API endpoint URL",
                            "example": "https://api.example.com/orders"
                          },
                          "method": {
                            "type": "string",
                            "description": "HTTP method",
                            "example": "GET",
                            "enum": [
                              "POST",
                              "GET"
                            ]
                          },
                          "authenticationRequired": {
                            "type": "boolean",
                            "description": "Whether authentication is required",
                            "example": true
                          },
                          "authenticationValue": {
                            "type": "string",
                            "description": "Authentication token or API key (required if authenticationRequired is true)",
                            "example": "token123"
                          },
                          "headers": {
                            "description": "HTTP headers to include",
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "description": "HTTP header name",
                                  "example": "id"
                                },
                                "value": {
                                  "type": "string",
                                  "description": "HTTP header value",
                                  "example": "1234567890"
                                }
                              },
                              "required": [
                                "key",
                                "value"
                              ],
                              "title": "CustomActionHeaderDTO"
                            }
                          },
                          "parameters": {
                            "description": "API parameters to send",
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "description": "Parameter name",
                                  "example": "orderId"
                                },
                                "description": {
                                  "type": "string",
                                  "description": "Parameter description",
                                  "example": "Order ID to look up"
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Parameter type",
                                  "example": "string"
                                },
                                "example": {
                                  "type": "string",
                                  "description": "Example parameter value",
                                  "example": "ORD-12345"
                                }
                              },
                              "required": [
                                "name"
                              ],
                              "title": "CustomActionParameterDTO"
                            }
                          }
                        },
                        "required": [
                          "url",
                          "method"
                        ],
                        "title": "CustomActionApiDetailsDTO"
                      }
                    ]
                  },
                  "selectedPaths": {
                    "description": "Selected response paths to extract from API response. Required: at least 1 value if the method is GET. Should be empty if the method is POST.",
                    "example": [
                      "data.orderId",
                      "status"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "triggerPrompt",
                  "triggerMessage",
                  "apiDetails"
                ],
                "title": "CustomActionParameters"
              },
              {
                "type": "object",
                "properties": {
                  "triggerPrompt": {
                    "type": "string",
                    "description": "When to query the knowledge base",
                    "example": "When caller asks about pricing"
                  },
                  "knowledgeBaseId": {
                    "type": "string",
                    "description": "Knowledge base ID to query",
                    "example": "507f1f77bcf86cd799439011"
                  }
                },
                "required": [
                  "triggerPrompt",
                  "knowledgeBaseId"
                ],
                "title": "KnowledgeBaseParameters"
              }
            ],
            "examples": {
              "callTransfer": {
                "summary": "Call Transfer Action",
                "value": {
                  "transferToType": "number",
                  "transferToValue": "+12345678901",
                  "triggerMessage": "Let me transfer you to a manager right away",
                  "hearWhisperMessage": true
                }
              },
              "dataExtraction": {
                "summary": "Data Extraction Action",
                "value": {
                  "contactFieldId": "507f1f77bcf86cd799439011",
                  "description": "Caller's phone number",
                  "examples": [
                    "+1234567890",
                    "+9876543210"
                  ],
                  "overwriteExistingValue": false
                }
              },
              "workflowTrigger": {
                "summary": "Workflow Trigger Action",
                "value": {
                  "triggerPrompt": "When caller requests a quote",
                  "triggerMessage": "Let me start that process for you",
                  "workflowId": "507f1f77bcf86cd799439011"
                }
              },
              "sms": {
                "summary": "SMS Action",
                "value": {
                  "triggerPrompt": "When caller asks for booking confirmation",
                  "triggerMessage": "I'll send you a confirmation text",
                  "messageBody": "Your appointment is confirmed for tomorrow at 2 PM"
                }
              },
              "appointmentBooking": {
                "summary": "Appointment Booking Action",
                "value": {
                  "calendarId": "507f1f77bcf86cd799439011",
                  "daysOfOfferingDates": 3,
                  "slotsPerDay": 3,
                  "hoursBetweenSlots": 1
                }
              },
              "customAction": {
                "summary": "Custom Action",
                "value": {
                  "triggerPrompt": "When caller provides order number",
                  "triggerMessage": "Let me check that order status",
                  "apiDetails": {
                    "url": "https://api.example.com/orders",
                    "method": "GET",
                    "authenticationRequired": true,
                    "authenticationValue": "token123",
                    "headers": [
                      {
                        "key": "Content-Type",
                        "value": "application/json"
                      }
                    ],
                    "parameters": [
                      {
                        "name": "orderId",
                        "description": "Order ID to look up",
                        "type": "string",
                        "example": "ORD-12345"
                      }
                    ]
                  },
                  "responsePathsToExtract": [
                    "data.orderId",
                    "status"
                  ]
                }
              },
              "knowledgeBase": {
                "summary": "Knowledge Base Action",
                "value": {
                  "triggerPrompt": "When caller asks about pricing",
                  "knowledgeBaseId": "507f1f77bcf86cd799439011"
                }
              }
            }
          }
        },
        "required": [
          "agentId",
          "locationId",
          "actionType",
          "name",
          "actionParameters"
        ],
        "title": "CreateSingleActionDTO"
      },
      "CreateActionResponseDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the created action",
            "example": "507f1f77bcf86cd799439011"
          },
          "actionType": {
            "type": "string",
            "description": "Type of action",
            "enum": [
              "CALL_TRANSFER",
              "DATA_EXTRACTION",
              "IN_CALL_DATA_EXTRACTION",
              "WORKFLOW_TRIGGER",
              "SMS",
              "APPOINTMENT_BOOKING",
              "CUSTOM_ACTION",
              "KNOWLEDGE_BASE"
            ],
            "example": "CALL_TRANSFER"
          },
          "name": {
            "type": "string",
            "description": "Human-readable name for this action",
            "example": "Transfer to Manager"
          },
          "actionParameters": {
            "description": "Action parameters - structure varies by actionType",
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "triggerPrompt": {
                    "type": "string",
                    "description": "When to trigger this action during the call",
                    "example": "When the caller asks to speak to a manager"
                  },
                  "transferToType": {
                    "type": "string",
                    "description": "Type of transfer destination (currently only \"number\" is supported)",
                    "enum": [
                      "number"
                    ],
                    "example": "number"
                  },
                  "transferToValue": {
                    "type": "string",
                    "description": "Phone number to transfer to. Must start with +, include country code, contain only numbers, and be 11-16 characters long (e.g., +12345678901).",
                    "example": "+12345678901"
                  },
                  "triggerMessage": {
                    "type": "string",
                    "description": "Message to tell the caller before transferring",
                    "example": "Let me transfer you to a manager right away"
                  },
                  "hearWhisperMessage": {
                    "type": "boolean",
                    "description": "Whether to play whisper message to the receiving party",
                    "example": true
                  }
                },
                "required": [
                  "triggerPrompt",
                  "transferToType",
                  "transferToValue",
                  "triggerMessage"
                ],
                "title": "CallTransferActionParameters"
              },
              {
                "type": "object",
                "properties": {
                  "contactFieldId": {
                    "type": "string",
                    "description": "ID of the contact field to be updated with the extracted data",
                    "example": "507f1f77bcf86cd799439011"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of what data to extract",
                    "example": "Caller's phone number"
                  },
                  "examples": {
                    "description": "Example values to help Agent understand the expected format. At least one example is required, maximum 5 examples allowed.",
                    "example": [
                      "+1234567890",
                      "+9876543210"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "overwriteExistingValue": {
                    "type": "boolean",
                    "description": "Whether to overwrite existing field value if already set, default is false",
                    "example": false,
                    "default": false
                  }
                },
                "required": [
                  "contactFieldId",
                  "description",
                  "examples"
                ],
                "title": "DataExtractionActionParameters"
              },
              {
                "type": "object",
                "properties": {
                  "contactFieldId": {
                    "type": "string",
                    "description": "ID of the contact field to be updated with the extracted data",
                    "example": "507f1f77bcf86cd799439011"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of what data to extract",
                    "example": "Caller's phone number"
                  },
                  "examples": {
                    "description": "Example values to help Agent understand the expected format. At least one example is required, maximum 5 examples allowed.",
                    "example": [
                      "+1234567890",
                      "+9876543210"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "overwriteExistingValue": {
                    "type": "boolean",
                    "description": "Whether to overwrite existing field value if already set, default is false",
                    "example": false,
                    "default": false
                  }
                },
                "required": [
                  "contactFieldId",
                  "description",
                  "examples"
                ],
                "title": "InCallDataExtractionActionParameters"
              },
              {
                "type": "object",
                "properties": {
                  "triggerPrompt": {
                    "type": "string",
                    "description": "When to trigger this workflow",
                    "example": "When caller requests a quote"
                  },
                  "triggerMessage": {
                    "type": "string",
                    "description": "Message to tell the caller",
                    "example": "Let me start that process for you"
                  },
                  "workflowId": {
                    "type": "string",
                    "description": "Workflow ID to trigger",
                    "example": "507f1f77bcf86cd799439011"
                  }
                },
                "required": [
                  "triggerPrompt",
                  "triggerMessage",
                  "workflowId"
                ],
                "title": "WorkflowTriggerParameters"
              },
              {
                "type": "object",
                "properties": {
                  "triggerPrompt": {
                    "type": "string",
                    "description": "When to send the SMS",
                    "example": "When caller asks for booking confirmation"
                  },
                  "triggerMessage": {
                    "type": "string",
                    "description": "Message to tell the caller",
                    "example": "I'll send you a confirmation text"
                  },
                  "messageBody": {
                    "type": "string",
                    "description": "SMS message content to send",
                    "example": "Your appointment is confirmed for tomorrow at 2 PM"
                  }
                },
                "required": [
                  "triggerPrompt",
                  "triggerMessage",
                  "messageBody"
                ],
                "title": "SMSParameters"
              },
              {
                "type": "object",
                "properties": {
                  "calendarId": {
                    "type": "string",
                    "description": "Calendar ID to book appointments in",
                    "example": "507f1f77bcf86cd799439011"
                  },
                  "daysOfOfferingDates": {
                    "type": "number",
                    "description": "Number of days ahead to offer booking dates",
                    "example": 3
                  },
                  "slotsPerDay": {
                    "type": "number",
                    "description": "Number of available slots per day",
                    "example": 3
                  },
                  "hoursBetweenSlots": {
                    "type": "number",
                    "description": "Hours between available slots",
                    "example": 1
                  }
                },
                "required": [
                  "calendarId",
                  "daysOfOfferingDates",
                  "slotsPerDay",
                  "hoursBetweenSlots"
                ],
                "title": "AppointmentBookingActionParameters"
              },
              {
                "type": "object",
                "properties": {
                  "triggerPrompt": {
                    "type": "string",
                    "description": "When to call the custom API",
                    "example": "When caller provides order number"
                  },
                  "triggerMessage": {
                    "type": "string",
                    "description": "Message to tell the caller",
                    "example": "Let me check that order status"
                  },
                  "apiDetails": {
                    "description": "API endpoint configuration",
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "description": "API endpoint URL",
                            "example": "https://api.example.com/orders"
                          },
                          "method": {
                            "type": "string",
                            "description": "HTTP method",
                            "example": "GET",
                            "enum": [
                              "POST",
                              "GET"
                            ]
                          },
                          "authenticationRequired": {
                            "type": "boolean",
                            "description": "Whether authentication is required",
                            "example": true
                          },
                          "authenticationValue": {
                            "type": "string",
                            "description": "Authentication token or API key (required if authenticationRequired is true)",
                            "example": "token123"
                          },
                          "headers": {
                            "description": "HTTP headers to include",
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "description": "HTTP header name",
                                  "example": "id"
                                },
                                "value": {
                                  "type": "string",
                                  "description": "HTTP header value",
                                  "example": "1234567890"
                                }
                              },
                              "required": [
                                "key",
                                "value"
                              ],
                              "title": "CustomActionHeaderDTO"
                            }
                          },
                          "parameters": {
                            "description": "API parameters to send",
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "description": "Parameter name",
                                  "example": "orderId"
                                },
                                "description": {
                                  "type": "string",
                                  "description": "Parameter description",
                                  "example": "Order ID to look up"
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Parameter type",
                                  "example": "string"
                                },
                                "example": {
                                  "type": "string",
                                  "description": "Example parameter value",
                                  "example": "ORD-12345"
                                }
                              },
                              "required": [
                                "name"
                              ],
                              "title": "CustomActionParameterDTO"
                            }
                          }
                        },
                        "required": [
                          "url",
                          "method"
                        ],
                        "title": "CustomActionApiDetailsDTO"
                      }
                    ]
                  },
                  "selectedPaths": {
                    "description": "Selected response paths to extract from API response. Required: at least 1 value if the method is GET. Should be empty if the method is POST.",
                    "example": [
                      "data.orderId",
                      "status"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "triggerPrompt",
                  "triggerMessage",
                  "apiDetails"
                ],
                "title": "CustomActionParameters"
              },
              {
                "type": "object",
                "properties": {
                  "triggerPrompt": {
                    "type": "string",
                    "description": "When to query the knowledge base",
                    "example": "When caller asks about pricing"
                  },
                  "knowledgeBaseId": {
                    "type": "string",
                    "description": "Knowledge base ID to query",
                    "example": "507f1f77bcf86cd799439011"
                  }
                },
                "required": [
                  "triggerPrompt",
                  "knowledgeBaseId"
                ],
                "title": "KnowledgeBaseParameters"
              }
            ],
            "examples": {
              "callTransfer": {
                "summary": "Call Transfer Action Parameters",
                "value": {
                  "transferToType": "number",
                  "transferToValue": "+12345678901",
                  "triggerMessage": "Let me transfer you to a manager right away",
                  "hearWhisperMessage": true
                }
              },
              "dataExtraction": {
                "summary": "Data Extraction Action Parameters",
                "value": {
                  "contactFieldId": "507f1f77bcf86cd799439011",
                  "description": "Caller's phone number",
                  "examples": [
                    "+1234567890",
                    "+9876543210"
                  ],
                  "overwriteExistingValue": false
                }
              },
              "workflowTrigger": {
                "summary": "Workflow Trigger Action Parameters",
                "value": {
                  "triggerPrompt": "When caller requests a quote",
                  "triggerMessage": "Let me start that process for you",
                  "workflowId": "507f1f77bcf86cd799439011"
                }
              }
            }
          }
        },
        "required": [
          "id",
          "actionType",
          "name",
          "actionParameters"
        ],
        "title": "CreateActionResponseDTO"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/voice-ai/actions' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "agentId": "507f1f77bcf86cd799439011",
  "locationId": "507f1f77bcf86cd799439012",
  "actionType": "CALL_TRANSFER",
  "name": "Transfer to Manager",
  "actionParameters": {
    "triggerPrompt": "When caller asks about pricing",
    "transferToType": "number",
    "transferToValue": "+12345678901",
    "triggerMessage": "Let me check that order status",
    "hearWhisperMessage": true,
    "contactFieldId": "507f1f77bcf86cd799439011",
    "description": "Caller's phone number",
    "examples": [
      "+1234567890",
      "+9876543210"
    ],
    "overwriteExistingValue": false,
    "workflowId": "507f1f77bcf86cd799439011",
    "messageBody": "Your appointment is confirmed for tomorrow at 2 PM",
    "calendarId": "507f1f77bcf86cd799439011",
    "daysOfOfferingDates": 3,
    "slotsPerDay": 3,
    "hoursBetweenSlots": 1,
    "apiDetails": {
      "url": "https://api.example.com/orders",
      "method": "GET",
      "authenticationRequired": true,
      "authenticationValue": "token123",
      "headers": [
        {
          "key": "id",
          "value": "1234567890"
        }
      ],
      "parameters": [
        {
          "name": "orderId",
          "description": "Order ID to look up",
          "type": "string",
          "example": "ORD-12345"
        }
      ]
    },
    "selectedPaths": [
      "data.orderId",
      "status"
    ],
    "knowledgeBaseId": "507f1f77bcf86cd799439011"
  }
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "agentId": "507f1f77bcf86cd799439011",
      "locationId": "507f1f77bcf86cd799439012",
      "actionType": "CALL_TRANSFER",
      "name": "Transfer to Manager",
      "actionParameters": {
        "triggerPrompt": "When caller asks about pricing",
        "transferToType": "number",
        "transferToValue": "+12345678901",
        "triggerMessage": "Let me check that order status",
        "hearWhisperMessage": true,
        "contactFieldId": "507f1f77bcf86cd799439011",
        "description": "Caller's phone number",
        "examples": [
          "+1234567890",
          "+9876543210"
        ],
        "overwriteExistingValue": false,
        "workflowId": "507f1f77bcf86cd799439011",
        "messageBody": "Your appointment is confirmed for tomorrow at 2 PM",
        "calendarId": "507f1f77bcf86cd799439011",
        "daysOfOfferingDates": 3,
        "slotsPerDay": 3,
        "hoursBetweenSlots": 1,
        "apiDetails": {
          "url": "https://api.example.com/orders",
          "method": "GET",
          "authenticationRequired": true,
          "authenticationValue": "token123",
          "headers": [
            {
              "key": "id",
              "value": "1234567890"
            }
          ],
          "parameters": [
            {
              "name": "orderId",
              "description": "Order ID to look up",
              "type": "string",
              "example": "ORD-12345"
            }
          ]
        },
        "selectedPaths": [
          "data.orderId",
          "status"
        ],
        "knowledgeBaseId": "507f1f77bcf86cd799439011"
      }
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/voice-ai/actions', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/voice-ai/actions"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

payload = {
    "agentId": "507f1f77bcf86cd799439011",
    "locationId": "507f1f77bcf86cd799439012",
    "actionType": "CALL_TRANSFER",
    "name": "Transfer to Manager",
    "actionParameters": {
        "triggerPrompt": "When caller asks about pricing",
        "transferToType": "number",
        "transferToValue": "+12345678901",
        "triggerMessage": "Let me check that order status",
        "hearWhisperMessage": true,
        "contactFieldId": "507f1f77bcf86cd799439011",
        "description": "Caller's phone number",
        "examples": [
            "+1234567890",
            "+9876543210"
        ],
        "overwriteExistingValue": false,
        "workflowId": "507f1f77bcf86cd799439011",
        "messageBody": "Your appointment is confirmed for tomorrow at 2 PM",
        "calendarId": "507f1f77bcf86cd799439011",
        "daysOfOfferingDates": 3,
        "slotsPerDay": 3,
        "hoursBetweenSlots": 1,
        "apiDetails": {
            "url": "https://api.example.com/orders",
            "method": "GET",
            "authenticationRequired": true,
            "authenticationValue": "token123",
            "headers": [
                {
                    "key": "id",
                    "value": "1234567890"
                }
            ],
            "parameters": [
                {
                    "name": "orderId",
                    "description": "Order ID to look up",
                    "type": "string",
                    "example": "ORD-12345"
                }
            ]
        },
        "selectedPaths": [
            "data.orderId",
            "status"
        ],
        "knowledgeBaseId": "507f1f77bcf86cd799439011"
    }
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/voice-ai/actions',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "agentId": "507f1f77bcf86cd799439011",
  "locationId": "507f1f77bcf86cd799439012",
  "actionType": "CALL_TRANSFER",
  "name": "Transfer to Manager",
  "actionParameters": {
    "triggerPrompt": "When caller asks about pricing",
    "transferToType": "number",
    "transferToValue": "+12345678901",
    "triggerMessage": "Let me check that order status",
    "hearWhisperMessage": true,
    "contactFieldId": "507f1f77bcf86cd799439011",
    "description": "Caller's phone number",
    "examples": [
      "+1234567890",
      "+9876543210"
    ],
    "overwriteExistingValue": false,
    "workflowId": "507f1f77bcf86cd799439011",
    "messageBody": "Your appointment is confirmed for tomorrow at 2 PM",
    "calendarId": "507f1f77bcf86cd799439011",
    "daysOfOfferingDates": 3,
    "slotsPerDay": 3,
    "hoursBetweenSlots": 1,
    "apiDetails": {
      "url": "https://api.example.com/orders",
      "method": "GET",
      "authenticationRequired": true,
      "authenticationValue": "token123",
      "headers": [
        {
          "key": "id",
          "value": "1234567890"
        }
      ],
      "parameters": [
        {
          "name": "orderId",
          "description": "Order ID to look up",
          "type": "string",
          "example": "ORD-12345"
        }
      ]
    },
    "selectedPaths": [
      "data.orderId",
      "status"
    ],
    "knowledgeBaseId": "507f1f77bcf86cd799439011"
  }
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/voice-ai/actions")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"agentId\":\"507f1f77bcf86cd799439011\",\"locationId\":\"507f1f77bcf86cd799439012\",\"actionType\":\"CALL_TRANSFER\",\"name\":\"Transfer to Manager\",\"actionParameters\":{\"triggerPrompt\":\"When caller asks about pricing\",\"transferToType\":\"number\",\"transferToValue\":\"+12345678901\",\"triggerMessage\":\"Let me check that order status\",\"hearWhisperMessage\":true,\"contactFieldId\":\"507f1f77bcf86cd799439011\",\"description\":\"Caller's phone number\",\"examples\":[\"+1234567890\",\"+9876543210\"],\"overwriteExistingValue\":false,\"workflowId\":\"507f1f77bcf86cd799439011\",\"messageBody\":\"Your appointment is confirmed for tomorrow at 2 PM\",\"calendarId\":\"507f1f77bcf86cd799439011\",\"daysOfOfferingDates\":3,\"slotsPerDay\":3,\"hoursBetweenSlots\":1,\"apiDetails\":{\"url\":\"https://api.example.com/orders\",\"method\":\"GET\",\"authenticationRequired\":true,\"authenticationValue\":\"token123\",\"headers\":[{\"key\":\"id\",\"value\":\"1234567890\"}],\"parameters\":[{\"name\":\"orderId\",\"description\":\"Order ID to look up\",\"type\":\"string\",\"example\":\"ORD-12345\"}]},\"selectedPaths\":[\"data.orderId\",\"status\"],\"knowledgeBaseId\":\"507f1f77bcf86cd799439011\"}}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/voice-ai/actions"
  payload := strings.NewReader(`{
  "agentId": "507f1f77bcf86cd799439011",
  "locationId": "507f1f77bcf86cd799439012",
  "actionType": "CALL_TRANSFER",
  "name": "Transfer to Manager",
  "actionParameters": {
    "triggerPrompt": "When caller asks about pricing",
    "transferToType": "number",
    "transferToValue": "+12345678901",
    "triggerMessage": "Let me check that order status",
    "hearWhisperMessage": true,
    "contactFieldId": "507f1f77bcf86cd799439011",
    "description": "Caller's phone number",
    "examples": [
      "+1234567890",
      "+9876543210"
    ],
    "overwriteExistingValue": false,
    "workflowId": "507f1f77bcf86cd799439011",
    "messageBody": "Your appointment is confirmed for tomorrow at 2 PM",
    "calendarId": "507f1f77bcf86cd799439011",
    "daysOfOfferingDates": 3,
    "slotsPerDay": 3,
    "hoursBetweenSlots": 1,
    "apiDetails": {
      "url": "https://api.example.com/orders",
      "method": "GET",
      "authenticationRequired": true,
      "authenticationValue": "token123",
      "headers": [
        {
          "key": "id",
          "value": "1234567890"
        }
      ],
      "parameters": [
        {
          "name": "orderId",
          "description": "Order ID to look up",
          "type": "string",
          "example": "ORD-12345"
        }
      ]
    },
    "selectedPaths": [
      "data.orderId",
      "status"
    ],
    "knowledgeBaseId": "507f1f77bcf86cd799439011"
  }
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/voice-ai/actions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "agentId": "507f1f77bcf86cd799439011",
  "locationId": "507f1f77bcf86cd799439012",
  "actionType": "CALL_TRANSFER",
  "name": "Transfer to Manager",
  "actionParameters": {
    "triggerPrompt": "When caller asks about pricing",
    "transferToType": "number",
    "transferToValue": "+12345678901",
    "triggerMessage": "Let me check that order status",
    "hearWhisperMessage": true,
    "contactFieldId": "507f1f77bcf86cd799439011",
    "description": "Caller's phone number",
    "examples": [
      "+1234567890",
      "+9876543210"
    ],
    "overwriteExistingValue": false,
    "workflowId": "507f1f77bcf86cd799439011",
    "messageBody": "Your appointment is confirmed for tomorrow at 2 PM",
    "calendarId": "507f1f77bcf86cd799439011",
    "daysOfOfferingDates": 3,
    "slotsPerDay": 3,
    "hoursBetweenSlots": 1,
    "apiDetails": {
      "url": "https://api.example.com/orders",
      "method": "GET",
      "authenticationRequired": true,
      "authenticationValue": "token123",
      "headers": [
        {
          "key": "id",
          "value": "1234567890"
        }
      ],
      "parameters": [
        {
          "name": "orderId",
          "description": "Order ID to look up",
          "type": "string",
          "example": "ORD-12345"
        }
      ]
    },
    "selectedPaths": [
      "data.orderId",
      "status"
    ],
    "knowledgeBaseId": "507f1f77bcf86cd799439011"
  }
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$body = '{
  "agentId": "507f1f77bcf86cd799439011",
  "locationId": "507f1f77bcf86cd799439012",
  "actionType": "CALL_TRANSFER",
  "name": "Transfer to Manager",
  "actionParameters": {
    "triggerPrompt": "When caller asks about pricing",
    "transferToType": "number",
    "transferToValue": "+12345678901",
    "triggerMessage": "Let me check that order status",
    "hearWhisperMessage": true,
    "contactFieldId": "507f1f77bcf86cd799439011",
    "description": "Caller's phone number",
    "examples": [
      "+1234567890",
      "+9876543210"
    ],
    "overwriteExistingValue": false,
    "workflowId": "507f1f77bcf86cd799439011",
    "messageBody": "Your appointment is confirmed for tomorrow at 2 PM",
    "calendarId": "507f1f77bcf86cd799439011",
    "daysOfOfferingDates": 3,
    "slotsPerDay": 3,
    "hoursBetweenSlots": 1,
    "apiDetails": {
      "url": "https://api.example.com/orders",
      "method": "GET",
      "authenticationRequired": true,
      "authenticationValue": "token123",
      "headers": [
        {
          "key": "id",
          "value": "1234567890"
        }
      ],
      "parameters": [
        {
          "name": "orderId",
          "description": "Order ID to look up",
          "type": "string",
          "example": "ORD-12345"
        }
      ]
    },
    "selectedPaths": [
      "data.orderId",
      "status"
    ],
    "knowledgeBaseId": "507f1f77bcf86cd799439011"
  }
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/voice-ai/actions' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
