Skip to main content
Solved

Universal Content API not returning HTML of section


Forum|alt.badge.img+1

I’m attempting to use the new Universal Content APIs to fetch universal content blocks for a brand (https://developers.klaviyo.com/en/reference/get_all_universal_content). I’m trying to render the block outside of Klaviyo, but the response from the API seems to not include any information about the actual content of the block (e.g the HTML that backs it). Here’s an example response I get from hitting the endpoint:

Request:

 

curl --request GET \
  --url 'https://a.klaviyo.com/api/template-universal-content?=&page%5Bsize%5D=20' \
  --header 'Authorization: Klaviyo-API-Key pk_xxx' \
  --header 'Content-Type: application/json' \
  --header 'accept: application/json' \
  --header 'revision: 2024-10-15'

Response:

{
	"data": [
		{
			"type": "template-universal-content",
			"id": "xxx",
			"attributes": {
				"name": "Products",
				"definition": {
					"content_type": "block",
					"type": "product",
					"data": null
				},
				"created": "2025-02-06T12:52:13.422807+00:00",
				"updated": "2025-02-06T12:52:16.070859+00:00",
				"screenshot_status": "completed",
				"screenshot_url": "https://klaviyo-template-thumbnails.s3.amazonaws.com/saved_content/xxx"
			},
			"links": {
				"self": "https://a.klaviyo.com/api/template-universal-content/xxx/"
			}
		}
	],
	"links": {
		"self": "https://a.klaviyo.com/api/template-universal-content?page%5Bsize%5D=20",
		"next": null,
		"prev": null
	}
}

 

So a few questions:

  1. Is it expected that this is the only data returned in the response? The documentation (https://developers.klaviyo.com/en/reference/universal_content_api_overview) seems to indicate that `data` returns either the text or HTML of the block, so I was expecting the HTML of the content to be returned (or something I can use besides a representative screenshot), but perhaps I’m misunderstanding how it works.
  2. If it’s not expected, when are the various optional parameters in `data` returned? 

Best answer by retention

Hi ​@jason.brooks, welcome to the community!

My understanding is that the only universal content blocks thats supported by the API at the time are Text and HTML Blocks.   

See here:

https://developers.klaviyo.com/en/docs/changelog_#universal-content-api-1

Universal Content API

  • You can now create, read, update, and delete Universal Content through our Universal Content APIs.
    Only text blocks, which can include text or HTML, are supported for create and update at this time.

 

If you’re getting null or empty string values, it’s possible that those are other types of Blocks (e.g. Button, Image, etc).  I could be wrong about this, but try seeing if Text Blocks (or HTML Blocks) return the expected String Value.

You can see the documentation overview about “Universal Blocks API” here:

 

View original
Did this topic or the replies in the thread help you find an answer to your question?

3 replies

retention
Partner - Platinum
Forum|alt.badge.img+62
  • 2025 Champion
  • 920 replies
  • Answer
  • February 6, 2025

Hi ​@jason.brooks, welcome to the community!

My understanding is that the only universal content blocks thats supported by the API at the time are Text and HTML Blocks.   

See here:

https://developers.klaviyo.com/en/docs/changelog_#universal-content-api-1

Universal Content API

  • You can now create, read, update, and delete Universal Content through our Universal Content APIs.
    Only text blocks, which can include text or HTML, are supported for create and update at this time.

 

If you’re getting null or empty string values, it’s possible that those are other types of Blocks (e.g. Button, Image, etc).  I could be wrong about this, but try seeing if Text Blocks (or HTML Blocks) return the expected String Value.

You can see the documentation overview about “Universal Blocks API” here:

 


Forum|alt.badge.img+1
  • Author
  • Contributor II
  • 3 replies
  • February 6, 2025

Thanks for the quick reply, ​@retention ! I did see this, but it said  “Only text blocks, which can include text or HTML, are supported for create and update at this time” so I thought for reading, they would all be supported, and that the restrictions were only on creating/changing new blocks. But perhaps that restriction applies to all blocks even on read.

I am seeing data returned on text blocks (and only text blocks).


MANSIR2094
Problem Solver IV
Forum|alt.badge.img+13
  • Problem Solver IV
  • 174 replies
  • February 9, 2025

Hello ​@jason.brooks ,

It looks like the API is returning only metadata and a screenshot URL instead of the expected HTML or text. Here are a few things to check:

 

1. Ensure you’re using the correct API endpoint and request format.

 

2. Try appending include=content to your request to explicitly ask for HTML/text.

 

3. Verify that the content type you're querying supports text/HTML retrieval.

 

4. If content isn’t included, it might be permission-restricted or require additional query parameters.

 

If this still doesn’t return the expected data, reach out for deeper troubleshooting.