Terra API works by providing a set of functions and endpoints that developers can utilize to interact with the Terra blockchain, such as retrieving account information, executing transactions, or querying blockchain data, enabling the integration of Terra's functionality into external applications.