# Keep a reusable message body

Saves a reusable email or text body with `{{placeholders}}` in it — the words a workspace uses over and over, filled in per record later. Body: `channel` ("email" or "sms"), `name` (required, one per channel), `category`, `subjectTemplate`, `greetingTemplate`, `bodyTemplate` (required), `closingTemplate`, `bodyFormat` ("text" or "html"), `entityKind` (which record kind it is written about) and `isDefault`. A text is body-only and an email must carry a subject line; every placeholder name must be one `get_message-placeholders` knows. Nothing goes out from here — a template is words waiting to be filled in: `post_message-drafts` queues a real letter for a person to approve, `post_blasts` aims the same words at a whole list of people, and `post_message-automation-rules` has a template used whenever something happens to a record. One letter to one person right now is the comms surface's, not this one.

Access class: `workspace`.

## Endpoint

`POST /v1/message-templates`

## Request body

Content type: `application/json`.

```json
{
  "body": {
    "bodyFormat": "string",
    "bodyTemplate": "string",
    "category": "string",
    "channel": "string",
    "closingTemplate": "string",
    "documentType": "string",
    "entityKind": "string",
    "greetingTemplate": "string",
    "isDefault": true,
    "name": "string",
    "subjectTemplate": "string"
  },
  "params": {},
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "bodyFormat": "string",
    "bodyTemplate": "string",
    "category": "string",
    "channel": "string",
    "closingTemplate": "string",
    "createdAt": "string",
    "createdByUserId": 1,
    "detail": {},
    "documentType": "string",
    "entityKind": "string",
    "greetingTemplate": "string",
    "id": 1,
    "isActive": true,
    "isDefault": true,
    "name": "string",
    "subjectTemplate": "string",
    "updatedAt": "string"
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
