Free setup on annual plans

Sign up today!

API Reference: Topics endpoints

The Topics API manages the categories that AnswerPal uses to classify conversations and drive topic-specific automation. The current implementation covers topic definitions, channel relevance, topic-action links, topic-document links, page-to-topic mappings and a related conditional-rule helper.

Overview and current endpoints

Topics are customer-scoped. List and detail calls can be filtered by channel so callers only receive topics that are applicable to the active email, chat, phone, WhatsApp or Teams context. Topic writes are settings operations, while topic actions, topic documents and page mappings link topics to the automation and prompt context used elsewhere in AnswerPal.

Topics

  • GET /api/Topics – Bearer JWT (TicketAccessOrPhoneAuth)
    List topics with pagination and sorting. Optional query channelId limits results to topics allowed for that channel; phone-auth requests use the token channel.
  • GET /api/Topics/{id} – Bearer JWT (TicketAccessOrPhoneAuth)
    Read one topic. Optional channelId applies the same channel allow-list and returns 404 when the topic is not allowed for that channel.
  • POST /api/Topics – Bearer JWT (ManageSettings)
    Create one topic. The server sets customer scope and validates phone model overrides before saving.
  • PUT /api/Topics/{id} – Bearer JWT (ManageSettings)
    Update topic name, description and phone settings. Legacy customFieldRequirements input is ignored because requirements are now derived from linked documents.
  • DELETE /api/Topics/{id} – Bearer JWT (ManageSettings)
    Delete one owned topic. Returns 204 on success or 404 when the topic is missing.

TopicChannels

  • GET /api/TopicChannels – Bearer JWT (ManageSettings)
    List topic-channel relevance links. Query supports topicId, channelId, pageNumber, pageSize, sortBy and sortOrder. pageNumber is normalized and pageSize is clamped to 1-100.
  • GET /api/TopicChannels/{id} – Bearer JWT (ManageSettings)
    Read one topic-channel link in the authenticated customer scope.
  • POST /api/TopicChannels – Bearer JWT (ManageSettings)
    Create one default relevance link between a topic and either a concrete channel or a special channel type. Duplicate combinations return 409 Conflict.
  • POST /api/TopicChannels/bulk – Bearer JWT (ManageSettings)
    Create multiple topic-channel links. Duplicate input rows and already existing combinations are skipped by the service.
  • DELETE /api/TopicChannels/{id} – Bearer JWT (ManageSettings)
    Delete one topic-channel relevance link.
  • DELETE /api/TopicChannels/bulk – Bearer JWT (ManageSettings)
    Delete multiple topic-channel links. The request body is an array of TopicChannelID values; an empty body returns 400.

TopicActions

  • GET /api/TopicActions – Bearer JWT
    List topic-action links. Filters include topicId, actionId, hookName, channelId, isActive, pagination and sorting.
  • GET /api/TopicActions/{id} – Bearer JWT
    Read one topic-action link with resolved topic, action and channel names.
  • POST /api/TopicActions – Bearer JWT
    Create one topic-action link. Use actionID for the reusable action definition and priority for execution order.
  • POST /api/TopicActions/bulk – Bearer JWT
    Create multiple topic-action links. Existing matching combinations are skipped.
  • PUT /api/TopicActions/{id} – Bearer JWT
    Update only the priority field of an existing link.
  • DELETE /api/TopicActions/{id} – Bearer JWT
    Delete one topic-action link.

TopicDocuments

  • GET /api/TopicDocuments – Bearer JWT
    List topic-document links. Filters include topicId, documentId, channelId, hookName, isHook, pagination and sorting.
  • GET /api/TopicDocuments/{id} – Bearer JWT
    Read one topic-document link scoped to the authenticated customer.
  • POST /api/TopicDocuments – Bearer JWT
    Create one link between a document and a topic, special topic, channel or special channel. Duplicate combinations return 409 Conflict.
  • POST /api/TopicDocuments/bulk – Bearer JWT
    Create multiple topic-document links. Current bulk create returns a server error if the database rejects duplicate combinations.
  • PUT /api/TopicDocuments/{id} – Bearer JWT
    Update document, topic/special topic and channel/special channel fields for one link.
  • DELETE /api/TopicDocuments/{id} – Bearer JWT
    Delete one topic-document link.

