> ## Documentation Index
> Fetch the complete documentation index at: https://docs.seekr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage and delete resources

> List and clean up agents, tools, files, vector databases, data jobs, fine-tuning jobs, and projects.

Everything you create stays in your workspace until you remove it. This page collects the cleanup path for each resource type in one place. It covers how to list what you have, how to delete a single resource, and how to delete in bulk.

Each example assumes an initialized `client`. See [Get started with the SDK](/flow/sdk/getting-started).

## Deletion methods

| Resource                   | SDK method                                                 | REST endpoint                                                                                                                                                 |
| -------------------------- | ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Agents                     | `client.agents.delete(agent_id)`                           | [`DELETE /v2/flow/agents/{agent_id}`](/flow/reference/delete_v2_flow_agents__agent_id__delete)                                                                |
| Tools                      | `client.tools.delete(tool_id)`                             | [`DELETE /v1/flow/tools/{tool_id}`](/flow/reference/delete_tool_v1_flow_tools__tool_id__delete)                                                               |
| Files                      | `client.files.delete(id)`                                  | [`DELETE /v1/flow/files/{file_id}`](/flow/reference/delete_file_v1_flow_files__file_id__delete)                                                               |
| Vector databases           | `client.vector_database.delete(database_id)`               | [`DELETE /v1/flow/vectordb/{database_id}`](/flow/reference/delete_vector_database_route_v1_flow_vectordb__database_id__delete)                                |
| Files in a vector database | `client.vector_database.delete_file(database_id, file_id)` | [`DELETE /v1/flow/vectordb/{database_id}/files/{file_id}`](/flow/reference/delete_vector_database_file_v1_flow_vectordb__database_id__files__file_id__delete) |
| Data jobs                  | `client.data_jobs.delete(data_job_id)`                     | [`DELETE /v1/flow/data-jobs/{data_job_id}`](/flow/reference/delete_data_job_v1_flow_data_jobs__data_job_id__delete)                                           |
| Fine-tuning jobs           |                                                            | [`DELETE /v1/flow/fine-tunes/{fine_tune_id}`](/flow/reference/delete_fine_tune_v1_flow_fine_tunes__fine_tune_id__delete)                                      |
| Fine-tuning projects       |                                                            | [`DELETE /v1/flow/projects/{project_id}`](/flow/reference/delete_project_v1_flow_projects__project_id__delete)                                                |

