Actually, Apple only keeps the details about you that are required by law. That is why they have no idea what your Passcode is, have no access to your encrypted data, and also why some complain that their playlists created with Apple Music are not stored by Apple when the subscription is cancelled.
If you purchased it online, you may be able to find the invoice here:
Viewing & Changing Orders - Shopping Help - Apple
If you purchased it at an Apple Store, then contact them immediately. They are only stored for a very short time. As with any purchase, Apple has always recommended that you need to keep your receipt.
Keep your receipt after you buy an Apple device - Apple Support
You might also need the Proof of Coverage letter for AppleCare, and should be able to bring that one up here:
Find information about your warranty or AppleCare plan - Apple Support