This page provides information about the different JSON response and error objects used by the Tenor API.
Response object
The following table provides details on the properties for Response Objects:
Properties | |
---|---|
created |
A Unix timestamp that represents when this post was created. |
hasaudio |
Returns |
id |
Tenor result identifier |
media_formats |
A dictionary with a content format as the key and a Media Object as the value. |
tags |
An array of tags for the post |
title |
The title of the post |
content_description |
A textual description of the content. We recommend that you use |
itemurl |
The full URL to view the post on tenor.com. |
hascaption |
Returns |
flags |
Comma-separated list to signify whether the content is a sticker or static image, has
audio, or is any combination of these. If |
bg_color |
The most common background pixel color of the content |
url |
A short URL to view the post on tenor.com. |
Category object
The following table provides details on the properties for Category Objects:
Properties | |
---|---|
searchterm |
The search term that corresponds to the category. The search term is translated to match
the |
path |
The search URL to request if the user selects the category |
image |
A URL to the media source for the category's example GIF |
name |
Category name to overlay over the image. The name is translated to match the
|
Media object
The following table provides details on the properties for Media Objects:
Properties | |
---|---|
url |
A URL to the media source |
dims |
Width and height of the media in pixels |
duration |
Represents the time in seconds for one loop of the content. If the content is static, the
duration is set to |
size |
Size of the file in bytes |
Content formats
Tenor's API offers the following five base formats in a variety of sizes:
- GIF
- MP4
- WebM
- Transparent WebP
- Transparent GIF
The MP4 and WebM formats play their clip only once, with the exception of the
loopedmp4
, which plays the clip a few times. The GIF format plays its clip on a
continuous loop. The transparent formats are for sticker content and aren't available in GIF
search results.
Format types
The following table provides details on the available media format types for Tenor:
Format types | |
---|---|
preview |
This format is supported for GIFs and stickers. |
gif |
This format is supported for GIFs and stickers. |
mediumgif |
This format is supported for GIFs and stickers. |
tinygif |
This format is supported for GIFs and stickers. |
nanogif |
This format is supported for GIFs and stickers. |
mp4 |
This format is supported for GIFs and stickers. |
loopedmp4 |
This format is supported for GIFs and stickers. |
tinymp4 |
This format is supported for GIFs and stickers. |
nanomp4 |
This format is supported for GIFs and stickers. |
webm |
This format is supported for GIFs and stickers. |
tinywebm |
This format is supported for GIFs and stickers. |
nanowebm |
This format is supported for GIFs and stickers. |
webp_transparent |
This format is supported for stickers. |
tinywebp_transparent |
This format is supported for stickers. |
nanowebp_transparent |
This format is supported for stickers. |
gif_transparent |
This format is supported for stickers. |
tinygif_transparent |
This format is supported for stickers. |
nanogif_transparent |
This format is supported for sticker. |
Best practices
- For mobile, use the nano- or tiny-sized files for previews and the tiny-sized files for shares.
- Set the
media_filter
parameter to the formats you intend to use. This can reduce the API response size by 70%.
Format sizes
The file size for each content format depends on the dimensions and length of the specific GIF selected. Therefore, consider the means and medians provided in the following table as general guidelines rather than hard values.
File format | Mean file size (KB) | Median file size (KB) |
---|---|---|
gif |
3,356 | 956 |
mediumgif |
2,548 | 574 |
tinygif |
521 | 101 |
nanogif |
175 | 56 |
mp4 |
207 | 91 |
loopedmp4 |
515 | 228 |
tinymp4 |
84 | 81 |
nanomp4 |
37 | 28 |
webm |
76 | 61 |
tinywebm |
57 | 45 |
nanowebm |
35 | 25 |
webp_transparent |
530 | 95 |
tinywebp_transparent |
249 | 60 |
nanowebp_transparent |
107 | 25 |
gif_transparent |
643 | 35 |
tinygif_transparent |
349 | 20 |
nanogif_transparent |
116 | 10 |
Response codes
The following table provides the HTTP status response codes used to indicate a successful request:
HTTP status code | |
---|---|
200 or 202 |
OK or accepted |
Errors
Tenor's API returns errors with the HTTP response codes 4xx
or
5xx
and in the standard Google API error format. For details, see
Errors.