The official bitcoin client (and all its alt forks) runs as a JSON-RPC server. It also runs as a graphical and/or command-line client for said server. You can thus communicate directly, or you can script calls of the command-line client (which gives back the direct JSON responses.) There are also plenty of language libraries that wrap the JSON-RPC calls.
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls... https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)
I find the naming of the API a little peculiar, but it's simple enough.