---
title: "Delete records from a table"
method: DELETE
path: "/api/db/{project_id}/rest/v1/{table}"
tags: ["Database"]
---

# Delete records from a table

`DELETE /api/db/{project_id}/rest/v1/{table}`

## Request

- Base URL: `https://core.blink.new`
- URL: `https://core.blink.new/api/db/{project_id}/rest/v1/{table}`
- Auth: one of:
  - HTTP bearer
  - none

Delete one or more rows that match the query-string filters.

**Authentication**
- Requires a valid bearer token unless the project policy has `require_auth: false`.
- Service-role tokens bypass row-level security.

**Row-Level Security (RLS)**
For non-service tokens with `owner` mode RLS, a `WHERE user_id = <caller_id>`
condition is automatically added so callers can only delete their own rows.

**Filtering**
Use the same column-operator query parameters as GET (e.g. `?id=eq.5`).
Without any filter **and** without RLS, all rows in the table will be deleted.
Always pass at least one filter in production code.

**Return deleted rows**
Send the `Prefer: return=representation` header to receive the deleted rows in
the response body. Without it, the response is `204 No Content`.

## Path parameters

- `project_id` string, required
- `table` string, required

## Query parameters

- `id` 'return=representation' | 'return=minimal'

## Response `200`

Deleted records (when Prefer: return=representation header is sent)

- TableRecord[]

## Other responses

- `204`: Records deleted successfully (no body)
- `400`: Invalid table name, column name, or filter expression
- `401`: Unauthenticated and require_auth is enabled
- `403`: Write access denied by table policy, or RLS owner column missing
- `404`: No database found for the given project_id
- `500`: Internal server error

---

[API](https://skmtc.dev/blink/apis/blink-apis.md) - [All operations](https://skmtc.dev/blink/apis/blink-apis/llms.txt) - [OpenAPI document](https://skmtc.dev/blink/apis/blink-apis/revisions/4c59c706078e?raw)
