👀 See Sanity in action: Watch product demo now →

API Version Concept Explainer - How API Versions Work

4 replies
Last updated: Apr 25, 2021
Hello can anyone explain me that what is the concept of the API version?
Apr 25, 2021, 9:49 AM
Versioning an API allows Sanity to make improvements and changes that would otherwise break current implementations of the API.
I would think of it like electric cars. The electric car introduced a new technology but it depends on a new fuel source that couldn’t be obtained from a “traditional” gas station. You can’t just change all gas stations to charging stations, since then all the people with cars that use gasoline would have no way of fueling up. Instead, we “version” fueling stations—v1 are gas stations and v2 are electric charging stations—that permit both types of cars to function and fuel up.

Could gas stations have been adapted to charge electric cars (which is kind of like always introducing “upgrades” that never break old versions)? Probably, but that’s terribly inefficient and would require incremental upgrades as society increases its use of electric cars. At some point in the future, when there are no more gasoline cars, you’d still have some archaic throwbacks to those days that don’t make any sense and probably make things harder for people (e.g., a bunch of tanks in the ground). This approach (one version) might have its place, but overall the most efficient approach is having different, dedicated locations/versions.
Apr 25, 2021, 2:59 PM
Thanks a lot,
user A
so, whenever we put a date as our API version so, the changes after that days will not be implemented to my app so that it will help in keeping my app working right?
Apr 25, 2021, 4:37 PM
Yes, that’s correct. You’d be using the most recent API version that was released on or before that date. The only updates to an API version you might expect after-the-fact would be ones that Sanity deems wouldn’t break anything .
Apr 25, 2021, 5:04 PM
Thanks,
user A
Apr 25, 2021, 5:55 PM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in