Functions

Fetch next.tags

Labels cached data for later invalidation. Tags are not access controls. Fetch docs specify 256 characters per tag and up to 128 tags. Source: https://nextjs.org/docs/app/api-reference/functions/fetch

Formal Syntax & Structure

nextjs syntaxnextjs
fetch(url, { cache: 'force-cache', next: { tags: ['catalog'] } })

Working Example

Example Snippetnextjs
// Partial server helper; the local origin is provided by the V6 lab.export async function readPublicCatalog() {  const response = await fetch('http://127.0.0.1:4317/catalog', {    cache: 'force-cache', next: { tags: ['catalog'] }  });  if (!response.ok) throw new Error('Catalog unavailable');  return response.json(); // validate before rendering real external data}
Next.js Reference