Skip to content

Client (V2)#

This reference documentation provides a comprehensive overview of all V2 endpoint methods available in the client. To see the V1 methods, please refer to the Client (V1) reference docs.

Unofficial API

This client accesses an unofficial TickTick API. It was created by reverse engineering the API. It may be incomplete or inaccurate. Use at your own risk.

pyticktick.client.Client #

Bases: Settings

Client class for TickTick API.

The client class provides methods to interact with both the V1 and V2 API endpoints. This can be used to get, create, update, and delete, projects, tasks, tags, and other objects in the TickTick application.

Authenticating the client

The client class requires the user to be authenticated. The user must login to the V1 and/or V2 API endpoints before using the client class:

from pyticktick import Client

client = Client(
    v1_client_id="client_id",
    v1_client_secret="client_secret",
    v1_token={
        "value": "fa371b10-8b95-442b-b4a5-11a9959d3590",
        "expiration": 1701701789,
    },
    v2_username="username",
    v2_password="password",
)
To see more details on how to authenticate, refer to pyticktick.Settings. The client class inherits the Settings class, so all the setting configurations will be available in the client class.

Methods:

Name Description
get_batch_v2

Get all active objects for the current user from the V2 API.

get_project_all_closed_v2

Get all completed or abandoned tasks from the V2 API.

post_project_v2

Create, update, or delete projects in bulk against the V2 API.

post_task_v2

Create, update, or delete tasks in bulk against the V2 API.

post_project_group_v2

Create, update, or delete project groups in bulk against the V2 API.

post_task_parent_v2

Set or unset a task parent in bulk against the V2 API.

post_tag_v2

Create or update tags in bulk against the V2 API.

put_rename_tag_v2

Rename a tag in the V2 API.

delete_tag_v2

Delete a tag in the V2 API.

get_profile_v2

Get the user profile from the V2 API.

get_status_v2

Get the user status from the V2 API.

get_statistics_v2

Get user statistics from the V2 API.

get_batch_v2 #

get_batch_v2() -> GetBatchV2

Get all active objects for the current user from the V2 API.

This method gets the status of all objects for the current user from the GET /batch/check/0 V2 endpoint. This endpoint provides information about the status of all active objects, including projects, tasks, etc. The structure of the response is a little confusing. It seems like it was designed to be used as an Entity Bean, making it easy to sync back to TickTick.

Example
from pyticktick import Client

client = Client()
batch = client.get_batch_v2()
print(batch.model_dump())

will output:

{
    "inbox_id": "inbox213928392",
    "project_groups": [...],
    "project_profiles": [...],
    "sync_task_bean": {
        "update": [...],
        "add": [],
        "delete": [],
        "empty": false,
        "tag_update": []
    },
    "tags": [...],
    "check_point": 2658743443697,
    "checks": null,
    "filters": [...],
    "sync_order_bean": {
        "orderByType": {}
    },
    "sync_order_bean_v3": {
        "order_by_type": {
        "taskBy#dueDate|20250224_dueDate": {
            "all": {
            "changed": [...],
            "deleted": []
            }
        },
        "taskBy#dueDate|20250109_dueDate": {
            "all": {
            "changed": [],
            "deleted": [...]
            }
        }
        }
    },
    "sync_task_order_bean": {
        "task_order_by_date": {},
        "task_order_by_priority": {},
        "task_order_by_project": {}
    },
    "remind_changes": []
}
This response is so large, that it was trimmed down significantly. Anywhere you see ..., it means there should have been more data.

Returns:

Name Type Description
GetBatchV2 GetBatchV2

The batch object retrieved from the API.

Source code in src/pyticktick/client.py
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
def get_batch_v2(self) -> GetBatchV2:
    """Get all active objects for the current user from the V2 API.

    This method gets the status of all objects for the current user from the
    `GET /batch/check/0` V2 endpoint. This endpoint provides information about
    the status of all active objects, including projects, tasks, etc. The structure
    of the response is a little confusing. It seems like it was designed to be used
    as an [Entity Bean](https://en.wikipedia.org/wiki/Entity_Bean),
    making it easy to sync back to TickTick.

    ??? example "Example"
        ```python hl_lines="4"
        from pyticktick import Client

        client = Client()
        batch = client.get_batch_v2()
        print(batch.model_dump())
        ```

        will output:
        ```json
        {
            "inbox_id": "inbox213928392",
            "project_groups": [...],
            "project_profiles": [...],
            "sync_task_bean": {
                "update": [...],
                "add": [],
                "delete": [],
                "empty": false,
                "tag_update": []
            },
            "tags": [...],
            "check_point": 2658743443697,
            "checks": null,
            "filters": [...],
            "sync_order_bean": {
                "orderByType": {}
            },
            "sync_order_bean_v3": {
                "order_by_type": {
                "taskBy#dueDate|20250224_dueDate": {
                    "all": {
                    "changed": [...],
                    "deleted": []
                    }
                },
                "taskBy#dueDate|20250109_dueDate": {
                    "all": {
                    "changed": [],
                    "deleted": [...]
                    }
                }
                }
            },
            "sync_task_order_bean": {
                "task_order_by_date": {},
                "task_order_by_priority": {},
                "task_order_by_project": {}
            },
            "remind_changes": []
        }
        ```
        This response is so large, that it was trimmed down significantly. Anywhere
        you see `...`, it means there should have been more data.

    Returns:
        GetBatchV2: The batch object retrieved from the API.
    """
    resp = self._get_api_v2("/batch/check/0")
    if self.override_forbid_extra:
        update_model_config(GetBatchV2, extra="allow")
    return GetBatchV2.model_validate(resp)

get_project_all_closed_v2 #

get_project_all_closed_v2(
    data: Union[GetClosedV2, dict[str, Any]],
) -> ClosedRespV2

Get all completed or abandoned tasks from the V2 API.

This method gets all completed or abandoned tasks from the GET /project/all/closed V2 endpoint. Abandoned tasks are referred to as won't do tasks by TickTick. They have some documentation on them here.

Get all completed tasks
from pyticktick import Client
from pyticktick.models.v2 import GetClosedV2

client = Client()
resp = client.get_project_all_closed_v2(GetClosedV2(status="Completed"))

print(resp.model_dump())

will output:

