# Make a template

`POST /org/{orgId}/templates` · Rivier · workspace

Make a template: by hand, from a gallery starter (fromGallery), or from a document's content (a body with lines, which drops any tax field on them). Editor and above.

- Scope: workspace:write
- Mcp: rivier_templates_create
- Graphql: Mutation.workspaceOrgTemplateCreate
- Sdk: workspace.orgTemplate.create
- Cli: templates create

## Parameters

- `orgId` (path, required), string

## Request body

`application/json`

```json
{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "quote",
            "proposal",
            "invoice"
          ]
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "layout": {
          "type": "string",
          "enum": [
            "minimal",
            "classic",
            "modern",
            "bold"
          ],
          "default": "minimal"
        },
        "language": {
          "type": "string",
          "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
          "maxLength": 20,
          "default": "en"
        },
        "useCase": {
          "type": "string",
          "maxLength": 60,
          "default": ""
        },
        "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,
          "default": []
        },
        "lines": {
          "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,
          "default": []
        },
        "terms": {
          "type": "string",
          "maxLength": 20000,
          "default": ""
        },
        "paymentDetails": {
          "type": "string",
          "maxLength": 4000,
          "default": ""
        },
        "emailSubject": {
          "type": "string",
          "maxLength": 300,
          "default": ""
        },
        "emailBody": {
          "type": "string",
          "maxLength": 10000,
          "default": ""
        }
      },
      "required": [
        "kind",
        "name"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "quote",
            "proposal",
            "invoice"
          ]
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "layout": {
          "type": "string",
          "enum": [
            "minimal",
            "classic",
            "modern",
            "bold"
          ],
          "default": "minimal"
        },
        "useCase": {
          "type": "string",
          "maxLength": 60,
          "default": ""
        },
        "language": {
          "type": "string",
          "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
          "maxLength": 20,
          "default": "en"
        },
        "fromGallery": {
          "type": "string",
          "maxLength": 80
        },
        "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
        }
      },
      "required": [
        "kind",
        "name"
      ],
      "additionalProperties": false
    }
  ]
}
```

## Responses

- `201`: 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 POST 'https://api.rivier.ai/org/{orgId}/templates' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "kind": "quote",
  "name": "string"
}'
```
