# Per-table write rules; nothing writes without one and an approval

`PUT /datasources/{id}/write-rules` · Rivier · hosting

Per-table write rules; nothing writes without one and an approval.

- Scope: hosting:write
- Sdk: hosting.dataSource.writeRules
- Cli: hosting data source write rules

## Parameters

- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "rules": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "table": {
            "type": "string"
          },
          "ops": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "insert",
                "update"
              ]
            }
          },
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "table",
          "ops",
          "columns"
        ],
        "additionalProperties": false
      },
      "maxItems": 50
    }
  },
  "required": [
    "rules"
  ],
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X PUT 'https://api.rivier.ai/datasources/{id}/write-rules' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "rules": [
    {
      "table": "string",
      "ops": [
        "insert"
      ],
      "columns": [
        "string"
      ]
    }
  ]
}'
```