[
    {
        "child_ids": null,
        "completed_time": "2020-04-25T15:25:22Z",
        "content": "",
        "created_time": "2020-03-23T15:02:17Z",
        "desc": "",
        "due_date": "2020-04-22T05:00:00Z",
        "etag": "czt0y615",
        "id": "680be962126b914e0ff59951",
        "is_all_day": true,
        "is_floating": false,
        "items": [],
        "kind": "TEXT",
        "modified_time": "2025-04-15T15:15:35Z",
        "parent_id": null,
        "priority": 0,
        "progress": 0,
        "project_id": "inbox213928392",
        "repeat_from": 2,
        "reminder": null,
        "reminders": [],
        "repeat_flag": null,
        "repeat_task_id": "67e022795985d10fd77abff8",
        "start_date": "2020-04-21T05:00:00Z",
        "status": 2,
        "tags": [...],
        "title": "Completed task",
        "time_zone": "America/New_York",
        "attachments": [],
        "annoying_alert": null,
        "column_id": null,
        "comment_count": 0,
        "completed_user_id": 213928392,
        "creator": 213928392,
        "sort_order": -6917533425701748736
    },
    ...
]
You will notice that the status field is set to 2 for completed tasks.

Get all abandoned tasks
from pyticktick import Client
from pyticktick.models.v2 import GetClosedV2

client = Client()
resp = client.get_project_all_closed_v2(GetClosedV2(status="Abandoned"))

print(resp.model_dump())

will output:

[
    {
        "child_ids": null,
        "completed_time": "2025-04-15T15:15:35Z",
        "content": "",
        "created_time": "2025-03-23T15:02:17Z",
        "desc": "",
        "due_date": "2025-04-15T05:00:00Z",
        "etag": "xkpljy8f",
        "id": "67fe78173624110bff1cb96a",
        "is_all_day": true,
        "is_floating": false,
        "items": [],
        "kind": "TEXT",
        "modified_time": "2025-04-08T15:00:26Z",
        "parent_id": null,
        "priority": 0,
        "progress": 0,
        "project_id": "676c6de2c447d18b6d0a8bac",
        "repeat_from": 2,
        "reminder": null,
        "reminders": [],
        "repeat_flag": null,
        "repeat_task_id": "67e022795985d10fd77abff8",
        "start_date": "2025-04-15T05:00:00Z",
        "status": -1,
        "tags": ["family"],
        "title": "☎️ Call Mom",
        "time_zone": "America/Chicago",
        "attachments": [],
        "annoying_alert": null,
        "column_id": null,
        "comment_count": 0,
        "completed_user_id": 125986193,
        "creator": 125986193,
        "sort_order": -6917533425701748736
    }
]
You will notice that the status field is set to -1 for abandoned tasks.

Parameters:

Name Type Description Default
data Union[GetClosedV2, dict[str, Any]]

Data to get the completed / abandoned tasks.

required

Returns:

Name Type Description
ClosedRespV2 ClosedRespV2

The completed / abandoned tasks object retrieved from the API.

Source code in src/pyticktick/client.py
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
def get_project_all_closed_v2(
    self,
    data: Union[GetClosedV2, dict[str, Any]],
) -> ClosedRespV2:
    """Get all completed or abandoned tasks from the V2 API.

    This method gets all completed or abandoned tasks from the
    `GET /project/all/closed` V2 endpoint. Abandoned tasks are referred to as
    _won't do_ tasks by TickTick. They have some documentation on them [here](https://help.ticktick.com/articles/7055782408586526720#won't-do).

    ??? example "Get all completed tasks"
        ```python hl_lines="4"
        from pyticktick import Client
        from pyticktick.models.v2 import GetClosedV2

        client = Client()
        resp = client.get_project_all_closed_v2(GetClosedV2(status="Completed"))

        print(resp.model_dump())
        ```

        will output:
        ```json
        [
            {
                "child_ids": null,
                "completed_time": "2020-04-25T15:25:22Z",
                "content": "",
                "created_time": "2020-03-23T15:02:17Z",
                "desc": "",
                "due_date": "2020-04-22T05:00:00Z",
                "etag": "czt0y615",
                "id": "680be962126b914e0ff59951",
                "is_all_day": true,
                "is_floating": false,
                "items": [],
                "kind": "TEXT",
                "modified_time": "2025-04-15T15:15:35Z",
                "parent_id": null,
                "priority": 0,
                "progress": 0,
                "project_id": "inbox213928392",
                "repeat_from": 2,
                "reminder": null,
                "reminders": [],
                "repeat_flag": null,
                "repeat_task_id": "67e022795985d10fd77abff8",
                "start_date": "2020-04-21T05:00:00Z",
                "status": 2,
                "tags": [...],
                "title": "Completed task",
                "time_zone": "America/New_York",
                "attachments": [],
                "annoying_alert": null,
                "column_id": null,
                "comment_count": 0,
                "completed_user_id": 213928392,
                "creator": 213928392,
                "sort_order": -6917533425701748736
            },
            ...
        ]
        ```
        You will notice that the `status` field is set to `2` for completed tasks.

    ??? example "Get all abandoned tasks"
        ```python hl_lines="4"
        from pyticktick import Client
        from pyticktick.models.v2 import GetClosedV2

        client = Client()
        resp = client.get_project_all_closed_v2(GetClosedV2(status="Abandoned"))

        print(resp.model_dump())
        ```

        will output:
        ```json
        [
            {
                "child_ids": null,
                "completed_time": "2025-04-15T15:15:35Z",
                "content": "",
                "created_time": "2025-03-23T15:02:17Z",
                "desc": "",
                "due_date": "2025-04-15T05:00:00Z",
                "etag": "xkpljy8f",
                "id": "67fe78173624110bff1cb96a",
                "is_all_day": true,
                "is_floating": false,
                "items": [],
                "kind": "TEXT",
                "modified_time": "2025-04-08T15:00:26Z",
                "parent_id": null,
                "priority": 0,
                "progress": 0,
                "project_id": "676c6de2c447d18b6d0a8bac",
                "repeat_from": 2,
                "reminder": null,
                "reminders": [],
                "repeat_flag": null,
                "repeat_task_id": "67e022795985d10fd77abff8",
                "start_date": "2025-04-15T05:00:00Z",
                "status": -1,
                "tags": ["family"],
                "title": "\u260e\ufe0f Call Mom",
                "time_zone": "America/Chicago",
                "attachments": [],
                "annoying_alert": null,
                "column_id": null,
                "comment_count": 0,
                "completed_user_id": 125986193,
                "creator": 125986193,
                "sort_order": -6917533425701748736
            }
        ]
        ```
        You will notice that the `status` field is set to `-1` for abandoned tasks.

    Args:
        data (Union[GetClosedV2, dict[str, Any]]): Data to get the completed /
            abandoned tasks.

    Returns:
        ClosedRespV2: The completed / abandoned tasks object retrieved from the API.

    """
    if isinstance(data, dict):
        data = GetClosedV2.model_validate(data)
    resp = self._get_api_v2("/project/all/closed", data=self._model_dump(data))
    if self.override_forbid_extra:
        update_model_config(ClosedRespV2, extra="allow")
    return ClosedRespV2.model_validate(resp)

