## Create Session

`print_mail.template_editor_sessions.create(TemplateEditorSessionCreateParams**kwargs)  -> TemplateEditorSessionCreateResponse`

**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.

### Parameters

- `template: str`

  ID of the underlying template that this edits.

- `back_url: Optional[str]`

  The URL supplied when this editor session was created.

- `styles: Optional[Styles]`

  Style overrides for the template editor session.

  - `canvas: Optional[StylesCanvas]`

    Style overrides for the template editor canvas.

    - `background_color: Optional[str]`

      The canvas background color.

  - `panel_text: Optional[StylesPanelText]`

    Style overrides for template editor panel text.

    - `color: Optional[str]`

      The panel text color.

  - `save_button: Optional[StylesSaveButton]`

    Style overrides for the template editor save button.

    - `background_color: Optional[str]`

      The save button background color.

    - `text_color: Optional[str]`

      The save button text color.

- `title: Optional[str]`

  The title supplied when this editor session was created.

- `trackers: Optional[Union[Literal["all", "none"], Sequence[str]]]`

  Controls which Trackers are displayed in the template editor session.

  - `Literal["all", "none"]`

    - `"all"`

    - `"none"`

  - `Sequence[str]`

### Returns

- `class TemplateEditorSessionCreateResponse: …`

  - `id: str`

    A unique ID prefixed with `template_editor_session_`.

  - `created_at: datetime`

    The UTC time at which this session was created.

  - `live: bool`

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

  - `object: Literal["template_editor_session"]`

    Always `template_editor_session`.

    - `"template_editor_session"`

  - `template: str`

    ID of the underlying template that this edits.

  - `url: str`

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

  - `back_url: Optional[str]`

    The URL supplied when this editor session was created.

  - `styles: Optional[Styles]`

    Style overrides for the template editor session.

    - `canvas: Optional[StylesCanvas]`

      Style overrides for the template editor canvas.

      - `background_color: Optional[str]`

        The canvas background color.

    - `panel_text: Optional[StylesPanelText]`

      Style overrides for template editor panel text.

      - `color: Optional[str]`

        The panel text color.

    - `save_button: Optional[StylesSaveButton]`

      Style overrides for the template editor save button.

      - `background_color: Optional[str]`

        The save button background color.

      - `text_color: Optional[str]`

        The save button text color.

  - `title: Optional[str]`

    The title supplied when this editor session was created.

  - `trackers: Optional[Union[Literal["all", "none"], List[str], null]]`

    Controls which Trackers are displayed in the template editor session.

    - `Literal["all", "none"]`

      - `"all"`

      - `"none"`

    - `List[str]`

### Example

```python
import os
from postgrid import PostGrid

client = PostGrid(
    print_mail_api_key=os.environ.get("POSTGRID_PRINT_MAIL_API_KEY"),  # This is the default and can be omitted
)
template_editor_session = client.print_mail.template_editor_sessions.create(
    template="template_eYxcbMKPZEZPk71ZJPA6Yz",
    back_url="https://postgrid.com",
    title="My Editor Session",
    trackers=["tracker_123456789abcdefghijklmnopqrstuvwxyz"],
)
print(template_editor_session.id)
```

#### 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"
}
```
