Get email templates from API

I have one email template in my Hubspot Developer Subscription, but if I try to list the templates from the API I don’t get results.

This is the call (take from here List Templates | CMS Templates (hubspot.com) :disappointed_face:

https://api.hubapi.com/content/api/v2/templates
this is the result:

What am I doing wrong?

Hi, @mmaddiona :waving_hand: It’s hard to say without more details.

I ran a quick test and received a successful response. Here’s what I did:

  • Spun up a fresh app test account

  • Created a new Private app with the content scope added

  • Created a dummy template in the Design Manager

  • Used the endpoint you linked GET http://api.hubapi.com/content/api/v2/templates

  • Response

    {
     "limit": 100,
     "objects": [
     {
     "amp_validated": false,
     "attached_amp_stylesheet": 0,
     "attached_js": [],
     "attached_stylesheets": [],
     "body": {
     "folder": "",
     "cdn_minified_url": null,
     "cdn_url": "",
     "has_user_changes": true,
     "screenshot_path": null,
     "hidden_sections": [],
     "hidden_modules": [],
     "has_style_tag": false,
     "has_menu_tag": false
     },
     "category": 1,
     "category_id": 1,
     "cdn_minified_url": "",
     "cdn_url": "",
     "content_tags": [],
     "created": 1674692252784,
     "created_by_id": 10233975,
     "default": false,
     "deleted": false,
     "deleted_at": 0,
     "description_i18n_key": "",
     "filename": "Testerr.html",
     "folder": "",
     "folder_id": 99941125288,
     "folder_path": "",
     "has_dnd_area": true,
     "has_style_tag": false,
     "host_template_types": [
     "ANY"
     ],
     "id": 99932590115,
     "inherited_asset": false,
     "is_available_for_new_content": true,
     "is_from_layout": false,
     "is_read_only": false,
     "label": "Testerr.html",
     "meta": {
     "hasBufferedChanges": false
     },
     "missing": false,
     "path": "/Testerr.html",
     "portal_id": 23869964,
     "purchased": false,
     "release_id": "",
     "size": 854,
     "source": "<!--\n templateType: page\n isAvailableForNewContent: true\n-->\n<!doctype html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n {% if content.html_title %}<title>{{ content.html_title }}</title>{% endif %}\n <meta name=\"description\" content=\"{{ content.meta_description }}\">\n {{ standard_header_includes }}\n </head>\n <body>\n {% dnd_area \"dnd_area\"\n label=\"Main section\"\n %}\n {% dnd_section %}\n {% dnd_column %}\n {% dnd_row %}\n\n {% dnd_module path=\"@hubspot/logo\" %}\n {% end_dnd_module %}\n\n {% end_dnd_row %}\n {% dnd_row %}\n\n {% dnd_module path=\"@hubspot/rich_text\" %}\n {% end_dnd_module %}\n\n {% end_dnd_row %}\n {% end_dnd_column %}\n {% end_dnd_section %}\n {% end_dnd_area %}\n {{ standard_footer_includes }}\n </body>\n</html>",
     "template_source": "STANDARD",
     "template_type": 4,
     "type": "",
     "updated": 1674692252784,
     "updated_by_id": 10233975
     }
     ],
     "offset": 0,
     "total": 1
    }
    

I hope this helps get you moving forward.

Best,

Jaycee

Thank you Jaycee for the answer.
I was talking about the templates that I can find on my Hubspot on Conversations/Templates:

Is there a way to retrieve these?

Hi Jaycee!

I have the same problem.

I’m creating a new template via the API https://api.hubapi.com/content/api/v2/templates, but I don’t see it in the list Message templates. Conversely, I do not see templates created in the UI through the API.

What am I doing wrong?

Hello!
I have a same problem.

I have 3 templates but the get request to this endpoint

http://api.hubapi.com/content/api/v2/templates

The response is exactly a same of marco
{“limit”:100,“objects”:[],“offset”:0,“total”:0}
any help please?