> For the complete documentation index, see [llms.txt](https://gramhal.gitbook.io/matar/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gramhal.gitbook.io/matar/developer-reference/api/posts/post-a-new-question.md).

# Post a New Question

{% hint style="info" %}
Post a New Question for audio conversations.
{% endhint %}

## Post new Question

<img src="https://203590333-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIHuU6kmTWQfXxOUkN7No%2Fuploads%2Fi7tntfhQ0tKHOOwxOiSO%2Ffile.excalidraw.svg?alt=media&amp;token=ce6d7ea7-4172-45ad-8b10-04d66381b479" alt="API: - https://matar.in.ngrok.io/api/v1//new_post?organization_id={{default_organization_id}}" class="gitbook-drawing">

### Params

**Query Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="234.33333333333331">Query Parameter</th><th width="129">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>organization_id </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Organization ID in which post has to be created</td></tr></tbody></table>

**Header Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="231.33333333333331">Header Parameter</th><th width="129">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Bearer {{access_token}} </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Access tokens securely contain details for the user posting the question as an audio file.</td></tr></tbody></table>

**Body Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="229.33333333333331">Body Parameter</th><th width="129">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>file </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Audio file to post. Audio Format Supported types: flac single channel mono audio. Max audio duration: 120 seconds</td></tr><tr><td><strong>category_id </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td><p>A category ID in which an audio post has to be uploaded. Some categories are science, happiness, society, fitness, etc. </p><p></p><p>To see a list of known Categories with respect to Category ID mapping check Get all Categories API Endpoint.</p></td></tr></tbody></table>

***

**Sample Request ⬇️️**

```
curl --location 'https://matar.in.ngrok.io/api/v1/new_post?organization_id=129487316' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNjkyODcyNDIxLCJqdGkiOiIyZmNiODJiYi0zMDYzLTQzNGUtOGM5OS00NTVjMDhhY2Y3MmMiLCJ0eXBlIjoiYWNjZXNzIiwic3ViIjoiMzk1MDFUIiwibmJmIjoxNjkyODcyNDIxLCJleHAiOjE2OTM3MzY0MjF9.ovz0ItiPsYG_rqT3vEYl42WZBonX52NXf-oWE4DuGmQ' \
--form 'file=@"YcyZ1KDNO/Sehat Question.flac"' \
--form 'category_id="TFTWNI"'
```

**Responses ⬇️**

Status Code: **🟢200** (200 denotes **'ok'**)

```200
{
    "message": "Post received.. generated transcription",
    "post": {
        "_id": "ACDM6HSQB3",
        "audio_data": null,
        "audio_text": "हमें अपनी अच्छी सेहत के लिए क्या करना चाहिए?",
        "audio_translation": null,
        "audio_url": "https://matar-audio.s3.ap-south-1.amazonaws.com/IT8WGDH8Z4v2Sehat_Question.flac",
        "category_ids": [
            "TFTWNI"
        ],
        "chatgpt_query_id": null,
        "created_at": "24/08/2023 , 10:36 AM",
        "data": {
            "duration": 4.56
        },
        "is_active": true,
        "is_chatgpt_enabled": false,
        "organization_id": "129487316",
        "parent_post_id": null,
        "sort_order": null,
        "text": "हमें अपनी अच्छी सेहत के लिए क्या करना चाहिए?",
        "user": {
            "_id": "39501T",
            "image_url": "https://listapp-images.s3.ap-south-1.amazonaws.com/matar_profile_05.png",
            "name": "Sri"
        },
        "user_id": "39501T",
        "whisper_id": null
    }
}
```

Status Code: 🔴**400** (400 denotes **'Bad request'**)

```
/// Response 1
{
    "error": "No file provided"
}
///// Response 2
{
    "message": "no such category"
}
```

***

**Response Parameters Description:**

<table><thead><tr><th width="232">Response Parameter</th><th>Description</th></tr></thead><tbody><tr><td>message</td><td>A response message displayed by servers when a question is successfully posted.</td></tr><tr><td>post_id</td><td>A unique identifier generated in map to posted question.</td></tr><tr><td>post_audio_text</td><td>Contains transcribed version of audio post.</td></tr><tr><td>post_audio_url</td><td>URL of where audio post is stored.</td></tr><tr><td>category_ids</td><td>A unique identifier containing the category in which question is posted.</td></tr><tr><td>chatgpt_query_id</td><td>A chatgpt unique identifier linked to audio question asked by users.</td></tr><tr><td>created_at</td><td>Post creation date</td></tr><tr><td>duration</td><td>Duration of audio post in minutes and seconds.</td></tr><tr><td>is_active</td><td>Is organization active or not.</td></tr><tr><td>is_chatgpt_enabled</td><td>Is chat gpt enabled to answer to post.</td></tr><tr><td>organization_id</td><td>Organization in which the question is posted.</td></tr><tr><td>parent_post_id</td><td>If question post has replies or child post then the question has a valid parent_post_id. parent_post_id is set to null when question post has no replies.</td></tr><tr><td>sort_order</td><td>When there are multiple posts to display they are sorted by sort order and has a number assigned to it. If there is a single post to display the sort_order will be set to null.</td></tr><tr><td>text</td><td>Contains post text transcribed from audio.</td></tr><tr><td>user_id</td><td>User ID of the account from which audio is posted.</td></tr><tr><td>user image_url</td><td>Image URL containing the user account image.</td></tr><tr><td>user_name</td><td>Name for the user account.</td></tr><tr><td>whisper_id</td><td>Used internally for speech-to-text tasks.</td></tr></tbody></table>

***

## Create a Child Post.

<img src="https://203590333-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIHuU6kmTWQfXxOUkN7No%2Fuploads%2Fi7tntfhQ0tKHOOwxOiSO%2Ffile.excalidraw.svg?alt=media&amp;token=ce6d7ea7-4172-45ad-8b10-04d66381b479" alt="API: - https://matar.in.ngrok.io/api/v1//new_post?organization_id={{default_organization_id}}" class="gitbook-drawing">

### Params

**Query Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="234.33333333333331">Body Parameter</th><th width="129">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>organization_id </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Organization ID in which post has to be created</td></tr></tbody></table>

**Header Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="231.33333333333331">Header Parameter</th><th width="129">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Bearer {{access_token}} </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Access tokens securely contain details for the user posting the question as an audio file.</td></tr></tbody></table>

**Body Parameter ⬇️**

<table data-full-width="false"><thead><tr><th width="229.33333333333331">Header Parameter</th><th width="129">Data Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>file </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Audio file containing the answer. Audio Format Supported types: flac single channel mono audio. Max audio duration: 120 seconds</td></tr><tr><td><strong>category_id </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td><p>A category ID in which a post is uploaded. Some categories are science, happiness, society, fitness, etc. </p><p>To see a list of known Categories with respect to Category ID mapping check Get all Categories API Endpoint.</p></td></tr><tr><td><strong>parent_post_id </strong><mark style="color:red;"><strong>(required)</strong></mark></td><td>String</td><td>Parent Post ID is the Post ID of the posted Question to link child/answer post.</td></tr></tbody></table>

***

**Sample Request ⬇️️**&#x20;

```
curl --location 'https://matar.in.ngrok.io/api/v1/new_post?organization_id=K7QUEV' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6dHJ1ZSwiaWF0IjoxNjkzMjk4NDEwLCJqdGkiOiJiYmE3NzdhYy05MTA5LTQyOTQtYjhkNy04NmQ1NDZiNTVmOGEiLCJ0eXBlIjoiYWNjZXNzIiwic3ViIjoiRUE5UzZaIiwibmJmIjoxNjkzMjk4NDEwLCJleHAiOjE2OTQxNjI0MTB9.qn7dyTb9ws4lrGdAoh6rAzu24gos-EIY3lbloFJTrH4' \
--form 'file=@"xglbaJXSR/Sehat Question.flac"' \
--form 'parent_post_id="9TX90RLDR4"' \
--form 'category_id="TFTWNI"'
```

**Responses ⬇️**

Status Code: **🟢200** (200 denotes **'ok'**)

```200
{
    "message": "Post received.. generated transcription",
    "post": {
        "_id": "K74Q9PXAXG",
        "audio_data": null,
        "audio_text": null,
        "audio_translation": null,
        "audio_url": "https://matar-audio.s3.ap-south-1.amazonaws.com/L89W2SSZRBv2Sehat_Question.flac",
        "category_ids": [
            "TFTWNI"
        ],
        "chatgpt_query_id": null,
        "created_at": "29/08/2023 , 12:02 PM",
        "data": {
            "duration": 4.56
        },
        "is_active": true,
        "is_chatgpt_enabled": false,
        "organization_id": "K7QUEV",
        "parent_post_id": "9TX90RLDR4",
        "sort_order": null,
        "text": null,
        "user": {
            "_id": "EA9S6Z",
            "image_url": "https://listapp-images.s3.ap-south-1.amazonaws.com/matar_profile_05.png",
            "name": "shantanu"
        },
        "user_id": "EA9S6Z",
        "whisper_id": null
    }
}
```

Status Code: 🔴**400** (400 denotes **'Bad request'**)

```
/// Response 1
{
    "error": "No file provided"
}
///// Response 2
{
    "message": "no such category"
}
```

***

**Response Parameters Description:**

<table><thead><tr><th width="252">Response Parameter</th><th>Description</th></tr></thead><tbody><tr><td>message</td><td>A response message displayed by servers when a question is successfully posted.</td></tr><tr><td>post_id</td><td>A unique identifier generated in map to posted question.</td></tr><tr><td>post_audio_text</td><td>Contains transcribed version of audio post.</td></tr><tr><td>post_audio_url</td><td>URL of where audio post is stored.</td></tr><tr><td>category_ids</td><td>A unique identifier containing the category in which question is posted.</td></tr><tr><td>chatgpt_query_id</td><td></td></tr><tr><td>created_at</td><td>Post creation date</td></tr><tr><td>duration</td><td>Duration of audio post in minutes and seconds.</td></tr><tr><td>is_active</td><td></td></tr><tr><td>is_chatgpt_enabled</td><td>Is chat gpt enabled to answer to post.</td></tr><tr><td>organization_id</td><td>Organization in which the question is posted.</td></tr><tr><td>parent_post_id</td><td>If question post has replies or child post then the question has a valid parent_post_id. parent_post_id is set to null when question post has no replies.</td></tr><tr><td>sort_order</td><td>When there are multiple posts to display they are sorted by sort order and has a number assigned to it. If there is a single post to display the sort_order will be set to null.</td></tr><tr><td>text</td><td>Contains post text transcribed from audio.</td></tr><tr><td>user_id</td><td>User ID of the account from which audio is posted.</td></tr><tr><td>user image_url</td><td>Image URL containing the user account image.</td></tr><tr><td>user_name</td><td>Name for the user account.</td></tr><tr><td>whisper_id</td><td>Used internally for speech-to-text tasks.</td></tr></tbody></table>