post_project_v2 #

post_project_v2(
    data: Union[PostBatchProjectV2, dict[str, Any]],
) -> BatchRespV2

Create, update, or delete projects in bulk against the V2 API.

This method creates, updates, and deletes projects in bulk using the POST /batch/project V2 endpoint. TickTick refers to these as lists, and you can read more with this guide.

Add a project
from pyticktick import Client
from pyticktick.models.v2 import PostBatchProjectV2, CreateProjectV2

client = Client()
resp = client.post_project_v2(
    data=PostBatchProjectV2(
        add=[
            CreateProjectV2(
                name="test_project",
                group_id="680be2008f08b6b4618a3c89",
                color="blue",
                view_mode="list",
            ),
        ],
    ),
)
print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {
        "680bab7c8f08b6b4618b657d": "8j9rd7ug"
    }
}

Update a project
from pyticktick import Client
from pyticktick.models.v2 import PostBatchProjectV2, UpdateProjectV2

client = Client()
resp = client.post_project_v2(
    data=PostBatchProjectV2(
        update=[
            UpdateProjectV2(
                id="680bab7c8f08b6b4618b657d",
                name="test_project_renamed",
                color="red",
            ),
        ],
    ),
)
print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {
        "680bab7c8f08b6b4618b657d": "2a5jlehm"
    }
}

Delete a project
from pyticktick import Client
from pyticktick.models.v2 import PostBatchProjectV2

client = Client()
resp = client.post_project_v2(
    data=PostBatchProjectV2(delete=["680bab7c8f08b6b4618b657d"]),
)
print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {}
}

Parameters:

Name Type Description Default
data Union[PostBatchProjectV2, dict[str, Any]]

Data to create, update, or delete projects.

required

Returns:

Name Type Description
BatchRespV2 BatchRespV2

The response object containing the status of the batch operation.

Source code in src/pyticktick/client.py
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
def post_project_v2(
    self,
    data: Union[PostBatchProjectV2, dict[str, Any]],
) -> BatchRespV2:
    """Create, update, or delete projects in bulk against the V2 API.

    This method creates, updates, and deletes projects in bulk using the
    `POST /batch/project` V2 endpoint. TickTick refers to these as lists, and you
    can read more with [this guide](https://help.ticktick.com/articles/7055782283059396608).

    ??? example "Add a project"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import PostBatchProjectV2, CreateProjectV2

        client = Client()
        resp = client.post_project_v2(
            data=PostBatchProjectV2(
                add=[
                    CreateProjectV2(
                        name="test_project",
                        group_id="680be2008f08b6b4618a3c89",
                        color="blue",
                        view_mode="list",
                    ),
                ],
            ),
        )
        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {
                "680bab7c8f08b6b4618b657d": "8j9rd7ug"
            }
        }
        ```

    ??? example "Update a project"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import PostBatchProjectV2, UpdateProjectV2

        client = Client()
        resp = client.post_project_v2(
            data=PostBatchProjectV2(
                update=[
                    UpdateProjectV2(
                        id="680bab7c8f08b6b4618b657d",
                        name="test_project_renamed",
                        color="red",
                    ),
                ],
            ),
        )
        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {
                "680bab7c8f08b6b4618b657d": "2a5jlehm"
            }
        }
        ```

    ??? example "Delete a project"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import PostBatchProjectV2

        client = Client()
        resp = client.post_project_v2(
            data=PostBatchProjectV2(delete=["680bab7c8f08b6b4618b657d"]),
        )
        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {}
        }
        ```

    Args:
        data (Union[PostBatchProjectV2, dict[str, Any]]): Data to create, update,
            or delete projects.

    Returns:
        BatchRespV2: The response object containing the status of the batch
            operation.
    """
    if isinstance(data, dict):
        data = PostBatchProjectV2.model_validate(data)
    resp = self._post_api_v2("/batch/project", data=self._model_dump(data))
    if self.override_forbid_extra:
        update_model_config(BatchRespV2, extra="allow")
    return BatchRespV2.model_validate(resp)

post_task_v2 #

post_task_v2(
    data: Union[PostBatchTaskV2, dict[str, Any]],
) -> BatchRespV2

Create, update, or delete tasks in bulk against the V2 API.

This method creates, updates, and deletes tasks in bulk using the POST /batch/task V2 endpoint. TickTick has a handful of guides on how to use tasks, which you can find here.

The degree of configuration is quite high for tasks, so the examples below show just a limited number of fields to configure. The full list of fields can be found in the PostBatchTaskV2 model.

Add a task
from pyticktick import Client
from pyticktick.models.v2 import PostBatchTaskV2, CreateTaskV2

client = Client()
resp = client.post_task_v2(
    data=PostBatchTaskV2(
        add=[
            CreateTaskV2(
                title="test task",
                project_id="681180d78f08af4931b657e8",
                desc="test description",
                is_all_day=False,
                start_date="2023-01-01T00:00:00Z",
                due_date="2023-01-03T00:00:00Z",
                time_zone="America/New_York",
                repeat_flag="RRULE:FREQ=DAILY;INTERVAL=1",
                priority=1,
                items=[CreateItemV2(title="test item", status=0)],
                kind="CHECKLIST",
                status=0,
            ),
        ],
    ),
)

print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {
        "6812d7d68f081558b9bfdb6b": "0gntz779"
    }
}

Update a task
from pyticktick import Client
from pyticktick.models.v2 import PostBatchTaskV2, UpdateTaskV2

client = Client()
resp = client.post_task_v2(
    data=PostBatchTaskV2(
        update=[
            UpdateTaskV2(
                id="6812d7d68f081558b9bfdb6b",
                title="test task updated",
                project_id="681180d78f08af4931b657e8",
                content="test description is now content",
                due_date="2023-01-03T00:00:00Z",
                repeat_flag="RRULE:FREQ=WEEKLY;INTERVAL=1",
                kind="TEXT",
            ),
        ],
    ),
)

print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {
        "6812d7d68f081558b9bfdb6b": "0r7p6no6"
    }
}

Delete a task
from pyticktick import Client
from pyticktick.models.v2 import PostBatchTaskV2, DeleteTaskV2

client = Client()
resp = client.post_task_v2(
    data=PostBatchTaskV2(
        delete=[
            DeleteTaskV2(
                task_id="6812d7d68f081558b9bfdb6b",
                project_id="681180d78f08af4931b657e8",
            ),
        ],
    ),
)
print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {}
}

