---
title: "Execute one bounded database write in Dev or Prod"
method: POST
path: "/v1/projects/{project_id}/database/write"
---

# Execute one bounded database write in Dev or Prod

`POST /v1/projects/{project_id}/database/write`

## Request

- Base URL: `https://app.ohmyho.st`
- URL: `https://app.ohmyho.st/v1/projects/{project_id}/database/write`
- Auth: HTTP bearer

Owner-authorized INSERT, UPDATE or DELETE through the restricted runtime role, including ordinary upsert. Environment is mandatory. One direct statement and transaction, five-second timeout and at most 1000 directly affected rows; customer triggers and cascades may affect more rows. Rows are not returned. The durable Idempotency-Key receipt persists until project deletion. Same-key retries observe the original execution attempt; unknown outcomes never automatically execute again. Inspect target data before deliberately choosing a new key. Schema changes use GitHub migrations. Database compute is metered normally and existing credit grace and Stop budgets apply. Application row-level security policies remain effective for writes.

## Path parameters

- `project_id` string, required

## Headers

- `X-Request-Id` string
- `Idempotency-Key` string, required

## Request body

- ProjectDatabaseWriteRequest
  - `environment` 'dev' | 'prod', required
  - `statement` string, required: One direct INSERT, UPDATE or DELETE, max 64 KiB UTF-8; entire JSON request is limited to 65,600 bytes.
  - `parameters` unknown[], required: JSON values, at most 8 levels and 10000 nodes, max 64 KiB encoded.
    - unknown

## Response `200`

Terminal receipt; failed state is not a successful write.

- ProjectDatabaseWriteReceipt
  - `operation_id` string, required
  - `environment` 'dev' | 'prod', required
  - `state` 'running' | 'succeeded' | 'failed', required
  - `command` 'INSERT' | 'UPDATE' | 'DELETE' | 'null', nullable, required
  - `affected_rows` integer, nullable, required
  - `error` OperationFailure, required
    - `code` 'operation_failed' | 'operation_abandoned' | 'authorization_changed' | 'source_commit_conflict' | 'source_snapshot_invalid' | 'source_upload_expired' | 'recovery_dispatch_failed' | 'recovery_job_failed' | 'recovery_input_expired' | 'recovery_database_unavailable' | 'recovery_checksum_mismatch' | 'recovery_scope_unavailable' | 'recovery_archive_too_large' | 'build_not_started' | 'build_failed' | 'database_write_rejected' | 'database_write_unavailable' | 'database_write_outcome_unknown' | 'database_compute_failed' | 'database_compute_plan_changed' | 'database_compute_rejected' | 'database_migration_failed' | 'insufficient_organization_credits' | 'paid_plan_required' | 'runtime_candidate_failed' | 'runtime_candidate_rejected' | 'storage_jurisdiction_conflict' | 'provider_state_absent' | 'auto_deploy_plan_rejected' | 'promotion_source_stale' | 'promotion_target_stale', required
    - `message` string, required
    - `retryable` false, required: A terminal operation cannot be retried in place; follow suggested_action.
    - `suggested_action` string, required
    - `detail` string: Present only on auto_deploy_plan_rejected when planning the pushed commit returned a typed refusal. It is the same fixed catalog sentence that the planning 409 problem returns as detail, naming the file, the rule and the required change.

## Other responses

- `202`: The same write is in progress. Poll the existing operation.
- `400`: The request failed.
- `401`: The request failed.
- `402`: The request failed.
- `404`: The resource does not exist or is not visible to the authenticated principal.
- `409`: The request failed.
- `429`: The request failed.
- `503`: The request failed.

---

[API](https://skmtc.dev/ohmyho/apis/ohmyho-st-api.md) · [All operations](https://skmtc.dev/ohmyho/apis/ohmyho-st-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ohmyho/apis/ohmyho-st-api/revisions/d069888c0017?raw)
