Public interfaces & APIs

What is a public interface?

A public interface is a set of code that third-party developers can call, implement, or build as a plug-in
. Magento guarantees that this code will not change in subsequent releases without a major version change.

Public interfaces for a module
are marked with @api annotation.

Third-party developers should use only these interfaces, that is, interfaces with the `@api` annotation. You can use other interfaces but those may be modified or removed in subsequent Magento releases. For more information, see Backward compatibility.

What is an API?

An application programming interface (API) is a set of interfaces and their implementations that a module provides to other modules.

API types

The following items are considered types of APIs:

Directory structure

Configuration files structure

Events

Client API

Provider API
(SPI)

Directory structure and configuration file structure are types of APIs because extension
developers use them. Developers write configurations, and place their static files
in specified folders; so if the configuration file structure or directory structure changes in subsequent releases, modules and extensions may break.