# Export

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

```erlang
[POST] /api/v2/products/insight/exports
[GET] /api/v2/products/insight/exports/:id
```

{% endtab %}
{% endtabs %}

## The export object

### Attributes

**status** `string`\
Current export status. One of `pending`, `running`, `failed`, or `done`.

**query** `hash`\
Query of export request.\
\
&#x20;   query.**insight\_search\_ids** `array of integers`\
&#x20;   List of insight searches IDs involved in this export.\
\
&#x20;   query.**start\_date** `string`\
&#x20;   A cursor for use in pagination. Dataset that is created after this date is exported.

&#x20;   query.**end\_date** `string`\
&#x20;   A cursor for use in pagination. Dataset that is created before this date is exported.<br>

**data** `array of hashes` (only if **status** is `done`, otherwise null)\
Results of analyzed [posting](#the-posting-object) object from **query**.

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

```javascript
{
    "status": "done",
    "query": {
        "insight_search_ids": [1,2,3],
        "start_date": "2022-12-01",
        "end_date": "2022-12-31"
    },
    "data": [
        {
            "insight_search_id": "1",
            "social_id": "12345678910",
            "social_url": "https://www.example.com/p/12345678910",
            "platform": "twitter",
            "sentiments": "anger",
            "intentions": "assertion",
            "topic_1": "topic 1",
            "topic_2": "topic 2",
            "topic_3": "topic 3",
            "topic_4": "topic 4",
            "topic_5": "topic 5",
            "topic_6": "topic 6",
            "topic_7": "topic 7",
            "topic_8": "topic 8",
            "visual_detection_analyses": "label 1,label 2",
            "text_of_post": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
            "terms": "Lorem ipsum",
            "post_date": "12/1/2022",
    	    "post_time": "12:01:50",
            "text_post_lang": null,
            "text_post_type": null,
            "text_post_tagged_users": null,
            "text_post_tags": null,
            "geo_coordination": null,
            "place_type": null,
            "place_full_name": null,
            "place_country_code": null,
            "place_country_name": null,
            "place_id": null,
            "share_count": null,
            "like_count": null,
            "angry_count": null,
            "laugh_count": null,
            "love_count": null,
            "sad_count": null,
            "support_count": null,
            "wow_count": null,
            "appreciation_count": null,
            "empathy_count": null,
            "interest_count": null,
            "maybe_count": null,
            "praise_count": null,
            "digg_count": null,
            "reaction_total_count": null,
            "video_play_count": null,
            "video_view_count": null,
            "view_count": null,
            "comment_count": null,
            "share_with_comment_count": null,
            "author_id": null,
            "author_username": null,
            "author_type": null,
            "author_name": null,
            "more_info": null
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## The posting object

### Attributes

**insight\_search\_id** `string`\
Analyzed posting's insight search ID.

**social\_id** `optional string`\
This posting social media ID.

**social\_url** `optional string`\
This posting social media URL.

**platform** `string`\
This posting social media platform.

**sentiments** `optional string`\
Detected sentiment label on this posting. One of `acceptance_self`, `acceptance`, `anger`, `annoyance`, `anxiety`, `calmness`, `contentment`, `disgust_self`, `disgust`, `dislike_self`, `dislike`, `eagerness`, `fear`, `joy`, `melancholy`, `pleasantness_self`, `pleasantness`, `responsiveness`, `sadness` or `serenity`.

**intentions** `optional string`\
Detected intention label on this posting. Classified by affect: *affective or denotative*, time: *present/past or future* and description: *descriptive or prescriptive*. One of `assertion`, `valuation`, `palinode`, `contrition`, `forecast`, `wish`, `proposal`, `inducement`, or `none`.

> Intention Label Classification\
> \- `assertion` (denotative, present/past, descriptive)\
> \- `valuation` (affective, present/past, descriptive)\
> \- `palinode` (denotative, present/past, prescriptive)\
> \- `contrition` (affective, present/past, prescriptive)\
> \- `forecast` (denotative, future, descriptive)\
> \- `wish` (affective, future, descriptive)\
> \- `proposal` (denotative, future, prescriptive)\
> \- `inducement` (affective, future, prescriptive)

**topic\_1** `optional string`\
First topic label. Word or phrase derived from this posting.

**topic\_2** `optional string`\
Second topic label. Word or phrase derived from this posting.

**topic\_3** `optional string`\
Third topic label. Word or phrase derived from this posting.

**topic\_4** `optional string`\
Fourth topic label. Word or phrase derived from this posting.

**topic\_5** `optional string`\
Fifth topic label. Word or phrase derived from this posting.

**topic\_6** `optional string`\
Sixth topic label. Word or phrase derived from this posting.

**topic\_7** `optional string`\
Seventh topic label. Word or phrase derived from this posting.

**topic\_8** `optional string`\
Eighth topic label. Word or phrase derived from this posting.

**visual\_detection\_analyses** `optional array of strings`\
Detected face, object, activity or logo label(s) on this posting.

**text\_of\_post** `optional string`\
This posting text.

**terms** `string`\
Subject of insight search to run analyses over. Separated by comma, if more.

**post\_date** `string`\
This posting created date.

**post\_time** `string`\
This posting created time.

**text\_post\_lang** `optional string`\
This posting text language.

**text\_post\_type** `optional string`\
This posting type.

**text\_post\_tagged\_users** `optional array of strings`\
This posting tagged users.

**text\_post\_tags** `optional array of strings`\
This posting hashtags.

**geo\_coordination** `optional string`\
Longitude and latitude this text posted.

**place\_type** `optional string`\
Type of place this text posted.

**place\_full\_name** `optional string`\
Name of place this text posted.

**place\_country\_code** `optional string`\
Shortened country code this text posted.

**place\_country\_name** `optional string`\
Country this text posted.

**place\_id** `optional string`\
Place ID this text posted.

**share\_count** `optional string`\
This posting share count.

**like\_count** `optional string`\
This posting like count.

**angry\_count** `optional string`\
This posting angry count.

**laugh\_count** `optional string`\
This posting laugh count.

**love\_count** `optional string`\
This posting love count.

**sad\_count** `optional string`\
This posting sad count.

**support\_count** `optional string`\
This posting support count.

**wow\_count** `optional string`\
This posting wow count.

**appreciation\_count** `optional string`\
This posting appreciation count.

**empathy\_count** `optional string`\
This posting empathy count.

**interest\_count** `optional string`\
This posting interest count.

**maybe\_count** `optional string`\
This posting maybe count.

**share\_count** `optional string`\
This posting share count.

**praise\_count** `optional string`\
This posting praise count.

**digg\_count** `optional string`\
This posting digg count.

**reaction\_total\_count** `optional string`\
This posting total reaction count.

**video\_play\_count** `optional string`\
This posting video play count.

**video\_view\_count** `optional string`\
This posting video view count.

**view\_count** `optional string`\
This posting view count.

**share\_with\_comment\_count** `optional string`\
This posting share with comment count.

**author\_id** `optional string`\
This posting author ID.

**author\_username** `optional string`\
This posting author username.

**author\_type** `optional string`\
This posting author type.

**author\_name** `optional string`\
This posting author name.

**more\_info** `optional hash`\
This posting additional info.

## Create an export

Creates and places new export into queue. To check the status of an export, use [show](#retrieve-an-export) route.

### Request

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

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

{% endtab %}
{% endtabs %}

#### **Payload**

**insight\_search\_ids** `array of integers`\
List of insight searches IDs involved in this export.\
\
**start\_date** `string`\
A cursor for use in pagination. Dataset that is created after this date is exported.

**end\_date** `string`\
A cursor for use in pagination. Dataset that is created before this date is exported.

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

```javascript
{
    "insight_search_ids": [1,2,3],
    "start_date": "2022-12-01",
    "end_date": "2022-12-31"
}
```

{% endtab %}
{% endtabs %}

#### Example

```bash
curl -i -X POST 'https://product-api.redflagai.co/api/v2/products/insight/exports' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {{JWT_TOKEN}}' \
-d '{
    "insight_search_ids": [1,2,3],
    "start_date": "2022-12-01",
    "end_date": "2022-12-31"
}'
```

### Response

The export ID. To be used when [retrieving export](#retrieve-an-export).

```bash
{
    "id": 1
}
```

## Retrieve an export

Retrieves the export with given export ID.

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

```erlang
[GET] /api/v2/products/insight/exports/:id
```

{% endtab %}
{% endtabs %}

#### Example

```bash
curl -i -X GET 'https://product-api.redflagai.co/api/v2/products/insight/exports/1' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {{JWT_TOKEN}}'
```

### Response

The [export](#the-export-object) object.


---

# 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/export.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.