PageTopicMappings

  • GET /api/PageTopicMappings – Bearer JWT
    List URL-to-topic mappings with the shared pagination parameters.
  • GET /api/PageTopicMappings/{id} – Bearer JWT
    Read one page-topic mapping in the authenticated customer scope.
  • POST /api/PageTopicMappings – Bearer JWT
    Create one mapping from a URL pattern and path scope to a topic or special topic. The server stores creator and creation timestamp.
  • PUT /api/PageTopicMappings/{id} – Bearer JWT
    Update URL pattern, match type, path scope, topic/special topic and channel scope. The server stores last-modified metadata.
  • DELETE /api/PageTopicMappings/{id} – Bearer JWT
    Delete one page-topic mapping.

Related helper

  • POST /api/ConditionalRules/from-text – Bearer JWT
    Related automation helper. Converts a natural-language instruction into JSON conditional rules. The authenticated customer must have an OpenAI API key configured.

Access and errors

Protected AnswerPal API endpoints use JWT Bearer authentication. The topic list/detail routes can also accept phone-auth context through TicketAccessOrPhoneAuth; settings routes require ManageSettings.

  • List routes return PaginatedResult<T> with items, totalCount and totalPages.
  • Successful create routes usually return 201 Created or 200 OK for bulk creates. Successful update and delete routes usually return 204 No Content.
  • 400 is used for validation errors, 403 for forbidden phone-auth/channel mismatches, 404 for missing or inaccessible resources and 409 for duplicate single-link creates where the API handles conflicts.
  • Phone-auth topic reads are bound to the token channel. Supplying a different channelId returns 403.

Endpoint details

Topics

GET /api/Topics and GET /api/Topics/{id} return TopicDTO data. Use channelId when the caller needs the topic set that applies to a specific channel.

  • GET /api/Topics – Bearer JWT (TicketAccessOrPhoneAuth)
    List topics with pagination and sorting. Optional query channelId limits results to topics allowed for that channel; phone-auth requests use the token channel.
  • GET /api/Topics/{id} – Bearer JWT (TicketAccessOrPhoneAuth)
    Read one topic. Optional channelId applies the same channel allow-list and returns 404 when the topic is not allowed for that channel.
  • POST /api/Topics – Bearer JWT (ManageSettings)
    Create one topic. The server sets customer scope and validates phone model overrides before saving.
  • PUT /api/Topics/{id} – Bearer JWT (ManageSettings)
    Update topic name, description and phone settings. Legacy customFieldRequirements input is ignored because requirements are now derived from linked documents.
  • DELETE /api/Topics/{id} – Bearer JWT (ManageSettings)
    Delete one owned topic. Returns 204 on success or 404 when the topic is missing.

POST /api/Topics, PUT /api/Topics/{id} and DELETE /api/Topics/{id} require ManageSettings. The server owns customer scope and validates phone model overrides.

When a channel context is present, AnswerPal resolves the channel type and applies TopicChannels plus channel topic policy to determine allowed topics. Phone-auth calls cannot request a different channel than the token channel.

Topic custom field requirements are not stored directly on topics anymore. They are derived from the topic documents, global specialTopic=All documents and the channel context.

Topic links

The relationship endpoints attach topics to channels, actions, documents and page URL context. They reuse the same channel scope pattern: either a concrete channelID or a specialChannel value.

TopicChannels define default relevance for a topic on one exact channel or one special channel type.

  • GET /api/TopicChannels – Bearer JWT (ManageSettings)
    List topic-channel relevance links. Query supports topicId, channelId, pageNumber, pageSize, sortBy and sortOrder. pageNumber is normalized and pageSize is clamped to 1-100.
  • GET /api/TopicChannels/{id} – Bearer JWT (ManageSettings)
    Read one topic-channel link in the authenticated customer scope.
  • POST /api/TopicChannels – Bearer JWT (ManageSettings)
    Create one default relevance link between a topic and either a concrete channel or a special channel type. Duplicate combinations return 409 Conflict.
  • POST /api/TopicChannels/bulk – Bearer JWT (ManageSettings)
    Create multiple topic-channel links. Duplicate input rows and already existing combinations are skipped by the service.
  • DELETE /api/TopicChannels/{id} – Bearer JWT (ManageSettings)
    Delete one topic-channel relevance link.
  • DELETE /api/TopicChannels/bulk – Bearer JWT (ManageSettings)
    Delete multiple topic-channel links. The request body is an array of TopicChannelID values; an empty body returns 400.

