API and SDK are words we always see in programming and IT. Many end up understanding the concept, but don't know exactly what's the difference between them.
An API (Application Programming Interface), is a communication interface for some kind of service. While an SDK (Software Development Kit), is a toolkit that can contain APIs for a specific demand.
Although SDKs can contain APIs, not all APIs are part of an SDK.
When we quickly analyze both terms, it seems that they do pretty much the same thing, but we will explain below in more detail what's the use of each one.
API vs SDK for dummies
If you are looking for a non-technical explanation about the difference between API and SDK, then let's use an analogy, imagine we need to build a car.
For a car to work, we need a series of components, engine, suspension, wheels, steering wheel, transmission, etc. This "kit" of components would be the SDK, while the API would be just the transmission from the engine to the wheels, for example.
The API only represents the communication between one application and another, or between different components, while the SDK is a series of pre-established components that can be assembled or customized to build a software product.
Although this is an impractical analogy, it helps to understand the concept of the two things and the difference between API and SDK.
What is an API?
API is an acronym for Application Programming Interface. API, therefore, is a communication interface. Basically, APIs are used for applications to communicate with each other. An application can provide an API so that other applications can communicate with it.
For example, Google Maps has an API that allows other sites or applications to use the features in the Google Maps service. For that, the apps or websites that implement the Google Maps API, need to correctly specify the data structures, protocols, and routines required by Google Maps through its API.
The goal of an API, then, is simply to establish the "rules" of communication between one application and another. Who will decide these rules is the developer that provides the API, in the case of our example, Google Maps.
There are APIs that are language dependent like, for example, the Java API, and there are APIs that can be used with multiple different programming languages, just by following the same data structures and routines pre-established by the API provider.
API examples:
What is an SDK?
An SDK is an acronym for Software Development Kit. Therefore, it's a series of tools for software development, serving both the frontend and backend. SDKs can contain one or multiple APIs, libraries, code examples, documentation, etc.
A good example of SDK is the iOS SDK, which is used to create iPhone and iPad apps. It contains APIs for using native device functions, components, libraries, and many other features for developing native iOS applications.
SDKs are usually intended for specific types of software, as in the case of the iOS SDK, we also have the Android SDK, Facebook JavaScript SDK, etc. As the name implies, an SDK is a software development kit, its main function is to make a developer's life easier by providing the basics for the development of a specific software.
SDK examples
When to use SDK and when to use API?
Sometimes we can choose to use only the API or use a full service SDK.
Let's say, for example, you need to implement a translation feature from Amazon Web Services. You can choose either to use the SDK provided by AWS SDK, or read the documentation of the Translation API from AWS, and implement only the API for what you need.
Usually, the SDKs come with a lot of stuff we don't need. It has documentation, example codes, other dependency libraries, etc. that we don't need in our code.
Now that you know that APIs can be contained in SDKs, you can make the best decision if you want to communicate with the translate API through a component present in Amazon's SDK, or simply implement the translate API directly and not include unnecessary packages in your application.
In short, whenever you need to communicate with a service, you will need to use APIs invariably. Most of the time, the API integration will be made available as part of an SDK that you can usually choose to use it or not.