Orvelt
API reference

Knowledge-base operations

List, add, update, and delete organization knowledge-base items.

Knowledge-base operations require the knowledgebase permission. Each item contains text or a URL source.

knowledgeBase.get

List knowledge request

GET /kb

import { knowledgeBase } from '@orvelt/business';

const result = await knowledgeBase.get();

if (result.error) throw new Error(result.error.message);
console.log(result.data);
curl --request GET \
  --url "$ORVELT_API_BASE_URL/kb" \
  --header "x-api-key: $ORVELT_BUSINESS_API_KEY"

knowledgeBase.add

Add item request

POST /kb

import { knowledgeBase } from '@orvelt/business';

const result = await knowledgeBase.add({
  text: 'Returns require a receipt within 30 days.',
});

if (result.error) throw new Error(result.error.message);
curl --request POST \
  --url "$ORVELT_API_BASE_URL/kb" \
  --header "x-api-key: $ORVELT_BUSINESS_API_KEY" \
  --header "content-type: application/json" \
  --data '{"text":"Returns require a receipt within 30 days."}'

Send text or url. The current schema allows both fields as optional, but an empty object does not provide useful source material.

knowledgeBase.update

Update item request

PATCH /kb/{id}

import { knowledgeBase } from '@orvelt/business';

const result = await knowledgeBase.update({
  id: 'ITEM_ID',
  url: 'https://example.com/help/returns',
});

if (result.error) throw new Error(result.error.message);
curl --request PATCH \
  --url "$ORVELT_API_BASE_URL/kb/ITEM_ID" \
  --header "x-api-key: $ORVELT_BUSINESS_API_KEY" \
  --header "content-type: application/json" \
  --data '{"url":"https://example.com/help/returns"}'

text and url are optional in the generated update type. Send the field you intend to replace.

knowledgeBase.delete

Delete item request

DELETE /kb/{id}

import { knowledgeBase } from '@orvelt/business';

const result = await knowledgeBase.delete({
  id: 'ITEM_ID',
});

if (result.error) throw new Error(result.error.message);
curl --request DELETE \
  --url "$ORVELT_API_BASE_URL/kb/ITEM_ID" \
  --header "x-api-key: $ORVELT_BUSINESS_API_KEY"