I want to have a program I'm writing interact with the Internet exclusively through Tor. After perusing the Tor project's documentation it appears that they do not specify the API anywhere i.e. how a program can talk to Vidalia to access the Internet through Tor. This is much talk about proxies but I don't care about that approach. I don't want to have the option of using the Internet without Tor. I only want to use Tor. Where is the API? Thanks.

  • The answer about Proxies is correct. Vidalia is jut one interface for viewing the status of Tor, starting and stopping it, etc. arm is another such interface. To connect to the internet through Tor you use the SOCKS4a or SOCKS5 proxy which it provides. You don't have to provide the user with an option to turn that off. Vidalia isn't related to what you want to do. – Sam Whited Oct 14 '13 at 16:51

To have your program use the Internet through Tor, just teach it to use Tor as a SOCKS4a or a SOCKS5 proxy.

The Wikipedia page on SOCKS should have the information you need.


While nickm's answer of "Use SOCKS, that's what it's there for" is correct, I think you might be asking the wrong question. If you want to get information about other aspects of Tor, but don't want to perform queries, implement SOCKS, etc. yourself, you can always use one of the existing libraries. In Python, for instance, you can use Stem.

If you're wanting to control Tor yourself, you can read up on the control protocol.

I've marked this answer CW; if anyone knows other API's designed for interacting with Tor please list them below:

  • No, you're wrong. I want to make queries. – Friendly Oct 29 '13 at 14:54
  • Ah, gotcha, in that case you might want to clarify your original question to make it easier for other people to find it (when searching via a search engine for instance). – Sam Whited Oct 29 '13 at 17:34
  • We maintain jtorctl now in a separate git repo: github.com/guardianproject/jtorctl – Hans-Christoph Steiner Sep 16 '15 at 13:34
  • 1
    @Hans-ChristophSteiner This answer is marked as community wiki, so feel free to update the link :) – Sam Whited Sep 16 '15 at 17:49

For a tutorial on client usage through tor see here. Stem is one of the most feature complete controller libraries, but there's certainly others available too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.