Header-based versioning means the client tells the server which API version it wants by sending a special header, usually the 'Accept' header. The server looks at this header to find the version number, like 'v2'. Then the server uses that version's rules to handle the request and sends back the response in the right format. This way, the URL stays the same, and the version is controlled by headers. In the example, the client sends 'Accept: application/vnd.example.v2+json', so the server uses version 2 logic. The execution table shows each step: receiving the request, checking the header, processing with version 2, and sending the response. Variables like 'api_version' track the version found. This method helps keep APIs clean and flexible.