TopicActions attach reusable Actions to topics or topic/channel combinations. Priority belongs to the link, not to the Action definition.

  • GET /api/TopicActions – Bearer JWT
    List topic-action links. Filters include topicId, actionId, hookName, channelId, isActive, pagination and sorting.
  • GET /api/TopicActions/{id} – Bearer JWT
    Read one topic-action link with resolved topic, action and channel names.
  • POST /api/TopicActions – Bearer JWT
    Create one topic-action link. Use actionID for the reusable action definition and priority for execution order.
  • POST /api/TopicActions/bulk – Bearer JWT
    Create multiple topic-action links. Existing matching combinations are skipped.
  • PUT /api/TopicActions/{id} – Bearer JWT
    Update only the priority field of an existing link.
  • DELETE /api/TopicActions/{id} – Bearer JWT
    Delete one topic-action link.

TopicDocuments attach prompt documents to topics and channel scopes. The Documents API owns document definitions; this API owns the link.

  • GET /api/TopicDocuments – Bearer JWT
    List topic-document links. Filters include topicId, documentId, channelId, hookName, isHook, pagination and sorting.
  • GET /api/TopicDocuments/{id} – Bearer JWT
    Read one topic-document link scoped to the authenticated customer.
  • POST /api/TopicDocuments – Bearer JWT
    Create one link between a document and a topic, special topic, channel or special channel. Duplicate combinations return 409 Conflict.
  • POST /api/TopicDocuments/bulk – Bearer JWT
    Create multiple topic-document links. Current bulk create returns a server error if the database rejects duplicate combinations.
  • PUT /api/TopicDocuments/{id} – Bearer JWT
    Update document, topic/special topic and channel/special channel fields for one link.
  • DELETE /api/TopicDocuments/{id} – Bearer JWT
    Delete one topic-document link.

PageTopicMappings map URL patterns to topics so web context can influence topic selection or automation.

  • GET /api/PageTopicMappings – Bearer JWT
    List URL-to-topic mappings with the shared pagination parameters.
  • GET /api/PageTopicMappings/{id} – Bearer JWT
    Read one page-topic mapping in the authenticated customer scope.
  • POST /api/PageTopicMappings – Bearer JWT
    Create one mapping from a URL pattern and path scope to a topic or special topic. The server stores creator and creation timestamp.
  • PUT /api/PageTopicMappings/{id} – Bearer JWT
    Update URL pattern, match type, path scope, topic/special topic and channel scope. The server stores last-modified metadata.
  • DELETE /api/PageTopicMappings/{id} – Bearer JWT
    Delete one page-topic mapping.

This is a related helper for automation rules, not a topic CRUD endpoint.

  • POST /api/ConditionalRules/from-text – Bearer JWT
    Related automation helper. Converts a natural-language instruction into JSON conditional rules. The authenticated customer must have an OpenAI API key configured.

TopicActions

TopicActions define which reusable automation actions run for a topic and channel scope.

  • GET /api/TopicActions – Bearer JWT
    List topic-action links. Filters include topicId, actionId, hookName, channelId, isActive, pagination and sorting.
  • GET /api/TopicActions/{id} – Bearer JWT
    Read one topic-action link with resolved topic, action and channel names.
  • POST /api/TopicActions – Bearer JWT
    Create one topic-action link. Use actionID for the reusable action definition and priority for execution order.
  • POST /api/TopicActions/bulk – Bearer JWT
    Create multiple topic-action links. Existing matching combinations are skipped.
  • PUT /api/TopicActions/{id} – Bearer JWT
    Update only the priority field of an existing link.
  • DELETE /api/TopicActions/{id} – Bearer JWT
    Delete one topic-action link.

TopicAction fields

  • topicActionID
    Link identifier returned by read endpoints.
  • topicID, specialTopic
    Use one of these. Normal topic automation uses topicID; hook/event automation uses specialTopic and is covered on the Hooks page.
  • actionID
    Required on create. References the reusable action definition from the Actions API.
  • priority
    Required on create and the only field updated by PUT /api/TopicActions/{id}. Must be zero or greater.
  • channelID, specialChannel
    Use exactly one channel scope. Allowed special channel values are Email, Chat, Phone, WhatsApp, Teams and All.
  • topicName, actionName, channelName
    Resolved labels returned by read endpoints.
  • documentID
    Compatibility field currently present on TopicActionBaseDTO. It is not persisted on AP_TopicAction; use actionID for the action definition.

TopicDocuments

