In recent years, ptychography has revolutionized x-ray microscopy in that it is able to overcome the diffraction limit of x-ray optics, pushing the spatial resolution limit down to a few nanometers. However, due to the weak interaction of x rays with matter, the detection of small features inside a sample requires a high coherent fluence on the sample, a high degree of mechanical stability, and a low background signal from the x-ray microscope. The x-ray scanning microscope PtyNAMi at PETRA III is designed for high-spatial-resolution 3D imaging with high sensitivity. The design concept is presented with a special focus on real-time metrology of the sample position during tomographic scanning microscopy.