Free setup on annual plans

Sign up today!

API Reference: Actions endpoints

The Actions API manages reusable automation actions in AnswerPal. The current implementation separates action definitions from execution rules: /api/Actions manages the action itself, /api/TopicActions links actions to topics, and /api/HookActions links actions to workflow events.

Overview

Actions can close or delete messages, mark spam, generate or send replies, call external APIs, forward conversations, wait, run topic detection, or expose function-tool style configuration. The action record contains the execution configuration; priority and trigger context are stored on the topic or hook link.

Authentication

Use Authorization: Bearer <token> for protected endpoints. /api/Actions create, update, list and delete operations require the ManageSettings policy. GET /api/Actions/available accepts ticket access or phone-auth context. Topic and hook action endpoints require an authenticated user.

Current endpoints

Action definitions

Use these endpoints to manage the reusable action records for the authenticated customer.

MethodPathPolicyPurpose
GET/api/ActionsManageSettingsReturn a paginated list of action definitions.
POST/api/ActionsManageSettingsCreate a new action definition.
GET/api/Actions/availableTicketAccessOrPhoneAuthReturn active actions available in ticket or phone-auth contexts.
GET/api/Actions/{id}ManageSettingsReturn one action definition.
PUT/api/Actions/{id}ManageSettingsUpdate an action definition. The body actionID must match the route id.
DELETE/api/Actions/{id}ManageSettingsDelete an action definition.

GET /api/Actions

Returns a paginated PaginatedResult<ActionReadDTO> for the authenticated customer.

Query parameters: pageNumber default 1, pageSize default 10, sortBy default Name, sortOrder default asc.

GET /api/Actions?pageNumber=1&pageSize=10&sortBy=Name&sortOrder=asc
Authorization: Bearer <token>

GET /api/Actions/available

Returns ActionAvailableDTO records for actions that can be used from ticket or phone-auth flows.

GET /api/Actions/available
Authorization: Bearer <token>

Available action response shape

[
  {
    "actionID": 14,
    "customerID": 8,
    "name": "Send reply",
    "description": "Generate and send an answer",
    "actionType": "ReplySend",
    "isActive": true
  }
]

POST /api/Actions

Creates a new ActionCreateDTO. name is required; other fields depend on the selected actionType.

POST /api/Actions
Authorization: Bearer <token>
Content-Type: application/json

{
  "name": "Call CRM",
  "description": "Update the customer record",
  "actionType": "ApiCall",
  "apiEndpoint": "/customers/{{endUser.customerNumber}}",
  "apiMethod": "PUT",
  "apiHeaders": "{\"Content-Type\":\"application/json\"}",
  "apiBodyTemplate": "{\"status\":\"{{ticket.status}}\"}",
  "overrideApiAuthenticationType": "Bearer",
  "isActive": true,
  "isFunctionTool": false,
  "toolCallTimeoutSeconds": 30
}

PUT /api/Actions/{id}

Updates an ActionUpdateDTO. The body actionID must match the route id.

PUT /api/Actions/14
Authorization: Bearer <token>
Content-Type: application/json

{
  "actionID": 14,
  "name": "Call CRM",
  "description": "Update the customer record",
  "actionType": "ApiCall",
  "apiMethod": "PUT",
  "isActive": true
}

A successful update returns 204 No Content.

GET /api/Actions/{id}

Returns one ActionReadDTO, including actionID, customerID and any related customFieldDefinitions.

GET /api/Actions/14
Authorization: Bearer <token>

DELETE /api/Actions/{id}

Deletes the action definition for the current customer.

DELETE /api/Actions/14
Authorization: Bearer <token>

A successful delete returns 204 No Content; an unknown id returns 404 Not Found.

TopicActions

TopicActions link an action to a topic, channel or special topic context. This is where execution priority is stored.

MethodPathPurpose
GET/api/TopicActionsList links. Filters include topicId, actionId, hookName, channelId, isActive, pagination and sorting.
POST/api/TopicActionsCreate one topic-action link.
POST/api/TopicActions/bulkCreate multiple links.
GET/api/TopicActions/{id}Read one link.
PUT/api/TopicActions/{id}Update the priority only.
DELETE/api/TopicActions/{id}Delete one link.

Create body

{
  "topicID": 21,
  "specialTopic": null,
  "documentID": 0,
  "channelID": 3,
  "specialChannel": null,
  "actionID": 14,
  "priority": 100
}

HookActions

HookActions link actions to workflow events such as spam checks, topic detection, escalation, close events and phone pickup flows.

MethodPathPurpose
GET/api/HookActionsList hook actions. At least hookName or actionId is required.
POST/api/HookActionsCreate one hook-action link.
POST/api/HookActions/bulkCreate multiple hook-action links.
GET/api/HookActions/wait-secondsReturn the total active wait time for a channel and hook.
GET/api/HookActions/{id}Read one hook-action link.
PUT/api/HookActions/{id}Update the priority only.
DELETE/api/HookActions/{id}Delete one hook-action link.