Parameters:

Name Type Description Default
data Union[PostBatchTaskV2, dict[str, Any]]

Data to create, update, or delete tasks.

required

Returns:

Name Type Description
BatchRespV2 BatchRespV2

The response object containing the status of the batch operation.

Source code in src/pyticktick/client.py
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
def post_task_v2(self, data: Union[PostBatchTaskV2, dict[str, Any]]) -> BatchRespV2:
    """Create, update, or delete tasks in bulk against the V2 API.

    This method creates, updates, and deletes tasks in bulk using the
    `POST /batch/task` V2 endpoint. TickTick has a handful of guides on how to use
    tasks, which you can find [here](https://help.ticktick.com/articles/7055782436621254656).

    The degree of configuration is quite high for tasks, so the examples below show
    just a limited number of fields to configure. The full list of fields can be
    found in the `PostBatchTaskV2` model.

    ??? example "Add a task"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import PostBatchTaskV2, CreateTaskV2

        client = Client()
        resp = client.post_task_v2(
            data=PostBatchTaskV2(
                add=[
                    CreateTaskV2(
                        title="test task",
                        project_id="681180d78f08af4931b657e8",
                        desc="test description",
                        is_all_day=False,
                        start_date="2023-01-01T00:00:00Z",
                        due_date="2023-01-03T00:00:00Z",
                        time_zone="America/New_York",
                        repeat_flag="RRULE:FREQ=DAILY;INTERVAL=1",
                        priority=1,
                        items=[CreateItemV2(title="test item", status=0)],
                        kind="CHECKLIST",
                        status=0,
                    ),
                ],
            ),
        )

        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {
                "6812d7d68f081558b9bfdb6b": "0gntz779"
            }
        }
        ```

    ??? example "Update a task"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import PostBatchTaskV2, UpdateTaskV2

        client = Client()
        resp = client.post_task_v2(
            data=PostBatchTaskV2(
                update=[
                    UpdateTaskV2(
                        id="6812d7d68f081558b9bfdb6b",
                        title="test task updated",
                        project_id="681180d78f08af4931b657e8",
                        content="test description is now content",
                        due_date="2023-01-03T00:00:00Z",
                        repeat_flag="RRULE:FREQ=WEEKLY;INTERVAL=1",
                        kind="TEXT",
                    ),
                ],
            ),
        )

        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {
                "6812d7d68f081558b9bfdb6b": "0r7p6no6"
            }
        }
        ```

    ??? example "Delete a task"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import PostBatchTaskV2, DeleteTaskV2

        client = Client()
        resp = client.post_task_v2(
            data=PostBatchTaskV2(
                delete=[
                    DeleteTaskV2(
                        task_id="6812d7d68f081558b9bfdb6b",
                        project_id="681180d78f08af4931b657e8",
                    ),
                ],
            ),
        )
        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {}
        }
        ```

    Args:
        data (Union[PostBatchTaskV2, dict[str, Any]]): Data to create, update,
            or delete tasks.

    Returns:
        BatchRespV2: The response object containing the status of the batch
            operation.
    """
    if isinstance(data, dict):
        data = PostBatchTaskV2.model_validate(data)
    resp = self._post_api_v2("/batch/task", data=self._model_dump(data))
    if self.override_forbid_extra:
        update_model_config(BatchRespV2, extra="allow")
    return BatchRespV2.model_validate(resp)

post_project_group_v2 #

post_project_group_v2(
    data: Union[PostBatchProjectGroupV2, dict[str, Any]],
) -> BatchRespV2

Create, update, or delete project groups in bulk against the V2 API.

The method creates, updates, and deletes project groups in bulk using the POST /batch/projectGroup V2 endpoint. This used to create what TickTick calls folders. They have a small guide on them if you want to learn more.

Add a project group
from pyticktick import Client
from pyticktick.models.v2 import (
    PostBatchProjectGroupV2,
    CreateProjectGroupV2,
)

client = Client()
resp = client.post_project_group_v2(
    data=PostBatchProjectGroupV2(
        add=[CreateProjectGroupV2(name="test_group")],
    )
)
print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {
        "680be2008f08b6b4618a3c89": "znr6783z"
    }
}

Update a project group
from pyticktick import Client
from pyticktick.models.v2 import (
    PostBatchProjectGroupV2,
    UpdateProjectGroupV2,
)

client = Client()
resp = client.post_project_group_v2(
    data=PostBatchProjectGroupV2(
        update=[
            UpdateProjectGroupV2(
                name="test_group_renamed",
                id="680be2008f08b6b4618a3c89",
            ),
        ],
    ),
)
print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {
        "680be2008f08b6b4618a3c89": "2qoky0fw"
    }
}

Delete a project group
from pyticktick import Client
from pyticktick.models.v2 import PostBatchProjectGroupV2

client = Client()
resp = client.post_project_group_v2(
    data=PostBatchProjectGroupV2(delete=["680be2008f08b6b4618a3c89"]),
)
print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {}
}

Parameters:

Name Type Description Default
data Union[PostBatchProjectGroupV2, dict[str, Any]]

Data to create, update, or delete project groups.

required

Returns:

Name Type Description
BatchRespV2 BatchRespV2

The response object containing the status of the batch operation.

Source code in src/pyticktick/client.py
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
def post_project_group_v2(
    self,
    data: Union[PostBatchProjectGroupV2, dict[str, Any]],
) -> BatchRespV2:
    """Create, update, or delete project groups in bulk against the V2 API.

    The method creates, updates, and deletes project groups in bulk using the
    `POST /batch/projectGroup` V2 endpoint. This used to create what TickTick calls
    folders. They have a [small guide](https://help.ticktick.com/articles/7055782296019795968)
    on them if you want to learn more.

    ??? example "Add a project group"
        ```python hl_lines="8"
        from pyticktick import Client
        from pyticktick.models.v2 import (
            PostBatchProjectGroupV2,
            CreateProjectGroupV2,
        )

        client = Client()
        resp = client.post_project_group_v2(
            data=PostBatchProjectGroupV2(
                add=[CreateProjectGroupV2(name="test_group")],
            )
        )
        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {
                "680be2008f08b6b4618a3c89": "znr6783z"
            }
        }
        ```

    ??? example "Update a project group"
        ```python hl_lines="8"
        from pyticktick import Client
        from pyticktick.models.v2 import (
            PostBatchProjectGroupV2,
            UpdateProjectGroupV2,
        )

        client = Client()
        resp = client.post_project_group_v2(
            data=PostBatchProjectGroupV2(
                update=[
                    UpdateProjectGroupV2(
                        name="test_group_renamed",
                        id="680be2008f08b6b4618a3c89",
                    ),
                ],
            ),
        )
        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {
                "680be2008f08b6b4618a3c89": "2qoky0fw"
            }
        }
        ```

    ??? example "Delete a project group"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import PostBatchProjectGroupV2

        client = Client()
        resp = client.post_project_group_v2(
            data=PostBatchProjectGroupV2(delete=["680be2008f08b6b4618a3c89"]),
        )
        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {}
        }
        ```

    Args:
        data (Union[PostBatchProjectGroupV2, dict[str, Any]]): Data to create,
            update, or delete project groups.

    Returns:
        BatchRespV2: The response object containing the status of the batch
            operation.
    """
    if isinstance(data, dict):
        data = PostBatchProjectGroupV2.model_validate(data)
    resp = self._post_api_v2("/batch/projectGroup", data=self._model_dump(data))
    if self.override_forbid_extra:
        update_model_config(BatchRespV2, extra="allow")
    return BatchRespV2.model_validate(resp)

