# QnA via API

In this documentation, we will explain how to integrate a QnA via API in your QnA Path.

QnA via API is useful for organizations that wanted to make an QnA Path but need to answer the recipients with dynamic data.

Head to "Setup" and click "QnA Path" and create QnA Path

<figure><img src="/files/S8c3ZmJF42a3pbdP53Jo" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/wNuHREgGynELG9LS6C8K" alt=""><figcaption></figcaption></figure>

Input title and choose "QnA via API" as the QnA type

<figure><img src="/files/f17RTGdGZw5qf9oVlyQG" alt=""><figcaption></figcaption></figure>

Insert your URL to the field and you can test API call to the url that you provided to see if the reply is correct.

Below is the example POST request payload that our system will send to the url that you have input:

```
{
  "caseID": "ABCD1234", // optional
  "channelType": "telegram|whatsapp|whatsappba|facebook|instagram|launcher|etc..."
  "contact": { // optional
    "customerUserID": "",
    "fullName": "John Doe",
    "alias": "",
    "phone": "" //optional
  }
}

```

Your API must return response with this payload when called:

```
{
  "type": "text|document|image|video",
  "text": { // if type = text
    "body": "Lorem ipsum dolor..."
  },
  "document": { // if type = document
    "url": "https://www.example.com/document.pdf",
    "filename": "Document.pdf",
    "caption": "Please see the attached document..."
  },
  "image": { // if type = image
    "url": "https://www.example.com/image.jpg",
    "caption": "Please see the image..."
  },
  "video": { // if type = video
    "url": "https://www.example.com/video.mp4",
    "caption": "Please watch the video for tutorial..."
  }
}
```

if the API call failed, our system will not send the error to your recipients, instead we will send a message that you have input in "Reply message on API error" field. But if you leave this fielf blank, then we will not reply anything to recipients.

<figure><img src="/files/314PvtE4QrQXDlbJW3el" alt=""><figcaption></figcaption></figure>

Click "Create" on the top right corner to finalize creating a QnA via API.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.taptalk.io/onetalk-omnichannel-documentation/qna-via-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
