Tractor Supply categories
Tractor Supply's departments, or the subcategories (with their own subcategories) of one department: code (pass it back here), name, link and image.
Every response includes credits_used: the credits this call cost.
Part of the Tractor Supply API: 6 endpoints with prices, use cases and example responses.
Parameters
| name | type | description |
|---|---|---|
category | string | A category code from this route (optional; default the departments). Example: 1001981 |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/tractorsupply/v1/categories?category=1001981" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/tractorsupply/v1/categories",
params={"category": "1001981"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/tractorsupply/v1/categories");
url.searchParams.set("category", "1001981");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).
Example response (real call, trimmed: lists cut to 2 items, long text shortened, raw left out)
{"category": "1001981","count": 12,"categories": [{"id": "1001986","code": "1001986","name": "Hardware","slug": "hardware","url": "https://www.tractorsupply.com/tsc/catalog/hardware","image": "https://media.tractorsupply.com/is/image/TractorSupplyCompany/1099842?$456$","children": [{"id": "1002027","code": "1002027","name": "Doors & Door Hardware","slug": "doors-door-hardware","url": "https://www.tractorsupply.com/tsc/catalog/doors-door-hardware","image": "https://media.tractorsupply.com/is/image/TractorSupplyCompany/3551830?$456$","children": []},{"id": "1002021","code": "1002021","name": "Tarps, Straps & Tiedowns","slug": "tarps-straps-tiedowns","url": "https://www.tractorsupply.com/tsc/catalog/tarps-straps-tiedowns","image": "https://media.tractorsupply.com/is/image/TractorSupplyCompany/3012179?$456$","children": []},"… 9 more"]},{"id": "1002017","code": "1002017","name": "Moving & Lifting","slug": "moving-lifting","url": "https://www.tractorsupply.com/tsc/catalog/moving-lifting","image": "https://media.tractorsupply.com/is/image/TractorSupplyCompany/3893931?$456$","children": [{"id": "1002210","code": "1002210","name": "Utility Carts","slug": "utility-carts","url": "https://www.tractorsupply.com/tsc/catalog/utility-carts","image": "https://media.tractorsupply.com/is/image/TractorSupplyCompany/1620033?$456$","children": []},{"id": "1002208","code": "1002208","name": "Hand Trucks & Accessories","slug": "hand-trucks-accessories","url": "https://www.tractorsupply.com/tsc/catalog/hand-trucks-accessories","image": "https://media.tractorsupply.com/is/image/TractorSupplyCompany/3893389?$456$","children": []},"… 7 more"]},"… 10 more"],"cached": false,"credits_used": 1}