> For the complete documentation index, see [llms.txt](https://growingio.gitbook.io/v3/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://growingio.gitbook.io/v3/developer-manual/api-reference/statistics-api/definition/get-retention.md).

# 获取留存分析数据

## URL

<https://www.growingio.com/v2/projects/{project_uid}/retentions/{retention_id}.json>

## 请求类型

GET

## 请求头参数

公共头部请参考[公共请求头参数](/v3/developer-manual/api-reference/authenticate.md)。

## 参数说明与示例

{% tabs %}
{% tab title="请求参数" %}

| 路径参数          | 类型     | 是否必传 | 说明        |
| ------------- | ------ | ---- | --------- |
| retention\_id | string | 是    | 留存分析单图ID。 |
| project\_uid  | string | 是    | 项目UID。    |

| 查询参数 | 类型 | 是否必传 | 说明 |
| ---- | -- | ---- | -- |

| range | string | 否 | <p>事件范围。</p><ul><li>day（日留存）</li><li>week（周留存）</li><li>month（月留存）</li></ul> |
| ----- | ------ | - | --------------------------------------------------------------------------- |

| startTime | integer | 否 | <p>数据起始时间，unix毫秒时间戳。</p><p>需与endTime一起使用。</p> |
| --------- | ------- | - | --------------------------------------------- |

| endTime      | integer | 否 | <p>数据结束时间，unix毫秒时间戳。</p><p>需与startTime一起使用。</p> |
| ------------ | ------- | - | ----------------------------------------------- |
| {% endtab %} |         |   |                                                 |

{% tab title="响应示例" %}
200：OK

```
{
    "id":  "Retention Uid",
    "name":  "Retention Name",
    "range":  "day",
    "startTime":  1569686400000,
    "endTime":  1572278399999,
    "interval":  86400000,
    "meta":  [
        {"name":"目标用户","dimension":true},
        {"name":"对比值","dimension":true},
        {"name":"用户行为","dimension":true},
        {"name":"时间","dimension":true},
        {"name":"留存人数","metric":true},
        {"name":"当日","metric":true},
        {"name":"当日留存率","metric":true},
        {"name":"次日","metric":true},
        {"name":"次日留存率","metric":true},
        {"name":"2日后","metric":true},
        {"name":"2日后留存率","metric":true},
        . . .
        {"name":"29日后","metric":true},
        {"name":"29日后留存率","metric":true}
    ],
    "data":  [
        [目标用户,对比值,用户行为,时间,留存,...,29日后留存],
        . . .,
        [目标用户,对比值,用户行为,时间,留存,...,29日后留存]
    ]
}
```

{% endtab %}
{% endtabs %}