post_task_parent_v2 #

post_task_parent_v2(
    data: Union[PostBatchTaskParentV2, list[Any]],
) -> BatchTaskParentRespV2

Set or unset a task parent in bulk against the V2 API.

This method sets and/or unsets task parents in bulk using the POST /batch/taskParent V2 endpoint. This is used to create what TickTick refers to as subtasks. This is notably different from a checklist task. You can see TickTick's guide on subtasks / Multilevel Tasks for more information.

Set and unset task parents
from pyticktick import Client
from pyticktick.models.v2 import (
    PostBatchTaskParentV2,
    SetTaskParentV2,
    UnSetTaskParentV2,
)

client = Client()
resp = client.post_task_parent_v2(
    data=PostBatchTaskParentV2(
        [
            SetTaskParentV2(
                project_id="681180d78f08af4931b657e8",
                parent_id="68117d7327de22223ea29ffd",
                task_id="68117d7627de22223ea2a003",
            ),
            UnSetTaskParentV2(
                project_id="681180d78f08af4931b657e8",
                old_parent_id="6811803d27de22223ea2a011",
                task_id="6811803f27de22223ea2a017",
            ),
        ],
    ),
)

print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {
        "68117d7627de22223ea2a003": {
            "id": "68117d7627de22223ea2a003",
            "parent_id": "68117d7327de22223ea29ffd",
            "child_ids": null,
            "etag": "07s4q5a6"
        },
        "68117d7327de22223ea29ffd": {
            "id": "68117d7327de22223ea29ffd",
            "parent_id": null,
            "child_ids": [
                "68117d7627de22223ea2a003"
            ],
            "etag": "df6fxmtg"
        },
        "6811803f27de22223ea2a017": {
            "id": "6811803f27de22223ea2a017",
            "parent_id": null,
            "child_ids": null,
            "etag": "fhuwhgge"
        },
        "6811803d27de22223ea2a011": {
            "id": "6811803d27de22223ea2a011",
            "parent_id": null,
            "child_ids": [],
            "etag": "idwvx8sx"
        }
    }
}

Parameters:

Name Type Description Default
data Union[PostBatchTaskParentV2, list[Any]]

Data to set or unset task parents.

required

Returns:

Name Type Description
BatchTaskParentRespV2 BatchTaskParentRespV2

Response from the API after setting or unsetting the

BatchTaskParentRespV2

task parents.

Source code in src/pyticktick/client.py
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
def post_task_parent_v2(
    self,
    data: Union[PostBatchTaskParentV2, list[Any]],
) -> BatchTaskParentRespV2:
    """Set or unset a task parent in bulk against the V2 API.

    This method sets and/or unsets task parents in bulk using the
    `POST /batch/taskParent` V2 endpoint. This is used to create what
    TickTick refers to as subtasks. This is notably different from a
    checklist task. You can see [TickTick's guide on subtasks / _Multilevel Tasks_](https://help.ticktick.com/articles/7055782219767349248)
    for more information.

    ??? example "Set and unset task parents"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import (
            PostBatchTaskParentV2,
            SetTaskParentV2,
            UnSetTaskParentV2,
        )

        client = Client()
        resp = client.post_task_parent_v2(
            data=PostBatchTaskParentV2(
                [
                    SetTaskParentV2(
                        project_id="681180d78f08af4931b657e8",
                        parent_id="68117d7327de22223ea29ffd",
                        task_id="68117d7627de22223ea2a003",
                    ),
                    UnSetTaskParentV2(
                        project_id="681180d78f08af4931b657e8",
                        old_parent_id="6811803d27de22223ea2a011",
                        task_id="6811803f27de22223ea2a017",
                    ),
                ],
            ),
        )

        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {
                "68117d7627de22223ea2a003": {
                    "id": "68117d7627de22223ea2a003",
                    "parent_id": "68117d7327de22223ea29ffd",
                    "child_ids": null,
                    "etag": "07s4q5a6"
                },
                "68117d7327de22223ea29ffd": {
                    "id": "68117d7327de22223ea29ffd",
                    "parent_id": null,
                    "child_ids": [
                        "68117d7627de22223ea2a003"
                    ],
                    "etag": "df6fxmtg"
                },
                "6811803f27de22223ea2a017": {
                    "id": "6811803f27de22223ea2a017",
                    "parent_id": null,
                    "child_ids": null,
                    "etag": "fhuwhgge"
                },
                "6811803d27de22223ea2a011": {
                    "id": "6811803d27de22223ea2a011",
                    "parent_id": null,
                    "child_ids": [],
                    "etag": "idwvx8sx"
                }
            }
        }
        ```

    Args:
        data (Union[PostBatchTaskParentV2, list[Any]]): Data to set or unset task
            parents.

    Returns:
        BatchTaskParentRespV2: Response from the API after setting or unsetting the
        task parents.
    """
    if isinstance(data, list):
        data = PostBatchTaskParentV2.model_validate(data)
    resp = self._post_api_v2("/batch/taskParent", data=self._model_dump(data))
    if self.override_forbid_extra:
        update_model_config(BatchTaskParentRespV2, extra="allow")
    return BatchTaskParentRespV2.model_validate(resp)

post_tag_v2 #

post_tag_v2(
    data: Union[PostBatchTagV2, dict[str, Any]],
) -> BatchTagRespV2

Create or update tags in bulk against the V2 API.

This method creates or updates tags in bulk using the POST /batch/tag V2 endpoint. Tags are used to help organize tasks. Tasks can be tagged with multiple tags, and they can be nested as well. They are often associated with categories, status, or location. You can see TickTick's guide for more info.

