You should be able to get that from the Spotify API endpoint that returns a track's audio analysis.
There’s pitch but that only cares about in which key the frequencies are concentrated (e.g. it tells you that this part of the song has mostly C pitches but not if it’s C2 or C4)