# Insight

{% tabs %}
{% tab title="ENDPOINTS" %}

<pre class="language-erlang"><code class="lang-erlang"><strong>[POST] /api/v2/products/insight
</strong>[PUT] /api/v2/products/insight/:id/pause
[PUT] /api/v2/products/insight/:id/resume
</code></pre>

{% endtab %}
{% endtabs %}

## Create an insight

Creates and places new insight into queue

### Request

{% tabs %}
{% tab title="ENDPOINT" %}

```erlang
[POST] /api/v2/products/insight
```

{% endtab %}
{% endtabs %}

#### **Payload**

**query** `hash`\
Query of insight request.\
\
&#x20;   query.**keywords** `string`\
&#x20;   Keywords for insight analytic.\
\
&#x20;   query.**platforms** `array of string`\
&#x20;   Social media outlets to run analyses over. At least one of\
&#x20;   \- `twitter`\
&#x20;   \- `reddit`\
&#x20;   \- `news`\
&#x20;   \- `youtube-videos`\
&#x20;   \- `youtube-comments`\
&#x20;   \- `facebook`\
&#x20;   \- `instagram`\
&#x20;   \- `linkedin`\
&#x20;   \- `tiktok`

&#x20;   query.**dimensions** `array of string`\
&#x20;   Dimensions involved in analysis. At least one of\
&#x20;   \- `textual`\
&#x20;   \- `audial`\
&#x20;   \- `visual`

&#x20;   query.**location** `optional string`\
&#x20;   Specify cities or zip codes to gather data from.\
&#x20;   Only work on `twitter, youtube-videos and youtube-comments`

&#x20;   query.**sneak\_peek** `optional boolean`\
&#x20;   If *true*, run preview analysis; else, run analysis continually over time

{% tabs %}
{% tab title="JSON EXAMPLE" %}

```javascript
{
    "query": {
        "keywords": "Lorem ipsum dolor sit amet",
        "platforms": [
            "twitter",
            "reddit",
            "news",
            "youtube-videos",
            "youtube-comments",
            "facebook",
            "instagram",
            "linkedin",
            "tiktok"
        ],
        "dimensions": [
            "textual",
            "visual",
            "audial"
        ]
    }
}
```

{% endtab %}
{% endtabs %}

#### Example

```bash
curl -i -X POST 'https://product-api.redflagai.co/api/v2/products/insight \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {{JWT_TOKEN}}' \
-d '{
    "query": {
        "keywords": "Lorem ipsum dolor sit amet",
        "platforms": [
            "twitter",
            "reddit",
            "news",
            "youtube-videos",
            "youtube-comments",
            "facebook",
            "instagram",
            "linkedin",
            "tiktok"
        ],
        "dimensions": [
            "textual",
            "visual",
            "audial"
        ]
    }
}'
```

### Response

Successful or failed creation notice.

{% tabs %}
{% tab title="200 OK" %}

<pre><code><strong>{
</strong>    "notice": "Successfully created search. Now your search will be running continuously over time"
}
</code></pre>

{% endtab %}

{% tab title="400 Bad" %}

```json
{
    "error": "error message"
}
```

{% endtab %}
{% endtabs %}

## Pause an insight

Pauses the insight from collecting data.

{% tabs %}
{% tab title="ENDPOINT" %}

```erlang
[PUT] /api/v2/products/insight/:id/pause
```

{% endtab %}
{% endtabs %}

#### Example

```bash
curl -i -X PUT 'https://product-api.redflagai.co/api/v2/products/insight/88/pause' \
-H 'Authorization: Bearer {{JWT_TOKEN}}'
```

### Response

Successful or failed pause notice.

{% tabs %}
{% tab title="200 OK" %}

```json
{
    "notice": "Your Insight search has been paused"
}
```

{% endtab %}

{% tab title="400 Bad" %}

```json
{
    "error": "error message"
}
```

{% endtab %}
{% endtabs %}

## Resume an insight

Resumes the insight to continue collecting data.

{% tabs %}
{% tab title="ENDPOINT" %}

```erlang
[PUT] /api/v2/products/insight/:id/resume
```

{% endtab %}
{% endtabs %}

#### Example

```bash
curl -i -X PUT 'https://product-api.redflagai.co/api/v2/products/insight/1/resume' \
-H 'Authorization: Bearer {{JWT_TOKEN}}'
```

### Response

Successful or failed resume notice.

{% tabs %}
{% tab title="200 OK" %}

```json
{
    "notice": "Your Insight search has been resumed"
}
```

{% endtab %}

{% tab title="400 Bad" %}

```json
{
    "error": "error message"
}
```

{% endtab %}
{% endtabs %}


---

# 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://insight-docs.redflagai.co/resources/insight.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.
