- The API is the type of classes/interfaces/methods/... that you call and apply to obtain an aim, and
- the SPI is the kind of classes/interfaces/methods/... that you reach and perform to reach an object.
Put otherwise, the API shows you what a particular class/method does for you, and the SPI shows you what you must do to conform.
Usually, API and SPI are separate. For example, in JDBC the Driver class is a portion of the SPI: If you completely want to use JDBC, you don't require to use it immediately, but everyone who completes a JDBC driver must implement that class.
Sometimes all overlap, however. The Connection interface is both SPI and API: You apply it routinely while you use a JDBC driver and it needs to be performed by the developer of the JDBC driver.