Current hook names: PreSpam, PostSpam, PostTopicDetection, OnEscalate, OnClose, OnEndUserUpdate, OnEndUserAdd, OnEndUserDelete, UserTriggered, PostEscalate, OnEscalateFailed, OnPhonePickup, OnPhonePickupSay.

Wait-seconds example

GET /api/HookActions/wait-seconds?channelId=3&hookName=PostTopicDetection
Authorization: Bearer <token>

{
  "totalWaitSeconds": 45
}

Fields by purpose

These are the fields currently exposed by ActionCreateDTO, ActionUpdateDTO and ActionReadDTO. priority is intentionally not listed here: execution priority belongs to TopicActions or HookActions.

Core action definition

FieldTypeUse
namestring, requiredDisplay name, maximum 100 characters.
descriptionstringShort optional description, maximum 100 characters.
actionTypestringExecution behavior, for example ApiCall, Reply, ReplySend, Send, Forward, Close, Delete, Spam, DetectTopics or Wait.
isActivebooleanControls whether the action can run.

Outbound API-call configuration

FieldTypeUse
apiEndpointstringEndpoint or path AnswerPal calls when actionType is API-call based.
apiMethodstringHTTP method for the outbound call, such as GET, POST, PUT or DELETE.
apiHeadersJSON stringAdditional outbound request headers.
apiBodyTemplatestringRequest body template with placeholders.
fieldMappingJSON stringMaps AnswerPal fields to external API fields.
responseFieldMappingJSON stringMaps external API response values back into AnswerPal context.

Outbound authentication overrides

FieldTypeUse
overrideApiBaseUrlstringOverrides the customer default base URL for this action.
overrideApiUsernamestringUsername for an outbound connector call.
overrideApiPasswordstringPassword for an outbound connector call.
overrideApiTokenstringToken for an outbound connector call.
overrideApiAuthenticationTypestringOutbound connector auth type. This does not change inbound AnswerPal API auth, which remains JWT Bearer.

Runtime controls

FieldTypeUse
conditionalRulesstringRules that determine whether the action should run.
forwardRecipientsstringEmail recipients for forward-style actions.
forwardPhoneNumberstringPhone number for phone forward-style actions.
waitSecondsintegerDelay used by Wait actions.
actionSchedulestringSchedule expression or schedule setting for time-limited execution.
actionScheduleTimeZoneIdstringTimezone id, normalized by the API against the current user timezone.

Function-tool configuration

FieldTypeUse
isFunctionToolbooleanExposes the action as a callable tool when enabled.
functionParametersSchemaJSON schema stringParameters schema for tool-call usage.
toolCallTimeoutSecondsintegerMaximum time to wait for a function-tool call.

Response-only fields

FieldTypeUse
actionIDintegerAction identifier. Required in PUT /api/Actions/{id} and must match the route id.
customerIDintegerOwning customer, set by the API from the authenticated context.
customFieldDefinitionsarrayIncluded on ActionReadDTO when custom field definitions are attached.

Error Codes

  • 200 OK: list, read and available-action requests succeeded.
  • 201 Created: action, topic-action or hook-action created.
  • 204 No Content: update or delete succeeded.
  • 400 Bad Request: invalid input, ID mismatch, invalid priority id, or missing hookName/actionId filter for GET /api/HookActions.
  • 401 Unauthorized: missing or invalid JWT Bearer token.
  • 403 Forbidden: authenticated user lacks the required policy or role.
  • 404 Not Found: action or link does not exist for the current customer.
  • 409 Conflict: duplicate topic-action or hook-action relationship, or conflicting update.

Best Practices

  • Use GET /api/Actions/available when building ticket or phone flows; use GET /api/Actions for settings screens.
  • Store execution order on TopicActions or HookActions; do not send priority on the Action definition itself.
  • Use actionScheduleTimeZoneId when scheduling an action; the API normalizes it against the current user timezone.
  • Keep inbound API authentication as JWT Bearer. Use overrideApiAuthenticationType only for outbound API calls made by AnswerPal.
  • Prefer deactivating an action with isActive=false when you may need to restore it; delete only when the action is no longer referenced.

FAQ

/api/Actions management requires ManageSettings. /api/Actions/available accepts ticket access or phone-auth context. Topic and hook action endpoints require an authenticated user.

Priority is stored on TopicActions and HookActions, not on the action definition. Updating a topic or hook action currently updates priority only.

Actions define what can run. TopicActions attach actions to topics or topic/channel combinations. HookActions attach actions to workflow events such as PreSpam, PostTopicDetection, escalation, close or phone pickup.

No. The inbound AnswerPal API uses JWT Bearer authentication. Basic or Bearer values inside action configuration are outbound connector settings used when AnswerPal calls an external API.

Table of Contents

AnswerPal: AI-powered customer service solutions to elevate your support and communication effortlessly.

Contact

For all support, sales, and partnership inquiries, email us at info@answerpal.eu

AnswerPal
Bisschoppenhoflaan 380
2100 Antwerp
Belgium

+32.36416685

BE 0862.692.858