# Delete Column

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

## Description
Delete a column from the table schema. This removes the column definition and strips the corresponding key from all existing row data. Cannot delete the last remaining column.

## Parameters

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

## Request Body

```json
{
  "type": "object",
  "required": [
    "workspaceId",
    "columnName"
  ],
  "properties": {
    "workspaceId": {
      "type": "string",
      "description": "The workspace ID"
    },
    "columnName": {
      "type": "string",
      "description": "Name of the column to delete"
    }
  }
}
```

## Responses

### 200 — Column deleted successfully

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "data": {
      "type": "object",
      "properties": {
        "columns": {
          "type": "array",
          "items": {
            "type": "object",
            "description": "Definition of a table column including its type and constraints.",
            "required": [
              "name",
              "type"
            ],
            "properties": {
              "name": {
                "type": "string",
                "description": "Column name. Must start with a letter or underscore.",
                "example": "email",
                "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
              },
              "type": {
                "type": "string",
                "enum": [
                  "string",
                  "number",
                  "boolean",
                  "date",
                  "json"
                ],
                "description": "Data type of the column."
              },
              "required": {
                "type": "boolean",
                "description": "Whether the column requires a value on insert.",
                "default": false
              },
              "unique": {
                "type": "boolean",
                "description": "Whether values in this column must be unique across all rows.",
                "default": false
              }
            }
          }
        }
      }
    }
  }
}
```

### 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."
    }
  }
}
```

### 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."
    }
  }
}
```
