DM Champ Docs

FAQs API

FAQs are the question-and-answer entries your AI bot draws on when it replies to customers. Each FAQ lives in your account’s library and can be linked to one or more AI Agents, so the same answer is maintained once and reused wherever it fits. This API lets you create, update, bulk-import, reorder and link FAQs from your own code, and use the same AI helpers the dashboard’s FAQ editor uses.

All paths are relative to https://api.dmchamp.com/v1. Every request is authenticated (see API Access and Authentication). API access is a paid feature; without it, requests are rejected with a 403. Shared error codes and paging are in Errors & Pagination. Every field, parameter and response is listed in the API Reference.

How the bot uses a FAQ: when you create or change a FAQ, the platform prepares its search data (used to match the FAQ to incoming questions) in the background. This usually takes a few seconds; after that the bot uses the entry automatically.

Agencies: every endpoint on this page takes sub_account_id, so you can build a client’s knowledge base into their sub-account with your agency key. This is useful when your own onboarding flow collects the answers after the sub-account already exists. Send it in the body on POST/PUT and as a query parameter on GET/DELETE. See API for Agencies.


The FAQ object

A FAQ has a question, an answer, and a few optional settings: is_active, is_global, category, tags and order_index. Those are the only fields you can set. The platform manages everything else (search data, usage_count, timestamps, the link lists); any other field in your request body is ignored.

  • is_active controls whether the bot may use the FAQ. Defaults to true. Set it to false to pause an answer without deleting it.
  • is_global marks the FAQ as not tied to one specific campaign or Agent. It does not make the FAQ apply everywhere: a FAQ is only used by the Agents (or campaigns) it is linked to. Defaults to false.
  • order_index is the display position. Defaults to 0 on create.
  • agent_ids lists the Agents whose knowledge base holds the FAQ. campaign_ids is the legacy equivalent and is empty on an agent-based account.

Agents and campaigns

Older accounts organised FAQs per campaign; current accounts link them to AI Agents. Endpoints that target a knowledge base accept agent_id (also accepted as agentId) and the legacy campaign_id. Send one of them, never both: sending both returns 400.


Endpoints

Task Method + path Reference
List FAQs GET /faqs Open in API Reference
Get a FAQ GET /faqs/{faqId} Open in API Reference
Create a FAQ POST /faqs Open in API Reference
Update a FAQ PUT /faqs/{faqId} Open in API Reference
Delete a FAQ DELETE /faqs/{faqId} Open in API Reference
Bulk-delete FAQs POST /faqs/bulk-delete Open in API Reference
Import FAQs POST /faqs/import Open in API Reference
Reorder FAQs POST /faqs/reorder Open in API Reference
Link a FAQ to an Agent POST /faqs/{faqId}/link Open in API Reference
Unlink a FAQ from an Agent POST /faqs/{faqId}/unlink Open in API Reference
Rebuild a FAQ’s search data POST /faqs/{faqId}/rebuild-embeddings Open in API Reference
Fork a FAQ into a campaign-only copy POST /faqs/{faqId}/fork-for-campaign Open in API Reference
Find near-duplicate FAQs POST /faqs/dedupe Open in API Reference
Dismiss a duplicate-check result POST /faqs/dedupe/dismiss Open in API Reference
Generate FAQs from uploaded documents POST /faqs/generate-from-documents Open in API Reference
Apply reviewed FAQ changes POST /faqs/apply-optimization Open in API Reference
Find FAQs similar to a task POST /faqs/similar-for-task Open in API Reference
Resolve a task with an existing FAQ POST /faqs/resolve-task Open in API Reference

List FAQs

curl "https://api.dmchamp.com/v1/faqs?agent_id=ag7HkQ2ZpLxR3mNb&limit=50&apiKey=YOUR_API_KEY"
{
  "success": true,
  "faqs": [
    { "id": "aBcD1234eFgH5678", "question": "How long does shipping take?", "answer": "Standard shipping takes 3-5 business days.", "is_active": true, "usage_count": 12 }
  ],
  "next_cursor": "aBcD1234eFgH5678"
}
  • Results come newest first, up to 100 per page (default 50). Pass next_cursor back as cursor for the next page; null means there are no more.
  • is_active is filtered per page, so a page can hold fewer items than limit even when more pages follow.
  • search matches text in the question or answer, ignoring case. It works across your whole library, and paging with cursor continues through the matches.

Create and change FAQs

Create a FAQ straight into an Agent’s knowledge base:

