A canonical URL is the address you want an engine to treat as the true version of a page, when the same content is reachable at more than one URL. You declare it with a link tag in the head, rel canonical, pointing at the chosen address.
Duplication is more common than it looks. A page can be reached with and without a trailing slash, with tracking parameters, at http and https, or served as html and as json. Left alone, engines see several pages, split the signals between them, and may pick the wrong one.
A canonical is a hint, not an order. Engines usually respect it but can ignore it, so back it up: point your internal links at the canonical URL, keep it consistent, and do not canonical a page to one that is genuinely different.
For content you cannot add a link tag to, such as a json or markdown file, set the canonical in the HTTP response header instead, with Link: <url>; rel="canonical". Topkay checks the canonical on a page, tells you where it points, and generates the header form in Fix-it. See also crawl budget.