## Create Session

**post** `/print-mail/v1/template_editor_sessions`

Create a Template Editor Session.

Note that if no `backURL` is supplied, PostGrid removes the Back button
from the editor page. This is ideal for when you `iframe` the editor.

### Body Parameters

- `template: string`

  ID of the underlying template that this edits.

- `backURL: optional string`

  The URL supplied when this editor session was created.

- `styles: optional object { canvas, panelText, saveButton }`

  Style overrides for the template editor session.

  - `canvas: optional object { backgroundColor }`

    Style overrides for the template editor canvas.

    - `backgroundColor: optional string`

      The canvas background color.

  - `panelText: optional object { color }`

    Style overrides for template editor panel text.

    - `color: optional string`

      The panel text color.

  - `saveButton: optional object { backgroundColor, textColor }`

    Style overrides for the template editor save button.

    - `backgroundColor: optional string`

      The save button background color.

    - `textColor: optional string`

      The save button text color.

- `title: optional string`

  The title supplied when this editor session was created.

- `trackers: optional "all" or "none" or array of string`

  Controls which Trackers are displayed in the template editor session.

  - `"all" or "none"`

    - `"all"`

    - `"none"`

  - `array of string`

### Returns

- `id: string`

  A unique ID prefixed with `template_editor_session_`.

- `createdAt: string`

  The UTC time at which this session was created.

- `live: boolean`

  `true` if this is a live mode session else `false`.

- `object: "template_editor_session"`

  Always `template_editor_session`.

  - `"template_editor_session"`

- `template: string`

  ID of the underlying template that this edits.

- `url: string`

  A URL that can be iframed or redirected to for editing the template.

- `backURL: optional string`

  The URL supplied when this editor session was created.

- `styles: optional object { canvas, panelText, saveButton }`

  Style overrides for the template editor session.

  - `canvas: optional object { backgroundColor }`

    Style overrides for the template editor canvas.

    - `backgroundColor: optional string`

      The canvas background color.

  - `panelText: optional object { color }`

    Style overrides for template editor panel text.

    - `color: optional string`

      The panel text color.

  - `saveButton: optional object { backgroundColor, textColor }`

    Style overrides for the template editor save button.

    - `backgroundColor: optional string`

      The save button background color.

    - `textColor: optional string`

      The save button text color.

- `title: optional string`

  The title supplied when this editor session was created.

- `trackers: optional "all" or "none" or array of string`

  Controls which Trackers are displayed in the template editor session.

  - `"all" or "none"`

    - `"all"`

    - `"none"`

  - `array of string`

### Example

```http
curl https://api.postgrid.com/print-mail/v1/template_editor_sessions \
    -H 'Content-Type: application/json' \
    -H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY" \
    -d '{
          "template": "template_eYxcbMKPZEZPk71ZJPA6Yz"
        }'
```

#### Response

```json
{
  "id": "template_editor_session_bBYRQ5DKu3LJ5yNemoAQ7E3or6E7Yzd7FGNWJSXBRrAfcdoNXNGLvfZxAm2dJYiv9c",
  "object": "template_editor_session",
  "live": false,
  "template": "template_eYxcbMKPZEZPk71ZJPA6Yz",
  "backURL": "https://postgrid.com",
  "title": "My Editor Session",
  "trackers": [
    "tracker_123456789abcdefghijklmnopqrstuvwxyz"
  ],
  "url": "https://dashboard.postgrid.com/embed/template_editor_sessions/template_editor_session_bBYRQ5DKu3LJ5yNemoAQ7E3or6E7Yzd7FGNWJSXBRrAfcdoNXNGLvfZxAm2dJYiv9c",
  "createdAt": "2023-07-05T19:36:01.369Z"
}
```