Not all operations supported

While batch operations usually support adding, updating, and deleting, this endpoint only supports adding and updating tags. Deleting tags supported separately, see delete_tag_v2. Updating tag names is also supported, separately through the put_rename_tag_v2 function.

Add a tag
from pyticktick import Client
from pyticktick.models.v2 import PostBatchTagV2, CreateTagV2

client = Client()
resp = client.post_tag_v2(
    data=PostBatchTagV2(
        add=[CreateTagV2(label="test_tag", color="#002fa7")],
    )
)
print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {
        "test_tag": "6pkt0zoq"
    }
}

Update a tag
from pyticktick import Client
from pyticktick.models.v2 import PostBatchTagV2, UpdateTagV2

client = Client()
resp = client.post_tag_v2(
    data=PostBatchTagV2(
        update=[UpdateTagV2(label="test_tag", color="#ee6c4d")],
    ),
)
print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {
        "test_tag": "fcutpk78"
    }
}

Add a nested tag
from pyticktick import Client
from pyticktick.models.v2 import PostBatchTagV2, CreateTagV2, UpdateTagV2

client = Client()
resp = client.post_tag_v2(
    data=PostBatchTagV2(
        add=[
            CreateTagV2(label="parent_tag", color="#002fa7"),
            CreateTagV2(label="child_tag", color="#ee6c4d"),
        ],
    ),
)
print(resp.model_dump())
resp = client.post_tag_v2(
    data=PostBatchTagV2(
        update=[
            UpdateTagV2(label="child_tag", parent="parent_tag"),
        ],
    ),
)
print(resp.model_dump())

will output:

{
    "id2error": {},
    "id2etag": {
        "parent_tag": "ffmehyan",
        "child_tag": "1uuc4fz1"
    }
}
{
    "id2error": {},
    "id2etag": {
        "child_tag": "65lj6uj9"
    }
}

Parameters:

Name Type Description Default
data Union[PostBatchTagV2, dict[str, Any]]

Data to create or update tags.

required

Returns:

Name Type Description
BatchTagRespV2 BatchTagRespV2

Response from the API after creating or updating the tags.

Source code in src/pyticktick/client.py
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
def post_tag_v2(
    self,
    data: Union[PostBatchTagV2, dict[str, Any]],
) -> BatchTagRespV2:
    """Create or update tags in bulk against the V2 API.

    This method creates or updates tags in bulk using the `POST /batch/tag` V2
    endpoint. Tags are used to help organize tasks. Tasks can be tagged with
    multiple tags, and they can be nested as well. They are often associated with
    categories, status, or location. You can see [TickTick's guide](https://help.ticktick.com/articles/7055782255804809216)
    for more info.

    !!! warning "Not all operations supported"
        While batch operations usually support adding, updating, and deleting, this
        endpoint only supports adding and updating tags. Deleting tags supported
        separately, see `delete_tag_v2`. Updating tag names is also supported,
        separately through the `put_rename_tag_v2` function.

    ??? example "Add a tag"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import PostBatchTagV2, CreateTagV2

        client = Client()
        resp = client.post_tag_v2(
            data=PostBatchTagV2(
                add=[CreateTagV2(label="test_tag", color="#002fa7")],
            )
        )
        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {
                "test_tag": "6pkt0zoq"
            }
        }
        ```
    ??? example "Update a tag"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import PostBatchTagV2, UpdateTagV2

        client = Client()
        resp = client.post_tag_v2(
            data=PostBatchTagV2(
                update=[UpdateTagV2(label="test_tag", color="#ee6c4d")],
            ),
        )
        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {
                "test_tag": "fcutpk78"
            }
        }
        ```

    ??? example "Add a nested tag"
        ```python hl_lines="5 14"
        from pyticktick import Client
        from pyticktick.models.v2 import PostBatchTagV2, CreateTagV2, UpdateTagV2

        client = Client()
        resp = client.post_tag_v2(
            data=PostBatchTagV2(
                add=[
                    CreateTagV2(label="parent_tag", color="#002fa7"),
                    CreateTagV2(label="child_tag", color="#ee6c4d"),
                ],
            ),
        )
        print(resp.model_dump())
        resp = client.post_tag_v2(
            data=PostBatchTagV2(
                update=[
                    UpdateTagV2(label="child_tag", parent="parent_tag"),
                ],
            ),
        )
        print(resp.model_dump())
        ```

        will output:
        ```json
        {
            "id2error": {},
            "id2etag": {
                "parent_tag": "ffmehyan",
                "child_tag": "1uuc4fz1"
            }
        }
        {
            "id2error": {},
            "id2etag": {
                "child_tag": "65lj6uj9"
            }
        }
        ```

    Args:
        data (Union[PostBatchTagV2, dict[str, Any]]): Data to create or update tags.

    Returns:
        BatchTagRespV2: Response from the API after creating or updating the tags.
    """
    if isinstance(data, dict):
        data = PostBatchTagV2.model_validate(data)
    resp = self._post_api_v2("/batch/tag", data=self._model_dump(data))
    if self.override_forbid_extra:
        update_model_config(BatchTagRespV2, extra="allow")
    return BatchTagRespV2.model_validate(resp)

put_rename_tag_v2 #

put_rename_tag_v2(
    data: Union[RenameTagV2, dict[str, Any]],
) -> None

Rename a tag in the V2 API.

Update a tag name using the PUT /tag/rename V2 endpoint. This endpoint allows you to specifically rename a tag. Any other update operations should be done using the post_tag_v2 method.

Example

from pyticktick import Client
from pyticktick.models.v2 import RenameTagV2

client = Client()
client.put_rename_tag_v2(
    data=RenameTagV2(
        name="test_tag",
        new_name="test_tag_renamed",
    ),
)
This will return nothing if the tag is successfully renamed. Just know, even if the rename is unsuccessful, the API probably won't return an error.

Parameters:

Name Type Description Default
data Union[RenameTagV2, dict[str, Any]]

Data to rename the tag.

required

Raises:

Type Description
ValueError

The response had an error HTTP status of 4xx or 5xx.

