# Delete Rows

`DELETE /api/v1/tables/{tableId}/rows`

## Description
Delete rows by filter criteria or by an explicit list of row IDs. Pass either a `filter` object or a `rowIds` array.

## Parameters

- **tableId** (path) (required) — `string`: The unique identifier of the table.

## Request Body

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "workspaceId",
        "filter"
      ],
      "description": "Delete by filter.",
      "properties": {
        "workspaceId": {
          "type": "string",
          "description": "The workspace that owns the table."
        },
        "filter": {
          "type": "object",
          "additionalProperties": true,
          "description": "Filter criteria to match rows for deletion."
        },
        "limit": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "description": "Maximum number of rows to delete. Defaults to all matching rows, capped at 1000."
        }
      }
    },
    {
      "type": "object",
      "required": [
        "workspaceId",
        "rowIds"
      ],
      "description": "Delete by IDs.",
      "properties": {
        "workspaceId": {
          "type": "string",
          "description": "The workspace that owns the table."
        },
        "rowIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "maxItems": 1000,
          "description": "Explicit list of row IDs to delete (max 1000)."
        }
      }
    }
  ]
}
```

## Responses

### 200 — Rows deleted.

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean",
      "description": "Indicates whether the request was successful."
    },
    "data": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string",
          "description": "Confirmation message describing how many rows were deleted."
        },
        "deletedCount": {
          "type": "integer",
          "description": "Number of rows that were deleted."
        },
        "deletedRowIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Array of IDs for each row that was deleted."
        },
        "requestedCount": {
          "type": "integer",
          "description": "Number of row IDs requested for deletion (only present when deleting by IDs)."
        },
        "missingRowIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Row IDs that were requested but not found (only present when deleting by IDs)."
        }
      },
      "description": "Response payload."
    }
  }
}
```

### 400 — Invalid request parameters. Check the details array for specific validation errors.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message describing the validation failure."
    },
    "details": {
      "type": "array",
      "description": "List of specific validation errors with field-level details.",
      "items": {
        "type": "object"
      }
    }
  }
}
```

### 401 — Invalid or missing API key. Ensure the X-API-Key header is set with a valid key.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message."
    }
  }
}
```

### 403 — Access denied. You do not have permission to access this resource. For audit log endpoints, this requires an Enterprise subscription and organization admin/owner role.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message."
    }
  }
}
```

### 404 — The requested resource was not found. Verify the ID is correct and belongs to your workspace.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message."
    }
  }
}
```

### 429 — Rate limit exceeded. Wait for the duration specified in the Retry-After header before retrying.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message with rate limit details."
    }
  }
}
```
