A: Yes, the API itself is legal. It is simply a technology. What makes the use of the API illegal is the copyright status of the content being streamed. Using the API to watch a paid streaming service you have a subscription to is fine. Using it to watch premium channels you haven't paid for is piracy.
When a compatible app logs in using these credentials, it initiates a structured data exchange: xtream code club