Search code examples
apisendgridsendgrid-api-v3

Sendgrid create template and version in one request


I am trying to create template using api request. Response returns json which contains version as well but when i check there isn't any version. In documentation says template_idis required. But i can get it when template will be created.

Actually i am doing 2 request. First one to create template and second one to create version.

How can i create template and version in one request? my request looks like:

{
  "id": "23456789012",
  "name": "23456789012_name",
  "generation": "dynamic",
  "versions": [
      {
        "template_id": "23456789012",
        "active": 1,
        "name": "23456789012_version1",
        "html_content": "some html content",
        "plain_content": "some plain content",
        "subject": "{{subject}}",
        "editor": "design"
      }
   ]
}

Solution

  • I have asked to official sendgrid support. They told it is not possible. But have no idea why they posted it in documentation. So, if someone has same problem, then can check this link.