Source code in src/pyticktick/client.py
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
def put_rename_tag_v2(self, data: Union[RenameTagV2, dict[str, Any]]) -> None:
    """Rename a tag in the V2 API.

    Update a tag name using the `PUT /tag/rename` V2 endpoint. This endpoint allows
    you to specifically rename a tag. Any other _update_ operations should be done
    using the `post_tag_v2` method.

    ??? example "Example"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import RenameTagV2

        client = Client()
        client.put_rename_tag_v2(
            data=RenameTagV2(
                name="test_tag",
                new_name="test_tag_renamed",
            ),
        )
        ```
        This will return nothing if the tag is successfully renamed. Just know, even
        if the rename is _unsuccessful_, the API probably won't return an error.

    Args:
        data (Union[RenameTagV2, dict[str, Any]]): Data to rename the tag.

    Raises:
        ValueError: The response had an error HTTP status of `4xx` or `5xx`.
    """
    if isinstance(data, dict):
        data = RenameTagV2.model_validate(data)
    try:
        resp = httpx.put(
            url=str(self.v2_base_url.join("/tag/rename")),
            headers=self.v2_headers,
            cookies=self.v2_cookies,
            json=self._model_dump(data),
        )
        resp.raise_for_status()
    except httpx.HTTPStatusError as e:
        try:
            content = e.response.json()
        except json.decoder.JSONDecodeError:
            content = e.response.content.decode()
        msg = f"Response [{e.response.status_code}]: {content}"
        logger.error(msg)
        raise ValueError(msg)  # noqa: B904

delete_tag_v2 #

delete_tag_v2(
    data: Union[DeleteTagV2, dict[str, Any]],
) -> None

Delete a tag in the V2 API.

Delete a tag using the DELETE /tag V2 endpoint.

Example

from pyticktick import Client
from pyticktick.models.v2 import DeleteTagV2

client = Client()
client.delete_tag_v2(
    data=DeleteTagV2(name="test_tag"),
)
This will return nothing if the tag is successfully deleted. Just know, even if the delete is unsuccessful, the API probably won't return an error.

Parameters:

Name Type Description Default
data Union[DeleteTagV2, dict[str, Any]]

Data to delete a tag.

required
Source code in src/pyticktick/client.py
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
def delete_tag_v2(self, data: Union[DeleteTagV2, dict[str, Any]]) -> None:
    """Delete a tag in the V2 API.

    Delete a tag using the `DELETE /tag` V2 endpoint.

    ??? example "Example"
        ```python hl_lines="5"
        from pyticktick import Client
        from pyticktick.models.v2 import DeleteTagV2

        client = Client()
        client.delete_tag_v2(
            data=DeleteTagV2(name="test_tag"),
        )
        ```
        This will return nothing if the tag is successfully deleted. Just know,
        even if the delete is _unsuccessful_, the API probably won't return an
        error.

    Args:
        data (Union[DeleteTagV2, dict[str, Any]]): Data to delete a tag.
    """
    if isinstance(data, dict):
        data = DeleteTagV2.model_validate(data)
    self._delete_api_v2("/tag", data=self._model_dump(data))

get_profile_v2 #

get_profile_v2() -> UserProfileV2

Get the user profile from the V2 API.

This method gets the user profile from the GET /user/profile V2 endpoint. This endpoint provides information about the user's profile, including their name, email, and other details.

Example
from pyticktick import Client

client = Client()
profile = client.get_profile_v2()
print(profile.model_dump())

will output:

{
    "etimestamp": null,
    "username": "[email protected]",
    "site_domain": "ticktick.com",
    "created_campaign": "",
    "created_device_info": null,
    "filled_password": true,
    "account_domain": null,
    "extenal_id": null,
    "email": null,
    "verified_email": true,
    "faked_email": false,
    "phone": null,
    "name": null,
    "given_name": null,
    "family_name": null,
    "link": null,
    "picture": "https://secure.gravatar.com/avatar/63a5deb18f37c35393c70de1ef53cb6a;size=50?default=https://d3qg9zffrnl4ph.cloudfront.net/image/avatar.png",
    "gender": null,
    "locale": "en_US",
    "user_code": "58822351-89dd-432a-90ed-772a47fb15b5",
    "ver_code": null,
    "ver_key": null,
    "external_id": null,
    "phone_without_country_code": null,
    "display_name": "[email protected]"
}

Returns:

Name Type Description
UserProfileV2 UserProfileV2

The user profile object retrieved from the API.

Source code in src/pyticktick/client.py
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
def get_profile_v2(self) -> UserProfileV2:
    """Get the user profile from the V2 API.

    This method gets the user profile from the `GET /user/profile` V2 endpoint.
    This endpoint provides information about the user's profile, including their
    name, email, and other details.

    ??? example "Example"
        ```python hl_lines="4"
        from pyticktick import Client

        client = Client()
        profile = client.get_profile_v2()
        print(profile.model_dump())
        ```

        will output:
        ```json
        {
            "etimestamp": null,
            "username": "[email protected]",
            "site_domain": "ticktick.com",
            "created_campaign": "",
            "created_device_info": null,
            "filled_password": true,
            "account_domain": null,
            "extenal_id": null,
            "email": null,
            "verified_email": true,
            "faked_email": false,
            "phone": null,
            "name": null,
            "given_name": null,
            "family_name": null,
            "link": null,
            "picture": "https://secure.gravatar.com/avatar/63a5deb18f37c35393c70de1ef53cb6a;size=50?default=https://d3qg9zffrnl4ph.cloudfront.net/image/avatar.png",
            "gender": null,
            "locale": "en_US",
            "user_code": "58822351-89dd-432a-90ed-772a47fb15b5",
            "ver_code": null,
            "ver_key": null,
            "external_id": null,
            "phone_without_country_code": null,
            "display_name": "[email protected]"
        }
        ```

    Returns:
        UserProfileV2: The user profile object retrieved from the API.
    """
    resp = self._get_api_v2("/user/profile")
    if self.override_forbid_extra:
        update_model_config(UserProfileV2, extra="allow")
    return UserProfileV2.model_validate(resp)

get_status_v2 #

get_status_v2() -> UserStatusV2

Get the user status from the V2 API.

This method gets the user status from the GET /user/status V2 endpoint. This user "status" is mainly about the user's subscription status, rather than their current activity on TickTick. This may still be useful for confirming if a user is a premium subscriber or not. A free account is much more limited in terms of its features, and TickTick does not provide feedback on if a request fails due to a hitting a free limit or not.

Example
from pyticktick import Client

client = Client()
status = client.get_status_v2()
print(status.model_dump())

will output:

{
    "user_id": "213928392",
    "user_code": "58822351-89dd-432a-90ed-772a47fb15b5",
    "username": "[email protected]",
    "team_pro": false,
    "pro_start_date": "2024-12-25T16:18:28.000+0000",
    "pro_end_date": "2026-12-26T16:18:19.000+0000",
    "subscribe_type": "stripe_subscribe",
    "subscribe_freq": "Year",
    "need_subscribe": false,
    "freq": "Year",
    "inbox_id": "inbox213928392",
    "team_user": false,
    "active_team_user": false,
    "free_trial": false,
    "pro": true,
    "ds": false,
    "time_stamp": 1735898435,
    "grace_period": false
}