Delete fine-tuning jobs and projects over REST. See [Delete fine-tuning jobs and projects](#delete-fine-tuning-jobs-and-projects) for a worked example.

<Warning>
  Deletion is permanent for every resource in the table. Nothing is moved to a recoverable state first, and a deleted resource cannot be restored.
</Warning>

## List your resources

Begin by listing the resource type you intend to remove. The list methods differ in shape. Some return a list directly. Others return a response object with the results under `data`.

<CodeGroup>
  ```python Python theme={null}
  agents = client.agents.list_agents()           # list[Agent]
  tools = client.tools.list().data               # paginated, default limit 100
  files = client.files.list().data
  databases = client.vector_database.list().data
  jobs = client.data_jobs.list().data            # paginated, default limit 25
  fine_tunes = client.fine_tuning.list().data
  projects = client.projects.list().data         # paginated, default limit 100

  for agent in agents:
      print(f"{agent.id}  {agent.name}")
  ```
</CodeGroup>

`client.tools.list()`, `client.files.list()`, `client.data_jobs.list()`, and `client.projects.list()` accept paging arguments. When a workspace holds more resources than one page returns, increase `limit` or request successive pages with `offset`.

<CodeGroup>
  ```python Python theme={null}
  all_tools = []
  offset = 0

  while True:
      page = client.tools.list(offset=offset, limit=100)
      all_tools.extend(page.data)
      if len(all_tools) >= page.total:
          break
      offset += 100

  print(f"{len(all_tools)} tools")
  ```
</CodeGroup>

`client.data_jobs.list()` also filters by `job_type` and sorts with `sort_by` and `sort_order`. See [Manage data jobs](/flow/sdk/data-engine/manage-data-jobs).

## Delete a single resource

Each delete method takes the resource ID.

<CodeGroup>
  ```python Python theme={null}
  client.agents.delete(agent_id)
  client.tools.delete(tool_id)
  client.files.delete(file_id)
  client.vector_database.delete(database_id)
  client.data_jobs.delete(data_job_id)
  ```
</CodeGroup>

Deleting a vector database removes the database and everything indexed in it. To remove one document and keep the database, delete the file instead. See [Manage vector databases](/flow/sdk/data-engine/manage-vector-databases).

<CodeGroup>
  ```python Python theme={null}
  client.vector_database.delete_file(database_id, file_id)
  ```
</CodeGroup>

## Delete in bulk

To remove several resources at once, filter a list call to the resources you want to delete, then iterate over the result.

This example removes every tool whose name starts with a test prefix.

<CodeGroup>
  ```python Python theme={null}
  targets = [t for t in client.tools.list().data if t.name.startswith("test-")]

  print(f"Deleting {len(targets)} tools")
  for tool in targets:
      client.tools.delete(tool.id)
      print(f"Deleted {tool.id}  {tool.name}")
  ```
</CodeGroup>

<Tip>
  Print the selection and confirm it before the delete loop runs. Deletion is permanent, and a filter that matches more than you expected cannot be undone.
</Tip>

Delete in dependency order when resources reference each other. Delete an agent before the tools it uses, and delete a vector database before the files that were ingested into it.

## Cancel compared with delete

Cancel and delete are different operations on fine-tuning jobs, and only one of them frees the job from your list.

* **Cancel** – stops a job that is queued or in progress. The job remains in your list with a cancelled status, and its record and artifacts are retained. Use [`client.fine_tuning.cancel(id)`](/flow/reference/cancel_fine_tune_v1_flow_fine_tunes__fine_tune_id__cancel_put).
* **Delete** – removes the job record and its artifacts. A job in any state can be deleted, including one that finished or was cancelled.

Cancelling a job that has already reached a terminal state has no effect. To remove finished and cancelled jobs from a workspace, delete them.

Data jobs follow the same split. `client.data_jobs.cancel(data_job_id)` stops an in-progress alignment run, and `client.data_jobs.delete(data_job_id)` removes the record.

## Delete fine-tuning jobs and projects

Delete fine-tuning jobs and projects with a direct HTTP request to the REST endpoints.

Deleting a project does not delete the fine-tuning jobs in it. The jobs are disassociated from the project and remain in your workspace. To remove them as well, delete the jobs first.

<CodeGroup>
  ```python Python theme={null}
  import os
  import requests

  headers = {"Authorization": os.environ["SEEKR_API_KEY"]}

  # Delete a fine-tuning job and its artifacts
  requests.delete(
      f"https://flow.seekr.com/v1/flow/fine-tunes/{fine_tune_id}",
      headers=headers,
  ).raise_for_status()

  # Delete a project
  requests.delete(
      f"https://flow.seekr.com/v1/flow/projects/{project_id}",
      headers=headers,
  ).raise_for_status()
  ```

  ```curl cURL theme={null}
  curl -X DELETE https://flow.seekr.com/v1/flow/fine-tunes/<fine_tune_id> \
    -H "Authorization: <your_api_key>"

  curl -X DELETE https://flow.seekr.com/v1/flow/projects/<project_id> \
    -H "Authorization: <your_api_key>"
  ```
</CodeGroup>

Both endpoints return `204 No Content` on success. The deleted job or project no longer appears in `client.fine_tuning.list()` or `client.projects.list()`.

To remove all finished fine-tuning jobs from a workspace, list them with the SDK and delete them over REST.

<CodeGroup>
  ```python Python theme={null}
  import os
  import requests

  headers = {"Authorization": os.environ["SEEKR_API_KEY"]}
  finished = [j for j in client.fine_tuning.list().data if j.status == "completed"]

  print(f"Deleting {len(finished)} fine-tuning jobs")
  for job in finished:
      requests.delete(
          f"https://flow.seekr.com/v1/flow/fine-tunes/{job.id}",
          headers=headers,
      ).raise_for_status()
      print(f"Deleted {job.id}")
  ```
</CodeGroup>
