このページでは、REST API で DocFlow のファイルタスクを削除する方法を説明します。削除操作は複数条件の組み合わせに対応しており、いずれかの条件に一致したファイルが削除されます。
バッチ番号で削除
指定したバッチ配下のすべてのファイルを削除します。curl -X POST \
-H "x-ti-app-id: <your-app-id>" \
-H "x-ti-secret-code: <your-secret-code>" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": "<your-workspace-id>",
"batch_number": ["202412190001", "202412190002"]
}' \
"https://docflow.textin.ai/api/app-api/sip/platform/v2/file/delete"
import requests
import json
ti_app_id = "<your-app-id>"
ti_secret_code = "<your-secret-code>"
workspace_id = "<your-workspace-id>"
batch_numbers = ["202412190001", "202412190002"]
host = "https://docflow.textin.ai"
url = "/api/app-api/sip/platform/v2/file/delete"
headers = {
"x-ti-app-id": ti_app_id,
"x-ti-secret-code": ti_secret_code,
"Content-Type": "application/json",
}
payload = {
"workspace_id": workspace_id,
"batch_number": batch_numbers
}
resp = requests.post(
url=f"{host}{url}",
json=payload,
headers=headers,
timeout=60,
)
print(resp.status_code, resp.text)
result = resp.json()
print(f"Deleted {result['result']['deleted_count']} files")
タスク ID で削除
指定したタスク ID に対応するファイルを削除します。curl -X POST \
-H "x-ti-app-id: <your-app-id>" \
-H "x-ti-secret-code: <your-secret-code>" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": "<your-workspace-id>",
"task_id": ["1978297791713619968", "1978297791713619969"]
}' \
"https://docflow.textin.ai/api/app-api/sip/platform/v2/file/delete"
import requests
import json
ti_app_id = "<your-app-id>"
ti_secret_code = "<your-secret-code>"
workspace_id = "<your-workspace-id>"
task_ids = ["1978297791713619968", "1978297791713619969"]
host = "https://docflow.textin.ai"
url = "/api/app-api/sip/platform/v2/file/delete"
headers = {
"x-ti-app-id": ti_app_id,
"x-ti-secret-code": ti_secret_code,
"Content-Type": "application/json",
}
payload = {
"workspace_id": workspace_id,
"task_id": task_ids
}
resp = requests.post(
url=f"{host}{url}",
json=payload,
headers=headers,
timeout=60,
)
print(resp.status_code, resp.text)
result = resp.json()
print(f"Deleted {result['result']['deleted_count']} files")
ファイル ID で削除
指定したファイル ID に対応するファイルを削除します。curl -X POST \
-H "x-ti-app-id: <your-app-id>" \
-H "x-ti-secret-code: <your-secret-code>" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": "<your-workspace-id>",
"file_id": ["1978297792124661760", "1978297792124661761"]
}' \
"https://docflow.textin.ai/api/app-api/sip/platform/v2/file/delete"
import requests
import json
ti_app_id = "<your-app-id>"
ti_secret_code = "<your-secret-code>"
workspace_id = "<your-workspace-id>"
file_ids = ["1978297792124661760", "1978297792124661761"]
host = "https://docflow.textin.ai"
url = "/api/app-api/sip/platform/v2/file/delete"
headers = {
"x-ti-app-id": ti_app_id,
"x-ti-secret-code": ti_secret_code,
"Content-Type": "application/json",
}
payload = {
"workspace_id": workspace_id,
"file_id": file_ids
}
resp = requests.post(
url=f"{host}{url}",
json=payload,
headers=headers,
timeout=60,
)
print(resp.status_code, resp.text)
result = resp.json()
print(f"Deleted {result['result']['deleted_count']} files")
期間指定で削除
指定した期間内に作成されたファイルを削除します。curl -X POST \
-H "x-ti-app-id: <your-app-id>" \
-H "x-ti-secret-code: <your-secret-code>" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": "<your-workspace-id>",
"start_time": 1760523600,
"end_time": 1760527200
}' \
"https://docflow.textin.ai/api/app-api/sip/platform/v2/file/delete"
import requests
import json
from datetime import datetime
ti_app_id = "<your-app-id>"
ti_secret_code = "<your-secret-code>"
workspace_id = "<your-workspace-id>"
# Time range: 2025-12-19 00:00:00 to 2025-12-19 01:00:00
start_time = int(datetime(2025, 12, 19, 0, 0, 0).timestamp())
end_time = int(datetime(2025, 12, 19, 1, 0, 0).timestamp())
host = "https://docflow.textin.ai"
url = "/api/app-api/sip/platform/v2/file/delete"
headers = {
"x-ti-app-id": ti_app_id,
"x-ti-secret-code": ti_secret_code,
"Content-Type": "application/json",
}
payload = {
"workspace_id": workspace_id,
"start_time": start_time,
"end_time": end_time
}
resp = requests.post(
url=f"{host}{url}",
json=payload,
headers=headers,
timeout=60,
)
print(resp.status_code, resp.text)
result = resp.json()
print(f"Deleted {result['result']['deleted_count']} files")
複合条件で削除
複数の条件を同時に指定して削除できます。いずれかの条件に一致したファイルが削除されます。curl -X POST \
-H "x-ti-app-id: <your-app-id>" \
-H "x-ti-secret-code: <your-secret-code>" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": "<your-workspace-id>",
"batch_number": ["202412190001"],
"file_id": ["1978297792124661760"],
"start_time": 1760523600,
"end_time": 1760527200
}' \
"https://docflow.textin.ai/api/app-api/sip/platform/v2/file/delete"
import requests
import json
from datetime import datetime
ti_app_id = "<your-app-id>"
ti_secret_code = "<your-secret-code>"
workspace_id = "<your-workspace-id>"
# Combined conditions: batch number + file ID + time range
start_time = int(datetime(2025, 12, 19, 0, 0, 0).timestamp())
end_time = int(datetime(2025, 12, 19, 1, 0, 0).timestamp())
host = "https://docflow.textin.ai"
url = "/api/app-api/sip/platform/v2/file/delete"
headers = {
"x-ti-app-id": ti_app_id,
"x-ti-secret-code": ti_secret_code,
"Content-Type": "application/json",
}
payload = {
"workspace_id": workspace_id,
"batch_number": ["202412190001"],
"file_id": ["1978297792124661760"],
"start_time": start_time,
"end_time": end_time
}
resp = requests.post(
url=f"{host}{url}",
json=payload,
headers=headers,
timeout=60,
)
print(resp.status_code, resp.text)
result = resp.json()
print(f"Deleted {result['result']['deleted_count']} files")
パラメータ説明
必須パラメータ
workspace_id: ワークスペース ID。Workspace ID の取得方法 を参照してください。
任意パラメータ
削除条件として次のパラメータを指定できます。いずれかの条件に一致したファイルが削除されます。batch_number: バッチ番号リスト。指定したバッチ配下のすべてのファイルを削除しますtask_id: タスク ID リスト。指定したタスクに対応するファイルを削除しますfile_id: ファイル ID リスト。指定したファイルを削除しますstart_time: 開始時刻(エポックタイムスタンプ、単位: 秒)end_time: 終了時刻(エポックタイムスタンプ、単位: 秒)
レスポンス説明
削除に成功すると、削除されたファイル数が返されます。{
"code": 200,
"msg": "success",
"result": {
"deleted_count": 5
}
}
deleted_count: 実際に削除されたファイル数
重要な注意事項
削除操作は 元に戻せません。削除したファイルは復元できません。削除前に重要データをバックアップしていることを確認してください。
- 削除条件: 削除 API は複数条件の組み合わせに対応しています。いずれかの条件に一致したファイルが削除されます
- 権限制御: 指定したワークスペースに属するファイルのみ削除できます
- バッチ操作: 一括削除に対応しており、複数ファイルをまとめて削除できます
- 時刻形式: 時刻パラメータはエポックタイムスタンプ(秒)を使用します
- 削除範囲: 削除操作では、ファイル本体に加えて関連する処理結果、レビュー記録などのデータも同時に削除されます