TopicDocuments link prompt documents to topics or special topics. The current DTO is limited to topic/special-topic, document and channel/special-channel fields.

  • GET /api/TopicDocuments – Bearer JWT
    List topic-document links. Filters include topicId, documentId, channelId, hookName, isHook, pagination and sorting.
  • GET /api/TopicDocuments/{id} – Bearer JWT
    Read one topic-document link scoped to the authenticated customer.
  • POST /api/TopicDocuments – Bearer JWT
    Create one link between a document and a topic, special topic, channel or special channel. Duplicate combinations return 409 Conflict.
  • POST /api/TopicDocuments/bulk – Bearer JWT
    Create multiple topic-document links. Current bulk create returns a server error if the database rejects duplicate combinations.
  • PUT /api/TopicDocuments/{id} – Bearer JWT
    Update document, topic/special topic and channel/special channel fields for one link.
  • DELETE /api/TopicDocuments/{id} – Bearer JWT
    Delete one topic-document link.

TopicDocument fields

  • topicDocumentID
    Link identifier returned by read endpoints.
  • topicID, specialTopic
    Normal topic prompt context uses topicID. Hook prompt context uses specialTopic and is covered by the Hooks page.
  • documentID
    Required positive document identifier. This is the prompt/document definition from the Documents API.
  • channelID, specialChannel
    Use exactly one channel scope. specialChannel must be Email, Chat, Phone, WhatsApp, Teams or All.
  • customerID, topicName, documentName, channelName
    Response-only ownership and resolved labels.
POST /api/Topics

{
  "name": "Order status",
  "description": "Questions about order tracking and delivery status",
  "phoneSettings": {
    "modelOverridesByCustomerType": {
      "Lead": 12,
      "Customer": 18
    }
  }
}
POST /api/TopicChannels

{
  "topicID": 101,
  "specialChannel": "Email"
}
POST /api/TopicActions

{
  "topicID": 101,
  "actionID": 55,
  "priority": 10,
  "specialChannel": "All"
}
POST /api/TopicDocuments

{
  "topicID": 101,
  "documentID": 501,
  "specialChannel": "All"
}
POST /api/PageTopicMappings

{
  "topicID": 101,
  "urlPattern": "/pricing",
  "matchType": "Contains",
  "pathScope": "RelativePath",
  "specialChannel": "Chat"
}

PageTopicMappings

PageTopicMappings attach URL patterns to topics, enabling page-aware topic selection for web and chat contexts.

  • GET /api/PageTopicMappings – Bearer JWT
    List URL-to-topic mappings with the shared pagination parameters.
  • GET /api/PageTopicMappings/{id} – Bearer JWT
    Read one page-topic mapping in the authenticated customer scope.
  • POST /api/PageTopicMappings – Bearer JWT
    Create one mapping from a URL pattern and path scope to a topic or special topic. The server stores creator and creation timestamp.
  • PUT /api/PageTopicMappings/{id} – Bearer JWT
    Update URL pattern, match type, path scope, topic/special topic and channel scope. The server stores last-modified metadata.
  • DELETE /api/PageTopicMappings/{id} – Bearer JWT
    Delete one page-topic mapping.

PageTopicMapping fields

  • pageTopicMappingID
    Mapping identifier returned by read endpoints.
  • topicID, specialTopic
    Choose one topic target. Validation requires exactly one of these.
  • urlPattern
    Required URL pattern, maximum length 2083.
  • matchType
    Required match operator: Exact, StartsWith, Contains or EndsWith.
  • pathScope
    Required URL scope: Domain, Hostname, RelativePath or FullPath.
  • channelID, specialChannel
    Optional channel scope. At most one can be set.
  • customerID, topicName, channelName
    Response-only ownership and resolved labels.
  • createdByCustomerRepID, creationDate, lastModifiedByCustomerRepID, lastModifiedDate
    Audit metadata set by the server.

Example requests

The examples below use the current DTO fields. Legacy topic-link fields that are no longer part of the DTOs are intentionally not shown.

Fields and DTOs

Topic fields

Topic response fields

  • topicID
    Unique topic identifier returned by read endpoints.
  • name, description
    Human-readable topic label and optional explanation.
  • phoneSettings
    Optional per-topic phone settings. See the phone settings fields below.
  • customFieldRequirements
    Derived custom-field requirements from linked documents that apply to the topic and optional channel context.

Topic create/update fields

  • name
    Required; maximum length 100.
  • description
    Optional free text.
  • phoneSettings.modelOverridesByCustomerType
    Optional dictionary from end-user customer type to call model ID. Allowed keys are Lead, Customer and Partner. Model IDs must be active and compatible with call usage for the customer/global catalog.
  • customFieldRequirements
    Legacy compatibility input. It is accepted by the DTO but intentionally ignored on create and update; requirements are derived from linked documents.

