Migrate from Tenor.

Adapt routes, pagination, and media handling to migrate from Tenor to heypster.

Host and API key

Replace https://tenor.googleapis.com with https://heypster-gif.com/giphy. Change the key parameter to api_key and use your heypster key.

cURL · Before and after
# Tenor
curl 'https://tenor.googleapis.com/v2/search?key=YOUR_TENOR_API_KEY&q=cats'

# heypster
curl 'https://heypster-gif.com/giphy/v1/gifs/search?api_key=YOUR_HEYPSTER_API_KEY&q=cats&limit=25&offset=0'

Route mapping

Tenor route mappings
Tenor pathheypster pathUse
/v2/search/v1/gifs/searchKeyword search.
/v2/featured/v1/gifs/trendingDiscovery feed.
/v2/categories/v1/gifs/categoriesCategories.
/v2/autocomplete/v1/gifs/search/tagsAutocomplete.
/v2/search_suggestions/v1/tags/related/{term}Suggestions related to a term.
/v2/trending_terms/v1/trending/searchesTrending terms.
/v2/search?random=true/v1/gifs/randomSingle GIF.
/v2/posts?ids=…/v1/gifs?ids=…Multiple GIFs by ID.
/v2/anonid/v1/randomidGet a random ID.

Parameter changes

Tenor parameters and fields
TenorheypsterMigration notes
keyapi_keyReplace the parameter name and key value.
qqKeep the search term.
posoffsetUse a numeric offset.
limitlimitSet the desired page size.
contentfilterratingThe Tenor guide mentions this mapping. Check the behavior of the route you use before adopting this filter.
anon_id / anonid/v1/randomidCheck whether your integration still needs a random ID.
media_formatsimagesChoose from the renditions in the response.

Pagination

Tenor sends the next cursor in pos on the next request. With heypster, start at offset=0, then add pagination.offset and pagination.count. Stop at the end of the collection or when a page has no results.

JavaScript · Calculate the next offset
function getNextOffset(pagination) {
  if (!pagination || pagination.count === 0) return null;
  const next = pagination.offset + pagination.count;
  return next < pagination.total_count ? next : null;
}

Read responses

Response fields
Tenorheypster
results[]data[]
nextpagination.offset + pagination.count
results[].media_formatsdata[].images
results[].content_ratingdata[].rating
results[].title / content_descriptiondata[].title
JSON · Empty collection example
{
  "data": [],
  "pagination": {
    "total_count": 0,
    "count": 0,
    "offset": 0
  },
  "meta": {
    "status": 200,
    "msg": "OK",
    "response_id": "example-response"
  }
}

View a full result with media renditions

Formats and renditions

Rendition mapping
Tenor renditionheypster fieldUse
gifimages.original.urlMain GIF.
tinygifimages.fixed_width.url or images.fixed_height.urlGrid or picker.
mediumgifimages.downsized.urlOptimized GIF.
previewimages.preview_gif.urlGIF preview.

For H.264 video, read images.original.mp4 or images.preview.mp4, depending on your use case.

Sharing

The heypster reference documents no equivalent for /v2/registershare. Remove this request from the heypster adapter. If your app relies on it, handle sharing separately. /v1/randomid returns an ID and does not replace a share event.

JavaScript example

JavaScript · Paginated search
export async function searchGifs(query, apiKey, offset = 0, limit = 25) {
  const url = new URL('https://heypster-gif.com/giphy/v1/gifs/search');
  url.search = new URLSearchParams({
    api_key: apiKey,
    q: query,
    limit: String(limit),
    offset: String(offset),
  });

  const response = await fetch(url);
  if (!response.ok) throw new Error('HTTP ' + response.status);

  const { data, pagination, meta } = await response.json();
  let nextOffset = null;
  if (pagination && pagination.count > 0) {
    const next = pagination.offset + pagination.count;
    if (next < pagination.total_count) nextOffset = next;
  }

  return { items: data, nextOffset, meta };
}

Verify the migration

  1. Check the new host, the heypster key, and the routes your app calls.
  2. Browse multiple pages, including a short page and the end of the results.
  3. Update response handling and test every format your interface uses.
  4. Check content filtering and sharing separately if your code relies on them.