DELETE v1/Datasets/:Id
DELETE
https://api.subworkflow.ai/v1/datasets/:id
Deletes a dataset record by id
Summary
Call this endpoint to mark a dataset record by id for deletion. Same as setting an immediate expiry date. To identify if a dataset is marked for deletion, check that the expiry timestamp is before the current datetime timestamp. If it is lower, the dataset is considered expired and therefore marked for deletion.
info
- Dataset deletions are not immediate and instead a scheduled background job may is set to run twice a day to clear all expired datasets. The intervals are set to off-peak times to reduce write pressue on the database and object stores.
- When it comes to the actual "delete" event, all records, key, binary data and vectors related to the dataset are hard deleted from Subworkflow and are unrecoverable.
Parameters
n/a
Response
- Success
- 400 Error
- 404 Error
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"total": { "type": "number" },
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"workspaceId": {
"type": "string"
},
"type":{
"type": "string",
"enum": ["doc", "audio", "video", "image"]
},
"fileName": {
"type": "string"
},
"fileExt": {
"type": "string"
},
"fileSize": {
"type": "number",
},
"itemCount": {
"type": "number"
},
"mimeType":{
"type": "string"
},
"createdAt": {
"type": "number"
},
"updatedAt": {
"type": "number",
"nullable": true
},
"expiresAt": {
"type": "number",
"nullable": true
},
"share": {
"type": "object",
"propeties": {
"url": { "type": "string" },
"token": { "type": "string" },
"expiresAt": { "type": "number", "nullable": true }
}
}
}
}
}
}
{
"success": { "type": "boolean" },
"error": { "type": "string" }
}
{
"success": { "type": "boolean" },
"error": { "type": "string" }
}
Example
- Curl
- JS/TS
curl -X DELETE https://api.subworkfow.ai/v1/datasets/ds_ar7e4PtGX7fGGnSt
--header 'x-api-key: <YOUR-API-KEY>'
{
"success": true,
"total": 1,
"data": {
"id": "ds_ar7e4PtGX7fGGnSt",
"workspaceId": "wks_Gg9Bzi7sx8fbCfWI",
"type": "doc",
"fileName": "my_document",
"fileExt": "pdf",
"fileSize": 777678,
"itemCount": 44,
"mimeType": "application/pdf",
"createdAt": 1761933149632,
"updatedAt": 1761933149632,
"expiresAt": 1762019549632,
"share": {
"url": "https://api.subworkflow.ai/v1/share/dsx_iCAA1uoowAFi9rcu?token=OFWb98",
"token": "OFWb98",
"expiresAt": 1762009529330
}
}
}
import { Subworkflow } from "@subworkflow/sdk";
const subworkflow = new Subworkflow({ apiKey: "<YOUR-API-KEY>" });
const dataset = await subworkflow.datasets.delete("ds_ar7e4PtGX7fGGnSt");
{
"id": "ds_ar7e4PtGX7fGGnSt",
"workspaceId": "wks_Gg9Bzi7sx8fbCfWI",
"type": "doc",
"fileName": "my_document",
"fileExt": "pdf",
"fileSize": 777678,
"itemCount": 44,
"mimeType": "application/pdf",
"createdAt": 1761933149632,
"updatedAt": 1761933149632,
"expiresAt": 1762019549632,
"share": {
"url": "https://api.subworkflow.ai/v1/share/dsx_iCAA1uoowAFi9rcu?token=OFWb98",
"token": "OFWb98",
"expiresAt": 1762009529330
}
}