curl -X POST "https://api.dmchamp.com/v1/faqs?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "ag7HkQ2ZpLxR3mNb",
    "question": "How long does shipping take?",
    "answer": "Standard shipping takes 3-5 business days.",
    "category": "shipping"
  }'

The response returns the new faq_id.

  • Create: send neither agent_id nor campaign_id to create a FAQ that is not attached to anything yet; link it later.
  • Update (PUT) is partial: only the writable fields you send change. If you send question or answer, it must be a non-empty string. A body with no recognised writable field returns 400. Changing the question or answer refreshes the search data in the background.
  • Delete is permanent. Pass agent_id (or legacy campaign_id) as a query parameter to also remove the FAQ from that knowledge base first, so the Agent is not left pointing at an entry that no longer exists. Bulk-delete does the same for up to 500 IDs and returns deleted_count.
  • Link / unlink adds an existing FAQ to another Agent’s knowledge base, or removes it from one. Unlinking never deletes the FAQ: it stays in your library and stays linked everywhere else.
  • Reorder takes the full list of the knowledge base’s FAQ IDs in the order you want (max 500); each FAQ’s position follows its place in the array. If the Agent, campaign or any ID is not found in your account, the call returns 404 One or more FAQs were not found.
  • Rebuild search data helps when a FAQ is not picked up in replies as expected. It answers 202 with status: "processing" (always), runs in the background, usually finishes in a few seconds, and the FAQ may be left out of AI replies while it rebuilds. Re-fetch the FAQ if you need to confirm.

Import FAQs

curl -X POST "https://api.dmchamp.com/v1/faqs/import?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "ag7HkQ2ZpLxR3mNb",
    "faqs": [
      { "question": "Do you ship internationally?", "answer": "Yes, we ship to most countries worldwide." },
      { "question": "What is your return policy?", "answer": "You can return any item within 30 days." }
    ]
  }'
  • Up to 500 items per call. Each item needs a non-empty question and answer.
  • An item whose question matches an existing FAQ in your library (not case-sensitive) updates that FAQ instead of creating a duplicate. faq_ids in the response lists the created or updated IDs in the order you sent them.
  • Duplicate matching scans your whole library, so very large libraries make imports slower. Prefer fewer, larger imports over many small ones.
  • Import is the one FAQ operation that still runs on a campaign behind the scenes. An Agent with no campaign behind it answers 409 (no_attached_campaign); add those FAQs one at a time with POST /faqs and agent_id instead.

AI-assisted FAQ management

These endpoints call the same AI-assist tools the dashboard’s FAQ editor uses: finding duplicates, generating entries from a document, and matching FAQs to open knowledge-gap tasks. Request bodies here mostly use camelCase (campaignId, agentId, taskId, sourceIds), matching the app’s own requests, while the rest of this page uses snake_case. Fork is the exception and takes campaign_id. Copy the examples rather than guessing a field name.

Generate FAQs from uploaded documents

Reads documents already in your account’s file storage and has the AI draft FAQs from them, checked against your existing library so it reuses or updates entries instead of creating duplicates.

curl -X POST "https://api.dmchamp.com/v1/faqs/generate-from-documents?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignId": "campaign123",
    "uploadedFiles": [
      { "storagePath": "users/abc123uid/uploads/handbook.pdf", "fileName": "handbook.pdf", "mimeType": "application/pdf" }
    ]
  }'
{ "success": true, "faqCount": 6, "reusedCount": 2, "modifiedCount": 1, "newCount": 3 }
  • Nothing is written yet. The result is stored as a pending change set on the campaign; review it and apply or discard it with Apply reviewed FAQ changes.
  • faqCount is the total of proposed changes: reusedCount match an existing FAQ unchanged, modifiedCount edit one, newCount are brand new.
  • It costs credits, since it is an AI pass over the document text.
  • The call does not carry the file. storagePath must point to a file already under your own uploads folder (users/{your user id}/uploads/), the same convention as the uploaded-document import on the Knowledge Base API.
  • Uploaded files are deleted from storage once processing finishes, whether or not it succeeds.
  • A storage path outside your folder comes back as 404. A generation already running for that campaign, too few credits, or files with no readable text currently come back as a generic 500, not a dedicated status.

Apply reviewed FAQ changes

Applies or discards a pending set of AI-proposed changes, from Generate FAQs from uploaded documents or from the dashboard’s FAQ optimization review.

