# Query data subscription list

Lists the data subscriptions received by the current workspace.

```text
GET https://moi.matrixorigin.cn/newmoi/data-share/subscriptions
```

## Preparation before calling

Prepare a personal access token and target workspace ID that has access to the target workspace.

The example below uses:

- `$AI_STUDIO_API_KEY`: The actual personal access token, passed through the `X-API-Key` Header.
- `$WORKSPACE_ID`: The workspace ID to be queried is passed through the `X-Workspace-ID` Header.

## Request example

```bash
curl "https://moi.matrixorigin.cn/newmoi/data-share/subscriptions?page=1&page_size=20" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"
```

## Query parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `keyword` | string | No | Search by keyword. |
| `status` | string | No | Filter by subscription status. |
| `page` | integer | No | Page number; default `1`. |
| `page_size` | integer | No | Number per page; default `20`, maximum `100`. |

## Successful response

Returns `200` on success. `data.list` is the current page and `data.total` is the total number of matches.

```json
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "list": [
      {
        "id": "201",
        "pub_name": "sales-share",
        "source_database_id": "101",
        "mo_database_name": "sales",
        "table_scope": {
          "mode": "selected",
          "object_ids": ["1001"]
        },
        "target_database_id": "",
        "obj_display_name": "sales",
        "obj_display_path": "catalog/sales",
        "source_workspace_id": "ws-001",
        "source_workspace_name": "数据工作区",
        "publisher": "user-001",
        "published_at": "2026-08-18T10:00:00Z",
        "status": "unsubscribed",
        "sub_name": "",
        "subscribed_by": "",
        "created_at": "2026-08-18T10:00:00Z"
      }
    ],
    "total": 1,
    "page": 1,
    "page_size": 20
  }
}
```

The response fields are as follows.

| Field | Type | Description |
| --- | --- | --- |
| `code` | string | `OK` on success. |
| `msg` | string | `OK` on success. |
| `data.list` | object[] | Current page subscription list; empty array when there is no result. |
| `data.total` | integer | The total number of matches. |
| `data.page` | integer | Current page number. |
| `data.page_size` | integer | Number per page. |
| `data.list[].id` | string | Subscription ID. |
| `data.list[].pub_name` | string | Source publication name. |
| `data.list[].source_database_id` | string | Source database ID. |
| `data.list[].mo_database_name` | string | Source database name. |
| `data.list[].table_scope` | object | Publish shared table range. |
| `data.list[].table_scope.mode` | string | Range mode: `all` or `selected`. |
| `data.list[].table_scope.object_ids` | string[] | List of table IDs when the range mode is `selected`. |
| `data.list[].target_database_id` | string | ID of the subscription database in the target workspace; empty string if not accepted. |
| `data.list[].obj_display_name` | string | The display name of the source database. |
| `data.list[].obj_display_path` | string | The display path of the source database. |
| `data.list[].source_workspace_id` | string | Source workspace ID. |
| `data.list[].source_workspace_name` | string | Source workspace name; returned if there is a value. |
| `data.list[].publisher` | string | Publisher. |
| `data.list[].published_at` | string | Release time. |
| `data.list[].status` | string | Current subscription status. |
| `data.list[].sub_name` | string | The name of the subscription database in the target workspace; empty string if not accepted. |
| `data.list[].subscribed_by` | string | Identity to accept subscription; empty string if not accepted. |
| `data.list[].created_at` | string | The time when the subscription was accepted; an empty string if not accepted. |

In this document, `[]` after a type means an array; for example, `object[]` is an array of objects. In field paths, `[]` means each item in an array; for example, `data.list[].id` is the `id` field of each item in `data.list`.

## Error response

```json
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效",
  "data": null
}
```

### Common HTTP errors

```{list-table}
:header-rows: 1
:widths: 12 22 32 34

* - HTTP status code
  - error code
  - Common causes
  - Recommended actions
* - `400`
  - `ErrParamInvalid`
  - Pagination or filtering parameters cannot be parsed.
  - Check `page`, `page_size`, `status` and `keyword`.
* - `403`
  - `ErrPermissionDenied`
  - The current identity does not have permission to read the subscription.
  - Request to grant read permission to the data subscription.
* - `503`
  - `ErrServiceUnavailable`
  - Dependent services are temporarily unavailable.
  - Try again later.
* - `500`
  - `ErrServer`
  - The server failed to read the subscription list.
  - Try again later.
```

## Follow-up operations

Use `data.list[].id` [Accept data subscription](accept-subscription.md).
