A knowledge base is a searchable collection of files that the AI consults when it answers. Each knowledge base is an OpenAI vector store in the OpenAI project of the account, reached with the account’s own OpenAI key. You link it to prompt documents; a document with vector search switched on then searches its knowledge bases while a reply is written. These endpoints create and link knowledge bases, upload and manage their files, test a search and follow the long-running operations that do the work in the background.
409 linked_knowledge_base_read_only. A linked knowledge base can be copied into a new managed one (adoption).202 Accepted with a Location header to /api/knowledge-base-operations/{operationID} and the operation in the body. Poll the operation until its status is Succeeded, Failed or Cancelled.Idempotency-Key header: 8 to 200 characters, ASCII letters, digits and - _ . :. The same key with the same request returns the original operation again; the same key for another request answers 409 idempotency_key_conflict. Keys are unique per account across all knowledge base operations.concurrencyToken. Changes send the current token; when it no longer matches, the answer is 409 (knowledge_base_concurrency_conflict or file_concurrency_conflict): read the item again and retry. The token changes often, also after a read that refreshes the state from OpenAI./api/knowledge-bases/api/knowledge-basesProvisioning) and the operation that creates the vector store./api/knowledge-bases/capabilitiessourceStorageConfigured) and the largest file that can be uploaded (maximumSourceFileBytes)./api/knowledge-bases/linked/api/knowledge-bases/{knowledgeBaseID}/api/knowledge-bases/{knowledgeBaseID}concurrencyToken and confirmation DELETE KNOWLEDGE BASE. A managed knowledge base loses its files and vector store at OpenAI; for a linked one only AnswerPal’s record goes. Answers 202 Accepted./api/knowledge-bases/{knowledgeBaseID}/page-image-settings/api/knowledge-bases/{knowledgeBaseID}/search/api/knowledge-bases/{knowledgeBaseID}/reconcile/api/knowledge-bases/{knowledgeBaseID}/adoptions/api/knowledge-bases/{knowledgeBaseID}/documentstotalCount and up to 500 items (documentID, name), by name./api/knowledge-bases/{knowledgeBaseID}/documents/{documentID}concurrencyToken of the knowledge base. A link that does not exist gives 200 as well. Returns the knowledge base./api/knowledge-bases/{knowledgeBaseID}/filespageSize (1 to 100, default 20), continuationToken, status and order (asc or desc, default desc)./api/knowledge-bases/{knowledgeBaseID}/files/api/knowledge-bases/{knowledgeBaseID}/files/{knowledgeBaseFileID}/api/knowledge-bases/{knowledgeBaseID}/files/{knowledgeBaseFileID}/content/api/knowledge-bases/{knowledgeBaseID}/files/{knowledgeBaseFileID}/previewpageSize (1 to 100) and continuationToken./api/knowledge-bases/{knowledgeBaseID}/files/{knowledgeBaseFileID}/replacements/api/knowledge-bases/{knowledgeBaseID}/files/{knowledgeBaseFileID}/page-images/api/knowledge-bases/{knowledgeBaseID}/files/{knowledgeBaseFileID}/detach/api/knowledge-bases/{knowledgeBaseID}/files/{knowledgeBaseFileID}/restore/api/knowledge-bases/{knowledgeBaseID}/files/{knowledgeBaseFileID}/provider-fileconcurrencyToken and confirmation DELETE PROVIDER FILE. Answers 202 Accepted./api/knowledge-bases/{knowledgeBaseID}/files/{knowledgeBaseFileID}/versions/{knowledgeBaseFileVersionID}/provider-file/api/knowledge-bases/{knowledgeBaseID}/files/{knowledgeBaseFileID}/versions/{knowledgeBaseFileVersionID}/sourceconcurrencyToken and confirmation PURGE SOURCE. Frees storage. Answers 202 Accepted./api/knowledge-base-operations/{operationID}/api/knowledge-base-operations/{operationID}/retryretryable is true. Returns the operation (200 OK), back in Pending./api/knowledge-base-operations/{operationID}/cancelCancelled.knowledgeBaseID (integer), nameproviderOpenAI.managementModeManaged or LinkedExternal.statusProvisioning, Adopting, Ready, Degraded, Inaccessible, Deleting, Deleted or Unknown.isEnabled (boolean), fileCount (files that are not removed), linkedDocumentCountlastSynchronizedAt, lastValidatedAt, lastErrorCode, lastErrorMessageconcurrencyToken, adoptedFromKnowledgeBaseID (integer or null), maxPageImagesPerReply (integer or null)name (string, required, 1 to 150 characters)With the Idempotency-Key header. The account needs an OpenAI key; without one the answer is 401 knowledge_credentials_missing. The answer holds knowledgeBase and operation. The knowledge base is Ready once the operation succeeded.
externalStoreID (string, required, max 255)vs_. It must be reachable with the account’s OpenAI key.documentID (integer, optional)The answer is { "knowledgeBase": {...}, "created": true }. The name comes from the vector store. Linking a store that is already linked enables it again, also after it was deleted in AnswerPal, and adds the document link. A store that is one of the account’s managed knowledge bases gives 409 vector_store_managed_by_answerpal.
For managed PDFs, AnswerPal can store an image of every page and give the AI the pages that match the passages it found. maxPageImagesPerReply (0 to 50, or null) limits how many page images of this knowledge base one reply uses: null follows the account setting, else 10; 0 sends none. The body of PUT .../page-image-settings is { "concurrencyToken": "...", "maxPageImagesPerReply": 4 }. Page images count towards the account’s storage.
query (string, required, 1 to 2000 characters), maxResults (1 to 50, default 10)The answer is { "items": [...], "hasMore": false }. Each item has knowledgeBaseFileID (null when AnswerPal does not know the file yet), fileName, score, attributes, content (passages with type and text) and pageNumber. There is no next page. On a managed knowledge base only the active versions of ready files are searched.
discovered, updated, markedMissing, totalProviderFiles, completedAt, lifecycleDrift, stuckOperations, retainedSourcesNotVerified, pageImageDrift and pageImagesNotVerified. The check runs while you wait and can take a while on a large knowledge base; above 10,000 files it answers 400 reconciliation_limit_exceeded, and a second check of the same knowledge base at the same time 409 reconciliation_in_progress. AnswerPal also runs it every hour. When a managed knowledge base differs from its records, its status becomes Degraded.
A knowledge base that is still linked to a document cannot be deleted (409 knowledge_base_still_linked): remove the document links first. The knowledge base is Deleting right away and Deleted when the operation succeeded. The originals of a deleted managed knowledge base stay for the retention period and can be purged.
POST /api/knowledge-bases
Authorization: Bearer <token>
Idempotency-Key: kb-create-2026-12-01-01
Content-Type: application/json
{ "name": "Product manuals" }
202 Accepted
Location: /api/knowledge-base-operations/6f0c4d0e-2b1a-4b8e-9a51-3c7e2f1d9a40
{
"knowledgeBase": {
"knowledgeBaseID": 14,
"name": "Product manuals",
"provider": "OpenAI",
"managementMode": "Managed",
"status": "Provisioning",
"isEnabled": true,
"fileCount": 0,
"concurrencyToken": "AAAAAAAAB9E=",
"linkedDocumentCount": 0,
"maxPageImagesPerReply": null,
...
},
"operation": {
"knowledgeBaseOperationID": "6f0c4d0e-2b1a-4b8e-9a51-3c7e2f1d9a40",
"knowledgeBaseID": 14,
"type": "Provision",
"status": "Pending",
"retryable": false,
...
}
} POST /api/knowledge-bases/linked
Authorization: Bearer <token>
Content-Type: application/json
{ "externalStoreID": "vs_abc123example", "documentID": 140 }
201 Created
Location: /api/knowledge-bases/15
{
"knowledgeBase": {
"knowledgeBaseID": 15,
"name": "Support articles",
"managementMode": "LinkedExternal",
"status": "Ready",
"linkedDocumentCount": 1,
...
},
"created": true
} POST /api/knowledge-bases/14/search
Authorization: Bearer <token>
Content-Type: application/json
{ "query": "How do I reset the thermostat?", "maxResults": 3 }
200 OK
{
"items": [
{
"knowledgeBaseFileID": 301,
"fileName": "thermostat-manual.pdf",
"score": 0.82,
"attributes": { ... },
"content": [ { "type": "text", "text": "To reset the thermostat, hold the menu button for ten seconds ...", "pageNumber": null } ],
"pageNumber": 12
}
],
"hasMore": false
} DELETE /api/knowledge-bases/14
Authorization: Bearer <token>
Idempotency-Key: kb-delete-14-2026-12-05
Content-Type: application/json
{ "concurrencyToken": "AAAAAAAACA4=", "confirmation": "DELETE KNOWLEDGE BASE" }
202 Accepted
Location: /api/knowledge-base-operations/0d6b3a7e-58c2-4f7d-a1e9-62b4c3d8e015
{ "operation": { "knowledgeBaseOperationID": "0d6b3a7e-58c2-4f7d-a1e9-62b4c3d8e015", "type": "DeleteKnowledgeBase", "status": "Pending", ... } } file (file, required).pdf, .docx, .pptx, .doc, .rtf, .txt, .md, .html, .htm, .json and .csv. The type follows from the extension and the content must match it; the content type you send is not used. The file name may be at most 255 characters.pageImages (true or false, optional)concurrencyToken (replacement only, required)With the Idempotency-Key header; a repeat must send the same file and the same pageImages choice. The knowledge base must be managed, enabled and Ready. AnswerPal keeps the original and counts it towards the account’s storage: an account without storage space, or whose storage is full, gets 409 storage_quota_exceeded. When managed uploads are not available, the answer is 503 knowledge_source_storage_unavailable; GET .../capabilities tells this beforehand. The answer holds knowledgeBaseFileID, knowledgeBaseFileVersionID, fileName, sourceSizeBytes, sha256 and operation.
knowledgeBaseFileID, displayName, status (Discovered, Pending, Ready, Failed, Removing or Removed), providerStatussizeBytes, usageBytes, createdAt, lastSynchronizedAt, warningCode, warningMessagecurrentVersionID, concurrencyToken, pageImagesEnabledversions (newest first)knowledgeBaseFileVersionID, versionNumber, fileName, status (PendingUpload, Uploading, Processing, Ready, Failed, Superseded, Removing or Removed), isActive, hasRetainedSource, hasProviderProjection, providerFileOwnedByAnswerPal, sourceSizeBytes, sha256, retainUntil, detachedAt, providerDeletedAt, sourcePurgedAt, lastErrorCode, lastErrorMessage, pdfPageCount, derivedImageSizeBytes and totalStoredSizeBytes.status takes active (all but removed), completed (ready), in_progress, failed, cancelled or removed, in lower case. The answer is { "items": [...], "continuationToken": "...", "hasMore": true }; pass continuationToken to get the next page. On a linked knowledge base the list is read from OpenAI.
Removed and its original is kept until retainUntil (30 days). Body: { "concurrencyToken": "..." }.409 provider_file_may_be_shared.retainUntil; before that the answer is 409 knowledge_source_retention_active. The active version cannot be purged.A replaced version becomes Superseded with a retainUntil 30 days later. While another operation runs on the same file, a change answers 409 file_operation_in_progress.
The preview returns { "items": [ { "type", "text", "pageNumber" } ], "continuationToken", "hasMore" }; pageNumber is filled for PDFs whose page texts AnswerPal stored. The download returns the file with its content type and file name as an attachment. A managed original is checked against its size and SHA-256 first.
POST /api/knowledge-bases/14/files
Authorization: Bearer <token>
Idempotency-Key: kb14-upload-thermostat-manual-v1
Content-Type: multipart/form-data; boundary=b1
--b1
Content-Disposition: form-data; name="file"; filename="thermostat-manual.pdf"
Content-Type: application/pdf
<binary PDF>
--b1
Content-Disposition: form-data; name="pageImages"
true
--b1--
202 Accepted
Location: /api/knowledge-base-operations/b2a8f1c4-7d3e-4c59-8e6f-1a2b3c4d5e6f
{
"knowledgeBaseFileID": 301,
"knowledgeBaseFileVersionID": 412,
"fileName": "thermostat-manual.pdf",
"sourceSizeBytes": 2483120,
"sha256": "9f2c...e41a",
"operation": { "knowledgeBaseOperationID": "b2a8f1c4-7d3e-4c59-8e6f-1a2b3c4d5e6f", "type": "Ingest", "status": "Pending", ... }
} GET /api/knowledge-bases/14/files/301
Authorization: Bearer <token>
200 OK
{
"knowledgeBaseFileID": 301,
"displayName": "thermostat-manual.pdf",
"status": "Ready",
"providerStatus": "completed",
"sizeBytes": 2483120,
"currentVersionID": 412,
"concurrencyToken": "AAAAAAAACB0=",
"pageImagesEnabled": true,
"versions": [
{
"knowledgeBaseFileVersionID": 412,
"versionNumber": 1,
"fileName": "thermostat-manual.pdf",
"status": "Ready",
"isActive": true,
"hasRetainedSource": true,
"hasProviderProjection": true,
"retainUntil": null,
"pdfPageCount": 38,
...
}
],
...
} POST /api/knowledge-bases/14/files/301/detach
Authorization: Bearer <token>
Idempotency-Key: kb14-detach-301-01
Content-Type: application/json
{ "concurrencyToken": "AAAAAAAACB0=" }
202 Accepted
{
"knowledgeBaseFileID": 301,
"knowledgeBaseFileVersionID": 412,
"operation": { "type": "Detach", "status": "Pending", ... }
} knowledgeBaseOperationID (GUID), knowledgeBaseID, knowledgeBaseFileID, knowledgeBaseFileVersionIDtypeProvision, Ingest, Replace, Detach, Restore, DeleteProviderFile, PurgeSource, DeleteKnowledgeBase or Adopt.statusPending, Running, Succeeded, Failed or Cancelled.attemptCount, retryable, creationDate, lastModifiedDate, startedAt, completedAt, lastErrorCode, lastErrorMessagetotalItems, completedItems, failedItemsAnswerPal retries temporary failures itself. A failed operation with retryable true (for example a timeout or an OpenAI error) can be started again with POST .../retry. Only an adoption can be cancelled.
concurrencyToken (required)name (string, required, 1 to 150 characters)documentIDs (array, required, may be empty)With the Idempotency-Key header. The linked knowledge base must be enabled and Ready. AnswerPal creates a new vector store, copies every file, checks it with the upload rules and keeps the original (this counts towards storage). The new knowledge base is Adopting and disabled until the operation succeeds. The linked knowledge base itself is not changed. A cancelled adoption leaves the new knowledge base disabled.
GET /api/knowledge-base-operations/b2a8f1c4-7d3e-4c59-8e6f-1a2b3c4d5e6f
Authorization: Bearer <token>
200 OK
{
"knowledgeBaseOperationID": "b2a8f1c4-7d3e-4c59-8e6f-1a2b3c4d5e6f",
"knowledgeBaseID": 14,
"knowledgeBaseFileID": 301,
"knowledgeBaseFileVersionID": 412,
"type": "Ingest",
"status": "Succeeded",
"attemptCount": 1,
"retryable": false,
"startedAt": "2026-12-01T10:02:11",
"completedAt": "2026-12-01T10:02:48",
"lastErrorCode": null,
"lastErrorMessage": null,
"totalItems": 0,
"completedItems": 0,
"failedItems": 0,
...
} POST /api/knowledge-bases/15/adoptions
Authorization: Bearer <token>
Idempotency-Key: kb15-adopt-01
Content-Type: application/json
{
"concurrencyToken": "AAAAAAAAB+k=",
"name": "Support articles (managed)",
"documentIDs": [140]
}
202 Accepted
{
"knowledgeBase": { "knowledgeBaseID": 16, "status": "Adopting", "isEnabled": false, "adoptedFromKnowledgeBaseID": 15, ... },
"operation": { "type": "Adopt", "status": "Pending", "totalItems": 0, ... }
} Every endpoint needs a bearer token with the role Configurator or Administrator. The access line of each endpoint above is the reference. Errors are problem details: type, title, status, detail and a code such as knowledge_base_not_found. Invalid input caught before processing (for example a missing concurrencyToken or a maxResults above 50) answers a list of field errors without code. Times are UTC; times read back from storage are written without the Z.
200 OK, 201 Created, 202 Accepted400 Bad RequestIdempotency-Key, a wrong confirmation, a file type that is not allowed or whose content does not match, a knowledge base that is deleted or disabled.401 Unauthorizedprovider_authentication_failed) or the account has none (knowledge_credentials_missing).403 Forbidden404 Not Found409 Conflict429 Too Many Requests, 502 Bad Gateway, 503 Service Unavailable, 504 Gateway TimeoutThrough a prompt document. Link the knowledge base to the document (POST /api/knowledge-bases/linked with documentID for a linked store, or the knowledge base IDs on the document, see the Documents page) and switch on vector search on the document. While AnswerPal writes a reply with that document, it searches the linked knowledge bases.
Managed uploads need storage for the originals. When GET /api/knowledge-bases/capabilities returns sourceStorageConfigured false, uploads, replacements and adoptions answer 503 knowledge_source_storage_unavailable.
No. Change them in OpenAI, or adopt the linked knowledge base: the copy is managed and can be changed through AnswerPal.
The previous version is kept for 30 days. After its retainUntil, delete its original with DELETE .../versions/{knowledgeBaseFileVersionID}/source.
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
AnswerPal
Bisschoppenhoflaan 380
2100 Antwerp
Belgium
+32.36416685
BE 0862.692.858