Derived customFieldRequirements fields

  • customFieldDefinitionID, isRequired
    Definition identity and required state derived from the contributing prompt documents.
  • fieldName, displayName, fieldType, description
    Resolved display metadata from the customer custom-field definition.

TopicChannel fields

TopicChannel fields

  • topicChannelID
    Link identifier returned by read endpoints.
  • topicID
    Required topic identifier. The topic must belong to the authenticated customer.
  • channelID, specialChannel
    Choose exactly one. specialChannel is normalized and must be Email, Chat, Phone, WhatsApp, Teams or All.
  • customerID, topicName, channelName
    Response-only ownership and resolved labels.

Related channel topic policy fields

  • mode
    Used by /api/Channels/{id}/topic-policy, documented on the Channels page. Values are AllApplicableExcept and NoneExcept.
  • includeTopicIds, excludeTopicIds
    Explicit channel topic overrides. TopicChannels define default relevance; channel policy overrides the final allow-list for a specific channel.

TopicAction fields

TopicAction fields

  • topicActionID
    Link identifier returned by read endpoints.
  • topicID, specialTopic
    Use one of these. Normal topic automation uses topicID; hook/event automation uses specialTopic and is covered on the Hooks page.
  • actionID
    Required on create. References the reusable action definition from the Actions API.
  • priority
    Required on create and the only field updated by PUT /api/TopicActions/{id}. Must be zero or greater.
  • channelID, specialChannel
    Use exactly one channel scope. Allowed special channel values are Email, Chat, Phone, WhatsApp, Teams and All.
  • topicName, actionName, channelName
    Resolved labels returned by read endpoints.
  • documentID
    Compatibility field currently present on TopicActionBaseDTO. It is not persisted on AP_TopicAction; use actionID for the action definition.

PageTopicMapping fields

PageTopicMapping fields

  • pageTopicMappingID
    Mapping identifier returned by read endpoints.
  • topicID, specialTopic
    Choose one topic target. Validation requires exactly one of these.
  • urlPattern
    Required URL pattern, maximum length 2083.
  • matchType
    Required match operator: Exact, StartsWith, Contains or EndsWith.
  • pathScope
    Required URL scope: Domain, Hostname, RelativePath or FullPath.
  • channelID, specialChannel
    Optional channel scope. At most one can be set.
  • customerID, topicName, channelName
    Response-only ownership and resolved labels.
  • createdByCustomerRepID, creationDate, lastModifiedByCustomerRepID, lastModifiedDate
    Audit metadata set by the server.

TopicDocument fields

TopicDocument fields

  • topicDocumentID
    Link identifier returned by read endpoints.
  • topicID, specialTopic
    Normal topic prompt context uses topicID. Hook prompt context uses specialTopic and is covered by the Hooks page.
  • documentID
    Required positive document identifier. This is the prompt/document definition from the Documents API.
  • channelID, specialChannel
    Use exactly one channel scope. specialChannel must be Email, Chat, Phone, WhatsApp, Teams or All.
  • customerID, topicName, documentName, channelName
    Response-only ownership and resolved labels.

Response envelopes and examples

Protected AnswerPal API endpoints use JWT Bearer authentication. The topic list/detail routes can also accept phone-auth context through TicketAccessOrPhoneAuth; settings routes require ManageSettings.

  • List routes return PaginatedResult<T> with items, totalCount and totalPages.
  • Successful create routes usually return 201 Created or 200 OK for bulk creates. Successful update and delete routes usually return 204 No Content.
  • 400 is used for validation errors, 403 for forbidden phone-auth/channel mismatches, 404 for missing or inaccessible resources and 409 for duplicate single-link creates where the API handles conflicts.
  • Phone-auth topic reads are bound to the token channel. Supplying a different channelId returns 403.

Example payloads

Use the Example requests tab set above for copyable payloads.

FAQ

Yes. GET /api/Topics and GET /api/Topics/{id} use TicketAccessOrPhoneAuth. Phone-auth requests are restricted to the token customer and channel.

They are derived from linked topic documents and specialTopic=All documents that match the topic and channel context. Sending customFieldRequirements on Topic create/update is legacy-compatible but ignored.

TopicChannels express default topic relevance for a channel or channel type. Channel topic policy, documented on the Channels page, adds include/exclude overrides for one concrete channel.

No. PUT /api/TopicActions/{id} currently updates priority only. Create a new link if the topic/action/channel combination needs to change.

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