Welcome to the TornAPI

Usage

Torn's API is split up in sections, with each section having their own unique selections. Selections can be combined, allowing you to query more data while only using a single API call.
Format for the url: https://api.torn.com/:SECTION/:ID?selections=:SELECTIONS&key=:KEY

Common Query Parameters

Query parameters are used to control the data your receive. Some of them are common on all selections or a lot of them.
ParameterDescriptionApplicable
keyRequired api key. Defines the owner and access level.on every section
commentMessage to show in the api usage log. Every character over 10 will not be shown.on every section
selectionsSelect what selections to pull data from. Providing no value will fall back to the default selection, if there is one. Supports multiple values, comma separated.on every section
fromLimits results to have their timestamp after or on this timestamp.where listed
toLimits results to have their timestamp before or on this timestamp.where listed
limitLimits amount of results. Amount can't be above the default amount, will use default amount otherwise.where listed
sortSort your results. Default will be descending.where listed

Automatic Limits

In order to have the game and the api keep running smooth, Torn applies some limits on their api. These limits are all rolling limits, meaning that they don't have a specific reset point.
Call Limit
Each user can make up to 100 requests per minute across all of their keys. Multiple requests using invalid keys may result in a temporary IP ban - you must account for this by removing disabled or invalid keys upon error.
IP Limit
Alongside the call limit per user, there is also an IP limit of 1,000 calls a minute on a single IP.
Cloud Limit
Some data is stored in the cloud. Endpoints that pull that data have an additional limit of 50,000 rows a day (rolling 24 hours), for a specific category. These limits also exist in-game, but they are now separated and reaching the api limit will no longer. The different categories are faction news, events, activity log and personal stats.
Cache
Calls to the API are cached. This cache lasts 29 seconds, so you can space your calls 30 seconds between them. Changing the section, selection or id will have a different cache, but other parameters like to and from won't. Like always, there are exceptions to this which will be documented on the specific selections.

Access Levels

Which selections can be accessed using a specific API key depends on their access levels. There exist 4 predefined access levels, namely public, minimal access, limited access and full access.

It's also possible to create an API key with custom access, using https://www.torn.com/preferences.php#tab=api?step=addNewKey with query parameters. These parameters are title and the separate sections, like user, where the value is a comma-separated list of selections. Custom keys have access to all public selections.
Example: https://www.torn.com/preferences.php#tab=api?step=addNewKey&title=TornAPI&user=basic,bars,cooldowns,notifications&faction=basic,contributors&torn=bank

We provide a key builder for making those links easier.

Key Level
Public
Minimal Access
Limited Access
Full Access
userpropertyfactioncompanymarkettornkey
ammolookupapplicationsapplicationsbazaarbankinfo
attackspropertyarmorcompaniesitemmarketcards
attacksfulltimestamparmorynewsdetailedlookupchainreport
barsattacknewsemployeespointsmarketcityshops
basicattackslookuptimestampcompanies
battlestatsattacksfullnewscompetition
bazaarbasicprofiledirtybombs
cooldownsboostersstockeducation
crimescachestimestampfactiontree
criminalrecordcesiumgyms
discordchainhonors
displaychainreportitemdetails
educationchainsitems
equipmentcontributorsitemstats
eventscrimeexplogcategories
gymcrimenewslogtypes
hofcrimeslookup
honorscurrencymedals
iconsdonationsorganisedcrimes
inventorydrugspawnshop
jobpointsfundsnewspokertables
loglookupproperties
lookupmainnewsrackets
medalsmedicalraidreport
meritsmembershipnewsraids
messagespositionsrankedwarreport
missionsrankedwarsrankedwars
moneyreportsrockpaperscissors
networthrevivessearchforcash
neweventsrevivesfullshoplifting
newmessagesstatsstats
notificationstemporarystocks
perksterritoryterritory
personalstatsterritorynewsterritorynames
profiletimestampterritorywarreport
propertiesupgradesterritorywars
publicstatusweaponstimestamp
refills
reports
revives
revivesfull
skills
stocks
timestamp
travel
weaponexp
workstats

Error Codes

CodeMessageDescription
0Unknown errorUnhandled error, should not occur.
1Key is emptyPrivate key is empty in current request.
2Incorrect KeyPrivate key is wrong/incorrect format.
3Wrong typeRequesting an incorrect basic type.
4Wrong fieldsRequesting incorrect selection fields.
5Too many requestsRequests are blocked for a small period of time because of too many requests per user (max 100 per minute).
6Incorrect IDWrong ID value.
7Incorrect ID-entity relationA requested selection is private (For example, personal data of another user / faction).
8IP blockCurrent IP is banned for a small period of time because of abuse.
9API disabledApi system is currently disabled.
10Key owner is in federal jailCurrent key can't be used because owner is in federal jail.
11Key change errorYou can only change your API key once every 60 seconds.
12Key read errorError reading key from Database.
13The key is temporarily disabled due to owner inactivityThe key owner hasn't been online for more than 7 days.
14Daily read limit reachedToo many records have been pulled today by this user from our cloud services.
15Temporary errorAn error code specifically for testing purposes that has no dedicated meaning.
16Access level of this key is not high enoughA selection is being called of which this key does not have permission to access.
17Backend error occurred, please try again.
18API key has been paused by the owner.
19Must be migrated to crimes 2.0.
20Race not yet finished.
21Incorrect categoryWrong cat value.