The Documents API in AnswerPal allows you to manage both static documents (such as knowledge base articles, templates, and FAQs) and dynamic data retrieval processes (such as integrations with external APIs). Use these endpoints to list, create, update, retrieve, and delete documents or data retrieval definitions for your organization. This documentation covers endpoint usage, request and response data models, and practical examples for seamless integration.
In AnswerPal, a “Document” can be a static text resource (like a template or FAQ) or a dynamic data retrieval process (such as a definition for fetching status updates from an external system). Each document is linked to your organization and can include API integration details for dynamic scenarios. The API allows you to manage these documents and retrieve their content for use in automated workflows, ticket responses, or integrations.
Returns a paginated list of all documents and data retrieval definitions for the authenticated customer.
Query Parameters:
pageNumber
(int, optional): Page number for pagination (default: 1) pageSize
(int, optional): Number of items per page (default: 20)Response: Returns a PaginatedResult of Document objects (see Data Models below).
Example Response:
{
"items": [
{
"documentID": 1,
"customerID": 42,
"name": "Return Policy",
"description": "Standard return policy for all products",
"content": "You can return any item within 30 days...",
"isDataRetrievalProcess": false,
"creationDate": "2023-11-01T09:00:00Z",
"lastModifiedDate": "2023-11-10T10:00:00Z",
"overrideApiBaseUrl": null,
"overrideApiUsername": null,
"overrideApiPassword": null,
"overrideApiToken": null,
"overrideApiAuthenticationType": null,
"apiEndpoint": null,
"apiMethod": null,
"apiHeaders": null,
"apiBodyTemplate": null
}
],
"totalCount": 1,
"pageNumber": 1,
"pageSize": 20
}
Retrieves the details and content of a single document or data retrieval process by its unique ID. If replacePlaceholders=true is specified, special placeholders in the content (such as {{TopicList}}) will be replaced with dynamic values.
Response: Returns a Document object (see Data Models below).
Example Response:
{
"documentID": 1,
"customerID": 42,
"name": "Return Policy",
"description": "Standard return policy for all products",
"content": "You can return any item within 30 days...",
"isDataRetrievalProcess": false,
"creationDate": "2023-11-01T09:00:00Z",
"lastModifiedDate": "2023-11-10T10:00:00Z",
"overrideApiBaseUrl": null,
"overrideApiUsername": null,
"overrideApiPassword": null,
"overrideApiToken": null,
"overrideApiAuthenticationType": null,
"apiEndpoint": null,
"apiMethod": null,
"apiHeaders": null,
"apiBodyTemplate": null
}
Creates a new document or data retrieval definition. Provide the required fields in the request body.
Request Body: See DocumentCreateDTO in Data Models below.
Example Request:
{
"name": "Order Status Retriever",
"description": "Fetches order status from ERP",
"content": null,
"isDataRetrievalProcess": true,
"apiEndpoint": "https://erp.example.com/api/orders/status",
"apiMethod": "GET",
"apiHeaders": "{\"Authorization\": \"Bearer xyz\"}",
"apiBodyTemplate": null,
"overrideApiBaseUrl": null,
"overrideApiUsername": null,
"overrideApiPassword": null,
"overrideApiToken": null,
"overrideApiAuthenticationType": "Bearer"
}
Response: Returns the created Document object.
Updates an existing document or data retrieval definition. Provide the fields to update in the request body.
Request Body: See DocumentUpdateDTO in Data Models below.
Response: 204 No Content on success.
Deletes a document or data retrieval definition by its unique ID.
Response: 204 No Content on success.
Property | Type | Description |
---|---|---|
documentID | int | Unique identifier for the document or data retrieval process. |
customerID | int | Reference to the customer organization (AP_Customers). |
name | string | Name of the document or data retrieval process. |
description | string? | Description of the document or data retrieval process. |
content | string? | Content of the document or details about the data retrieval process. |
isDataRetrievalProcess | bool | Indicates if the record is a data retrieval process (true) or a static document (false). |
creationDate | DateTime | Date and time when the record was created (ISO 8601 format). |
lastModifiedDate | DateTime | Date and time when the record was last modified (ISO 8601 format). |
overrideApiBaseUrl | string? | Overrides the default API base URL for calls specific to this document or data retrieval process. |
overrideApiUsername | string? | Overrides the default API username for authentication for this document. |
overrideApiPassword | string? | Overrides the default API password for authentication for this document. |
overrideApiToken | string? | Overrides the default API token for authentication for this document. |
overrideApiAuthenticationType | string? | Overrides the default API authentication type (e.g., “Basic”, “Bearer”) for this document. |
apiEndpoint | string? | API endpoint URL to be called as part of the data retrieval process. |
apiMethod | string? | HTTP method (“GET”, “POST”, “PUT”, “DELETE”, etc.) to be used for the API endpoint. |
apiHeaders | string? | JSON-formatted string of key-value pairs defining additional headers required for the API call. |
apiBodyTemplate | string? | Template for the body of the API request, possibly including placeholders for dynamic data. |
Property | Type | Required | Description |
---|---|---|---|
name | string | Yes | Name of the document or data retrieval process. |
description | string? | No | Description of the document or data retrieval process. |
content | string? | No | Content of the document or details about the data retrieval process. |
isDataRetrievalProcess | bool | Yes | Indicates if the record is a data retrieval process (true) or a static document (false). |
overrideApiBaseUrl | string? | No | Overrides the default API base URL for calls specific to this document or data retrieval process. |
overrideApiUsername | string? | No | Overrides the default API username for authentication for this document. |
overrideApiPassword | string? | No | Overrides the default API password for authentication for this document. |
overrideApiToken | string? | No | Overrides the default API token for authentication for this document. |
overrideApiAuthenticationType | string? | No | Overrides the default API authentication type (e.g., “Basic”, “Bearer”) for this document. |
apiEndpoint | string? | No | API endpoint URL to be called as part of the data retrieval process. |
apiMethod | string? | No | HTTP method (“GET”, “POST”, etc.) to be used for the API endpoint. |
apiHeaders | string? | No | JSON-formatted string of key-value pairs defining additional headers required for the API call. |
apiBodyTemplate | string? | No | Template for the body of the API request, possibly including placeholders for dynamic data. |
{
"name": "Return Policy",
"description": "Standard return policy for all products",
"content": "You can return any item within 30 days...",
"isDataRetrievalProcess": false
}
Dynamic Data Retrieval Example: A definition for fetching order status from an external ERP API.
{
"name": "Order Status Retriever",
"description": "Fetches order status from ERP",
"isDataRetrievalProcess": true,
"apiEndpoint": "https://erp.example.com/api/orders/status",
"apiMethod": "GET",
"apiHeaders": "{\"Authorization\": \"Bearer xyz\"}",
"overrideApiAuthenticationType": "Bearer"
}
Static documents are fixed text resources (like templates or FAQs), while data retrieval processes define how to fetch dynamic data from external APIs and can be used for real-time integration.
Yes, you can use special placeholders (such as {{TopicList}}) that can be replaced dynamically via the API.
You can specify Basic or Bearer authentication, and override credentials at the document level.
Yes, we recommend testing with sample data and using the replacePlaceholders option to preview dynamic content.
AnswerPal: AI-powered customer service solutions to elevate your support and communication effortlessly.
For all support, sales, and partnership inquiries, email us at info@answerpal.eu