API Connector Documentation
Import Torn API Data to Google Sheets
In this guide, we’ll walk through how to pull player and market data from the Torn API directly into Google Sheets, using the API Connector add-on.
We'll first get an API key from Torn, and then set up a request to pull in information from Torn to your spreadsheet.
Contents
- Before You Begin
- Part 1: Get your Torn API Key
- Part 2: Pull Torn Data into Sheets
- Part 3: Notes
- Part 4: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get Your Torn API Key
- While logged into Torn, click the Account icon in the top right corner, and then Settings
- From here click API Keys > +Create New Key
- You'll be prompted to name your key and select the level of access you'd like it to have. This page shows which access level corresponds to which data points. Click Add
- Your key is ready! Copy it and keep it safe, we'll use it shortly.
Part 2: Pull Torn Data into Sheets
To use your key, append it to the end of your API request. Here's a complete request configuration example.
- Application:
Custom
- Method:
GET
- Request URL:
https://api.torn.com/market/?selections=itemmarket,timestamp&key=11111111
- OAuth:
None
- Headers:
None
The whole request should look like this:
Part 3: Notes
By default, some of the Torn API's endpoints will return data that gets parsed into separate columns. You can select API Connector's grid report style for a more compact output with fewer columns.
Part 4: API Documentation
Official API documentation: https://www.torn.com/api.html
The Torn API is divided into categories for User, Property, Faction, Company, Market, and Torn. You can retrieve data from any of these categories by entering the associated URL into API Connector.
In the documentation, click the Try It! button for a convenient way to construct and try out requests directly in the browser. That way you can simply copy and paste their auto-created URLs into the API Connector request URL field.
Is it possible to filter the results by gender for example?
I'm also looking for a way to count the number of results.
Thanks
good question, but the API documentation only shows some timestamp and field filters, there's nothing about filtering by gender. You should be able to count results using native Sheets formulas like COUNT().
i want to link my pricelist
Is It possible to log all the attack logs? with the api?
For info on Torn's API, you can check all API endpoints here (click Try It) or ask your question in the Torn API forum.
Can i access my faction main news using the faction api?
I'd ask this on the Torn forum. This looks like a relevant thread: https://www.torn.com/forums.php#/p=threads&f=63&t=16220091&b=0&a=0&start=0&to=21405423
Thanks for doing this - it was really helpful!
I managed to get some of the proposed scripts to work, but the first one responds with:
error.code error.error
16 Access level of this key is not high enough
My API key is set as Limited Access
Looks like they changed their API so you now need to make sure your API key has high enough access. I updated the article to reflect that.
do you know how i can pulll items and there prices into the Google worksheet
This post says you first get an item ID from
https://api.torn.com/torn/?selections=items&key=
, and then fetch prices for that item withhttps://api.torn.com/torn/196?selections=items&key=