FAQs

Submitting and retrieving Frequently Asked Questions

Last updated: 16 June 2022

Existing, predefined FAQs can be indexed. When a question is posted, Viko will first perform a semantic search of all indexed FAQs. If no suitable match can be found, Viko will then try to extract or generate an answer using documents for context. For more information please read the introductory document explaining FAQs and Answered Questions (AQs)

Contents

  1. Submit FAQ
  2. Update FAQ
  3. Delete FAQ
  4. Get FAQ
  5. List FAQ folders
  6. List FAQs
  7. List AQs - Frequent, previously asked questions (FAQ candidates)

The examples in this document use the stubbed endpoint. Remember to swap over to the real endpoint !


Submit FAQ

Submit a predefined FAQ for indexing. The appropriate folder will be created if it does not already exist.

Note: Documents and FAQs can reside in the same folder.

Request

POST https://api.viko.ai/v1-beta/{tenancy}/faq/{folder}/
Parameters: tenancy, folder
Header: X-Api-Key (required)
Header: X-Title (Optional)
Header: X-Canonical-Url (Optional)
Content-Type: application/json
Body: JSON object

{
  question: string (required)
  answer: string (required)
}

Response

Status: 202 (Accepted)
Body: JSON object

{
  id: string (required) // generated FAQ id
}

Example

$ curl \
  --header 'X-Api-Key: replaceme' \
  --header 'Content-Type: application/json' \
  --request POST 'https://stub.viko.ai/v1-beta/acme/faq/shipping/' \
  --data-raw '{
    "question": "how much is next day shipping",
    "answer": "$4.95"
  }'
{
  "id": "1"
}

Update FAQ

Update a predefined FAQ.

Request

PUT https://api.viko.ai/v1-beta/{tenancy}/faq/{folder}/{id}
Parameters: tenancy, folder, id (faq id)
Header: X-Api-Key (required)
Content-Type: application/json
Body: JSON object

{
  question: string (required)
  answer: string (required)
}

Response

Status: 202 (Accepted)
Body: JSON object

{
  question: string (required)
  answer: string (required)
}

Example

$ curl \
  --header 'X-Api-Key: replaceme' \
  --header 'Content-Type: application/json' \
  --request PUT 'https://stub.viko.ai/v1-beta/acme/faq/shipping/1' \
  --data-raw '{
    "question": "how much is next day shipping",
    "answer": "$3.95"
  }'
{
  "question": "how much is next day shipping",
  "answer": "$3.95"  
}

Delete FAQ

Request

DELETE https://api.viko.ai/v1-beta/{tenancy}/faq/{folder}/{id}
Parameters: tenancy, folder, id (faq id)
Header: X-Api-Key (required)

Response

Status: 202 (Accepted)
Body: JSON object

{
  id: string (required)
}

Example

$ curl \
  --header 'X-Api-Key: replaceme' \
  --request DELETE 'https://stub.viko.ai/v1-beta/acme/faq/shipping/1'
{
  "id": "1"
}

Get FAQ

Request

GET https://api.viko.ai/v1-beta/{tenancy}/faq/{folder}/{id}
Parameters: tenancy, folder, id (faq id)
Header: X-Api-Key (required)

Response

Status: 200 (Ok)
Body: JSON object

{
  question: string (required)
  answer: string (required)
}

Example

$ curl \
  --header 'X-Api-Key: replaceme' \
  --request GET 'https://stub.viko.ai/v1-beta/acme/faq/shipping/1'
{
  "question": "how much is next day shipping?",
  "answer": "$4.95"
}

List FAQ folders

Request

GET https://api.viko.ai/v1-beta/{tenancy}/faq/
Parameters: tenancy
Header: X-Api-Key (required)

Response

Status: 200
Body: JSON object

{
  folders: [
    {
      name: string (required)
    }
  ]
}

Example

$ curl \
  --header 'X-Api-Key: replaceme' \
  --request GET 'https://stub.viko.ai/v1-beta/acme/faq/'
{
  "folders": [
    {
      "name": "shipping"
    }
  ]
}

List FAQs

Request

GET https://api.viko.ai/v1-beta/{tenancy}/faq/{folder}/
Parameters: tenancy, folder (folder name)
Header: X-Api-Key (required)

Response

Status: 200
Body: JSON object

{
  folder: string (required)
  faq: [
    {
      id: string (required)
      question: string (required)
      answer: string (required)
    }
  ]
}

Example

$ curl \
  --header 'X-Api-Key: replaceme' \
  --request GET 'https://stub.viko.ai/v1-beta/acme/faq/shipping/'
{
  "folder": "shipping",
  "faqs": [
    {
      "id": "1",
      "question": "how much is next day shipping?",
      "answer": "$4.95"
    }
  ]
}

List Answered Questions (AQs)

Request

GET https://api.viko.ai/v1-beta/{tenancy}/aq/
Parameters: tenancy Header: X-Api-Key (required)

Response

Status: 200
Body: JSON object

{
  aq: [
    {
      question: string (required)
      answer: string (required)
      count: number (required) // number of times question was asked
    }
  ]
}

Example

$ curl \
  --header 'X-Api-Key: replaceme' \
  --request GET 'https://stub.viko.ai/v1-beta/acme/aq/'
{
  "folder": "shipping",
  "faq": [
    {
      "id": "1",
      "question": "how much is next day shipping?",
      "answer": "$4.95"
    }
  ]
}

Try Viko

Want to see Viko in action? Try our interactive demo