Returns:

Name Type Description
UserStatusV2 UserStatusV2

The user status object retrieved from the API.

Source code in src/pyticktick/client.py
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
def get_status_v2(self) -> UserStatusV2:
    """Get the user status from the V2 API.

    This method gets the user status from the `GET /user/status` V2 endpoint. This
    user "status" is mainly about the user's subscription status, rather than
    their current activity on TickTick. This may still be useful for confirming if
    a user is a premium subscriber or not. A free account is much more limited in
    terms of its features, and TickTick does not provide feedback on if a request
    fails due to a hitting a free limit or not.

    ??? example "Example"
        ```python hl_lines="4"
        from pyticktick import Client

        client = Client()
        status = client.get_status_v2()
        print(status.model_dump())
        ```

        will output:
        ```json
        {
            "user_id": "213928392",
            "user_code": "58822351-89dd-432a-90ed-772a47fb15b5",
            "username": "[email protected]",
            "team_pro": false,
            "pro_start_date": "2024-12-25T16:18:28.000+0000",
            "pro_end_date": "2026-12-26T16:18:19.000+0000",
            "subscribe_type": "stripe_subscribe",
            "subscribe_freq": "Year",
            "need_subscribe": false,
            "freq": "Year",
            "inbox_id": "inbox213928392",
            "team_user": false,
            "active_team_user": false,
            "free_trial": false,
            "pro": true,
            "ds": false,
            "time_stamp": 1735898435,
            "grace_period": false
        }
        ```

    Returns:
        UserStatusV2: The user status object retrieved from the API.
    """
    resp = self._get_api_v2("/user/status")
    if self.override_forbid_extra:
        update_model_config(UserStatusV2, extra="allow")
    return UserStatusV2.model_validate(resp)

get_statistics_v2 #

get_statistics_v2() -> UserStatisticsV2

Get user statistics from the V2 API.

This method gets the user statistics from the GET /statistics/general V2 endpoint. This endpoint provides information about the user's statistics, such as number of tasks completed per day, week, or month, and other metrics.

Example
from pyticktick import Client

client = Client()
statistics = client.get_statistics_v2()
print(statistics.model_dump())

will output:

{
    "score": 8211,
    "level": 7,
    "yesterday_completed": 6,
    "today_completed": 4,
    "total_completed": 2187,
    "score_by_day": {
        "2025-03-27": 7939,
        ...
        "2025-04-01": 8149,
        "2025-04-02": 8189
    },
    "task_by_day": {
        "2025-03-27": {
            "complete_count": 3,
            "not_complete_count": 2
        },
        ...
        "2025-04-01": {
            "complete_count": 6,
            "not_complete_count": 1
        },
        "2025-04-02": {
            "complete_count": 4,
            "not_complete_count": 0
        }
    },
    "task_by_week": {
        "2025-02-16": {
            "complete_count": 214,
            "not_complete_count": 3
        },
        ...
        "2025-03-23": {
            "complete_count": 64,
            "not_complete_count": 8
        },
        "2025-03-30": {
            "complete_count": 22,
            "not_complete_count": 10
        }
    },
    "task_by_month": {
        "2024-10-01": {
            "complete_count": 0,
            "not_complete_count": 0
        },
        ...
        "2025-03-01": {
            "complete_count": 654,
            "not_complete_count": 14
        },
        "2025-04-01": {
            "complete_count": 10,
            "not_complete_count": 29
        }
    },
    "today_pomo_count": 0,
    "yesterday_pomo_count": 0,
    "total_pomo_count": 0,
    "today_pomo_duration": 0,
    "yesterday_pomo_duration": 0,
    "total_pomo_duration": 0,
    "pomo_goal": 0,
    "pomo_duration_goal": 0,
    "pomo_by_day": {},
    "pomo_by_week": {},
    "pomo_by_month": {}
}

Returns:

Name Type Description
UserStatisticsV2 UserStatisticsV2

The user statistics object retrieved from the API.

Source code in src/pyticktick/client.py
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
def get_statistics_v2(self) -> UserStatisticsV2:
    """Get user statistics from the V2 API.

    This method gets the user statistics from the `GET /statistics/general` V2
    endpoint. This endpoint provides information about the user's statistics, such
    as number of tasks completed per day, week, or month, and other metrics.

    ??? example "Example"
        ```python hl_lines="4"
        from pyticktick import Client

        client = Client()
        statistics = client.get_statistics_v2()
        print(statistics.model_dump())
        ```

        will output:
        ```json
        {
            "score": 8211,
            "level": 7,
            "yesterday_completed": 6,
            "today_completed": 4,
            "total_completed": 2187,
            "score_by_day": {
                "2025-03-27": 7939,
                ...
                "2025-04-01": 8149,
                "2025-04-02": 8189
            },
            "task_by_day": {
                "2025-03-27": {
                    "complete_count": 3,
                    "not_complete_count": 2
                },
                ...
                "2025-04-01": {
                    "complete_count": 6,
                    "not_complete_count": 1
                },
                "2025-04-02": {
                    "complete_count": 4,
                    "not_complete_count": 0
                }
            },
            "task_by_week": {
                "2025-02-16": {
                    "complete_count": 214,
                    "not_complete_count": 3
                },
                ...
                "2025-03-23": {
                    "complete_count": 64,
                    "not_complete_count": 8
                },
                "2025-03-30": {
                    "complete_count": 22,
                    "not_complete_count": 10
                }
            },
            "task_by_month": {
                "2024-10-01": {
                    "complete_count": 0,
                    "not_complete_count": 0
                },
                ...
                "2025-03-01": {
                    "complete_count": 654,
                    "not_complete_count": 14
                },
                "2025-04-01": {
                    "complete_count": 10,
                    "not_complete_count": 29
                }
            },
            "today_pomo_count": 0,
            "yesterday_pomo_count": 0,
            "total_pomo_count": 0,
            "today_pomo_duration": 0,
            "yesterday_pomo_duration": 0,
            "total_pomo_duration": 0,
            "pomo_goal": 0,
            "pomo_duration_goal": 0,
            "pomo_by_day": {},
            "pomo_by_week": {},
            "pomo_by_month": {}
        }
        ```

    Returns:
        UserStatisticsV2: The user statistics object retrieved from the API.
    """
    resp = self._get_api_v2("/statistics/general")
    if self.override_forbid_extra:
        update_model_config(UserStatisticsV2, extra="allow")
    return UserStatisticsV2.model_validate(resp)