---
title: "Update records in a table"
method: PATCH
path: "/api/db/{project_id}/rest/v1/{table}"
tags: ["Database"]
---

# Update records in a table

`PATCH /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

Update 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. The owner field itself cannot be changed by
non-service callers (ownership transfer is blocked). Sending your own id is
accepted and dropped, so the same payload can be reused for create and update;
if it was the only field there is nothing left to write and the call returns 400.

**Filtering**
Use the same column-operator query parameters as GET (e.g. `?status=eq.active`).
Without any filter, all rows the caller can see will be updated.

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

camelCase keys in the request body are automatically converted to snake_case.

## Path parameters

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

## Query parameters

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

## Request body

- TableRecord: Generic table record with dynamic fields

## Response `200`

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

- TableRecord[]

## Other responses

- `204`: Records updated successfully (no body)
- `400`: Validation error
- `401`: Unauthenticated and require_auth is enabled
- `403`: Write access denied, or attempt to change the owner field
- `404`: No database found for the given project_id
- `409`: Unique or primary-key constraint violation (duplicate). Branch on HTTP 409; body carries code "23505".
- `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)
