Create a knowledgebase document
const url = 'https://app.prefactorai.com/api/v1/knowledgebase_document';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"content":"# Setup","content_type":"text/markdown","id":"013xrzp12g3nqk8ns6jadrqmpgrjkeny","knowledgebase_id":"013xrzp12g3nqk8ns6jadrqmpgrjkeny","path":"guides/setup.md"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://app.prefactorai.com/api/v1/knowledgebase_document \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "content": "# Setup", "content_type": "text/markdown", "id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "knowledgebase_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "path": "guides/setup.md" }'Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Parameters for creating a knowledgebase document
object
Document content. Empty content is allowed. Must be valid UTF-8 with no NUL characters, at most 1048576 bytes
Example
# SetupA valid knowledgebase document ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyNull
A valid knowledgebase ID
Example
013xrzp12g3nqk8ns6jadrqmpgrjkenyDocument path, relative, with segments separated by /. At most 1024 characters, with at most 255 characters per segment. Unique among documents in the knowledgebase, ignoring case
Example
guides/setup.mdResponses
Section titled “Responses”Success
object
Full details of a knowledgebase document
object
Document content from the latest revision. Empty content is allowed
SHA-256 of the content, as lowercase hex
MIME type of the document
A valid knowledgebase document ID
A valid knowledgebase ID
A valid knowledgebase document revision ID
Revision number of the latest document revision
Document path, relative, with segments separated by /
Size of the content in bytes
Whether this document is active or archived
Type of resource (always ‘knowledgebase_document’)
Response status when the operation succeeds
Example
{ "details": { "content": "# Setup", "content_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "content_type": "text/markdown", "id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "knowledgebase_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "latest_revision_id": "013xrzp12g3nqk8ns6jadrqmpgrjkeny", "latest_revision_number": 1, "path": "guides/setup.md", "size_bytes": 128, "status": "active", "type": "knowledgebase_document" }, "status": "success"}default
Section titled “default”Error
object
object
object
object
Milliseconds until the client may retry.
object
A valid knowledgebase document revision ID
Example
{ "code": "bad_request", "status": "error"}