Magnetic declination, sometimes called magnetic variation, is the angle between magnetic north and true north. Declination is positive east of true north and negative when west. Magnetic declination changes over time and with location. As the compass points with local magnetic fields, declination value is needed to obtain true north.
This is the definition provided by National Center For Environmental Information.
As you can read, magnetic declination depends on location (lat/lon) and time but I would like to know if it also depends on the altitude and why it does or does not.
Note: possibly attach some reference to the answer.