curl -X POST "https://api.dmchamp.com/v1/faqs/apply-optimization?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignId": "campaign123",
    "acceptedChanges": [
      { "action": "create_new", "question": "Do you ship to the EU?", "answer": "Yes, EU shipping takes 7-10 business days." },
      { "action": "remove", "faq_id": "oldFaqId" }
    ]
  }'
  • Send exactly one of campaignId or agentId (for an agent-based account).
  • action is one of keep, remove, add_from_library, create_new, modify. A modify can carry edit_scope: edit_all changes the FAQ everywhere it is used, edit_this_only forks a copy for this target.
  • You choose exactly which changes to accept. A change you leave out is left alone; it is never treated as a rejection that deletes something. Send an empty acceptedChanges array to discard the pending set without applying anything.
  • faq_count in the response is the target’s total linked FAQs after the apply. With no pending set, the response is { "success": true, "message": "No pending FAQ changes to apply" }.
  • A campaign or Agent that belongs to another account is reported as 404, not 403.

Find FAQs similar to a task

Ranks your library by relevance to a knowledge-gap task’s question, the same lookup behind the dashboard’s “Use an existing FAQ” picker. Read-only. taskId must point to a task of type faq_update; limit defaults to 20, capped at 50.

curl -X POST "https://api.dmchamp.com/v1/faqs/similar-for-task?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskId": "task789", "limit": 10 }'
  • Matches are sorted best first by similarity: semantic match when available, keyword overlap otherwise.
  • Always answers HTTP 200, even for an expected failure such as an unknown task or the wrong task type. Check success in the body; on failure the body is { "success": false, "error": "...", "error_code": 404 }, where error_code is the status the call would normally have returned.

Resolve a task with an existing FAQ

Resolves a faq_update task with a FAQ you already have instead of writing a new one: it links the FAQ, sends its answer to the contact who triggered the gap, and marks the task complete. Use it after Find FAQs similar to a task turns up a FAQ that covers the question.

curl -X POST "https://api.dmchamp.com/v1/faqs/resolve-task?apiKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskId": "task789", "faqId": "aBcD1234eFgH5678" }'
  • Like the endpoint above, it always answers 200: check success and error_code in the body. A full follow-up queue shows up as error_code 429 the same way.
  • follow_up_status says what happened to the reply: published (sent right away), queued (the AI was already mid-reply to that contact, so it goes out next), skipped_no_contact (the task has no linked contact), skipped_no_campaign (nothing to send it through), skipped_duplicate (the same answer already went to this contact in the last hour, for example from a near-duplicate task) or skipped_error (sending failed).
  • The contact’s bot setting is left as it was: if the AI is paused for that contact, this one reply is sent and the AI stays paused.

Fork a FAQ into a campaign-only copy

POST /faqs/{faqId}/fork-for-campaign with campaign_id, question and answer creates a copy scoped to that one campaign and re-links the campaign to the copy instead of the original. Use it to customise an answer for one campaign without changing it everywhere else. The original stays in place and keeps its other links; it only loses this campaign’s link. Answers 201 with the new faq_id and the original_faq_id.

Find near-duplicate FAQs

POST /faqs/dedupe starts a background job that scans your library for near-duplicate and overlapping entries and merges or removes them where it is confident. Useful after a bulk import or several rounds of AI-generated FAQs. Pass sourceIds to limit it to certain knowledge-base sources; omit it to scan the whole library.

  • It answers 202 with a job_id and typically takes a few minutes on a large library.
  • Only one job per account at a time: starting another while one is queued or processing returns 409.
  • There is no separate status endpoint. The job’s progress shows on the account’s dedup_job field; re-fetch GET /faqs after a short wait to see what changed.

Dismiss a duplicate-check result

POST /faqs/dedupe/dismiss clears the finished job so it stops showing as an active result. It is idempotent, so it is safe to call when there is nothing to dismiss. It returns 409 while the job is still queued or processing.


Good to know

  • Errors use the standard envelope { "success": false, "error": "FAQ not found" }.
  • 400: a required field is missing or invalid (an empty question, no target where one is needed, both agent_id and campaign_id, more than 500 items in a bulk request).
  • 404: the FAQ, Agent or campaign does not exist or belongs to another account.
  • 409: an import into an Agent with no campaign behind it, or a dedupe start or dismiss while a job is still running.
  • similar-for-task and resolve-task are the exceptions: they always answer 200 and put the real status in error_code.
  • The shared codes (401, 403 when your plan has no API access, 429 rate limit, 500) and retry guidance are in Errors & Pagination.