Depending on your device and its condition, there are several ways to locate this code:
To check your Apple device's serial number and verify its authenticity or warranty status, use the official Apple Check Coverage How to Find Your Serial Number apple serial number check apple
Apple serial number lookup — instantly check device info - Setapp Depending on your device and its condition, there
See if your device is still under Apple’s limited warranty, eligible for AppleCare+, or covered for repairs. eligible for AppleCare+