> For the complete documentation index, see [llms.txt](https://docs.ylytic.com/ylytic/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ylytic.com/ylytic/rest-apis/api-overview/data-refresh-api.md).

# Data Refresh API

## POST – Create Data Refresh Request

This API is used for refreshing the existing data of the creator.

```
curl --location 'https://dashboard.ylytic.com/ylytic/api/v1/data_refresh/requests' \
--header 'Authorization: Bearer {{auth_header}}' \
--data '{
    "request_type":"instagram",
    "handle":"thetatvaindia"
}'
```

### payload

There are multiple combinations possible which are described below.

<table><thead><tr><th width="205">Value of "request_type"</th><th width="192">second parameter name</th><th>SAMPLE DATA</th></tr></thead><tbody><tr><td>instagram</td><td>handle</td><td><p>{</p><p>'request_type':'instagram',</p><p>'handle':'thetatvaindia'</p><p>}</p></td></tr><tr><td>instagram_id</td><td>ig_user_id</td><td><p>{</p><p>'request_type':'instagram_id',</p><p>'ig_user_id':'2121125346'</p><p>}</p></td></tr><tr><td>instagram_post</td><td>shortcode</td><td><p>{</p><p>'request_type':'instagram_post',</p><p>'shortcode':'DHGIoX0y3f3'</p><p>}</p></td></tr><tr><td>youtube</td><td>channel_id</td><td><p>{</p><p>'request_type':'youtube',</p><p>'channel_id':'UCurYxozQbvKn-oNUxNJh45Q'</p><p>}</p></td></tr><tr><td>youtube_post</td><td>video_id</td><td><p>{</p><p>'request_type':'youtube_post',</p><p>'video_id':'iwIeyWv2ABI'</p><p>}</p></td></tr></tbody></table>

<details>

<summary>Output (JSON)</summary>

```json
{
    "request_id": "65b87c8576c9b42b3a285805",
    "request": {
        "request_type": "instagram",
        "handle": "thetatvaindia"
    },
    "response": null,
    "status": {
        "code": 201,
        "message": "pending",
        "request_at": "Tue, 30 Jan 2024 04:35:17 GMT",
        "response_at": null
    }
}
```

</details>

## GET – Get Data Refresh Request

```
curl --location --request GET 'https://dashboard.ylytic.com/ylytic/api/v1/data_refresh/requests/{request_id}' \
--header 'Authorization: Bearer {{auth header}}'
```

<details>

<summary>Output (JSON)</summary>

```json
{
    "request": {
        "handle": "handle_name",
        "request_type": "instagram"
},
    "request_id": "request_identifier",
    "response": {
        "growth_trends": {
            "engagement_trends": [
                {
                        "2023-12-01": {
                            "followers": 0.8
                        }
                },
                {
                        "2023-12-04": {
                            "followers": 0.7
                        }
                },
                {
                        "2023-12-06": {
                            "followers": 1.1
                        }
                }
            ],
            "followers_trends": [
                {
                        "2023-12-01": {
                            "followers": 750
                        }
                },
                {
                        "2023-12-04": {
                            "followers": 800
                        }
                },
                {
                        "2023-12-06": {
                            "followers": 1000
                        }
                }
            ],
            "monthly_engagement_growth": 0.54,
            "monthly_followers_growth": 0.07,
            "quaterly_engagement_growth": 0.69,
            "quaterly_followers_growth": -0.07,
            "yearly_engagement_growth": 0.42,
            "yearly_followers_growth": -3.23
        },
        "posts": {
            "non_video_posts": [
                {
                        "caption": "asdas",
                        "comments_count": 1,
                        "engagement": 1.01,
                        "external_links": [
                            "https://asdas.com"
                        ],
                        "hashtags": [
                            "#adsasd"
                        ],
                        "likes_count": 10,
                        "posted_date": "2023-12-03",
                        "raw_image_url":                           "https://instagram.com/images/askdnanla",
                        "shortcode": "asda",
                        "sponsored": false
                }
            ],
            "video_posts": [
                {
                        "caption": "hello world",
                        "comments_count": 12,
                        "engagement": 1.2,
                        "external_links": [
                                "https://asdas.com"
                        ],
                        "hashtags": [
                                "#worth",
                                "#ad"
                        ],
                        "likes_count": 24,
                        "posted_date": "2023-12-03",
                        "raw_image_url": "https://instagram.com/images/askdnanla",
                        "shortcode": "asdasd",
                        "sponsored": true,
                        "views": 123
                }
           ]
        },
        "profile_details": {
                "biography": "Co-Founder of Ylytic",
                "brand_mentions": [
                "@oi"
                ],
                "category": "Business & Entrepreneurship",
                "city": "Pune",
                "country": "India",
                "email": "anurag@ylytic.com",
                "external_links": [
                "https://www.ylytic.com"
                ],
                "full_name": "Anurag Gupta",
                "hashtags": [
                "#growwithylytic"
                ],
                "ig_category": "Business",
                "mentions": [
                "@mradulsharna"
                ],
                "mobile": "9028055113",
                "raw_image_url": "https://instagram.com/images/askdnanla"
        },
        "profile_overview": {
                "content_per_week": 1.2,
                "engagement": 1.1,
                "followers_count": 10001,
                "following_count": 200,
                "handle": "anurag.itbhu05",
                "ig_user_id": "123456",
                "influencer_tier": "nano",
                "post_count": 10
        },
        "reach_and_engagement_details": {}
        },
        "status": {
                "code": 200,
                "message": "success",
                "request_at": "Wed, 06 Dec 2023 06:09:37 GMT",
                "response_at": "Wed, 06 Dec 2023 06:09:47 GMT"
        }
}
```

</details>
