Vytvoření šablony

const response = await fetch('https://api.emailit.com/v2/templates', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer em_test_51RxCWJ...vS00p61e0qRE',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Uvítací e-mail',
    alias: 'uvitaci-email',
    from: 'Podpora <podpora@firma.cz>',
    subject: 'Vítejte v naší službě!',
    reply_to: ['podpora@firma.cz'],
    html: '<h1>Vítejte!</h1><p>Děkujeme, že jste se k nám připojili.</p>',
    text: 'Vítejte! Děkujeme, že jste se k nám připojili.',
    editor: 'html'
  })
});

const result = await response.json();

Odpovědi

{
  "data": {
    "id": "tem_47TaFwzJx6mD7NeJYvLjFxVwbgT",
    "name": "Uvítací e-mail",
    "alias": "uvitaci-email",
    "from": "Podpora <podpora@firma.cz>",
    "subject": "Vítejte v naší službě!",
    "reply_to": ["podpora@firma.cz"],
    "html": "<h1>Vítejte!</h1><p>Děkujeme, že jste se k nám připojili.</p>",
    "text": "Vítejte! Děkujeme, že jste se k nám připojili.",
    "editor": "html",
    "published_at": "2025-12-24T10:30:00.000000Z",
    "preview_url": null,
    "created_at": "2025-12-24T10:30:00.000000Z",
    "updated_at": "2025-12-24T10:30:00.000000Z"
  },
  "message": "Šablona byla úspěšně vytvořena."
}