# Change a template

`PATCH /org/{orgId}/templates/{id}` · Rivier · workspace

Change a template; fields left out stay as they are. An editor changes templates they made, an admin any.

- Scope: workspace:write
- Mcp: rivier_templates_update
- Graphql: Mutation.workspaceOrgTemplateUpdate
- Sdk: workspace.orgTemplate.update
- Cli: templates update

## Parameters

- `orgId` (path, required), string
- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "layout": {
      "type": "string",
      "enum": [
        "minimal",
        "classic",
        "modern",
        "bold"
      ]
    },
    "useCase": {
      "type": "string",
      "maxLength": 60
    },
    "language": {
      "type": "string",
      "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
      "maxLength": 20
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60
          },
          "type": {
            "type": "string",
            "enum": [
              "header",
              "parties",
              "meta",
              "intro",
              "section",
              "lines",
              "totals",
              "payment",
              "terms",
              "acceptance",
              "footer"
            ]
          },
          "title": {
            "type": "string",
            "maxLength": 200,
            "default": ""
          },
          "body": {
            "type": "string",
            "maxLength": 10000,
            "default": ""
          }
        },
        "required": [
          "id",
          "type"
        ],
        "additionalProperties": false
      },
      "maxItems": 60
    },
    "linePresets": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "maxLength": 500,
            "default": ""
          },
          "quantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 1000000,
            "default": 1
          },
          "unit": {
            "type": "string",
            "maxLength": 40,
            "default": ""
          },
          "unitPriceMinor": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1000000000000,
            "default": 0
          }
        },
        "additionalProperties": false
      },
      "maxItems": 100
    },
    "terms": {
      "type": "string",
      "maxLength": 20000
    },
    "paymentDetails": {
      "type": "string",
      "maxLength": 4000
    },
    "emailSubject": {
      "type": "string",
      "maxLength": 300
    },
    "emailBody": {
      "type": "string",
      "maxLength": 10000
    }
  },
  "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 PATCH 'https://api.rivier.ai/org/{orgId}/templates/{id}' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "layout": "minimal",
  "useCase": "string",
  "language": "string",
  "blocks": [
    {
      "id": "string",
      "type": "header"
    }
  ],
  "linePresets": [
    {
      "description": "",
      "quantity": 1,
      "unit": "",
      "unitPriceMinor": 0
    }
  ],
  "terms": "string",
  "paymentDetails": "string"
}'
```
