Target categories API
Target’s category tree, one level at a time.
GET /v1/target/categories1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/target/categories",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "category_id": "root", "category": { "canonical_url": "/", "name": "target", "category_id": "root", "deep_link": "target://product/listing?idType=ENDECA&id=root&title=Homepage", "visibility": [ "WEB" ] }, "children": [ { "canonical_url": "/c/beauty/-/N-55r1x", "name": "Beauty", "category_id": "55r1x", "parent_category_id": "root", "image_url": "https://target.scene7.com/is/image/Target/GUEST_112bc773-50c6-4f0b-8aab-cbef96e55c0a", "deep_link": "target://product/listing?idType=ENDECA&id=55r1x&title=Beauty", "visibility": [ "WEB", "APP" ] }, { "canonical_url": "/c/gift-ideas/-/N-96d2i", "name": "Gift Ideas", "category_id": "96d2i", "parent_category_id": "root", "image_url": "https://target.scene7.com/is/image/Target/GUEST_b2e304aa-abc5-4ddf-8381-4b99cfb3eab0", "deep_link": "target://product/listing?idType=ENDECA&id=96d2i&title=Gift+Ideas", "visibility": [ "WEB", "APP" ] }, "… 4 more" ]}Parameters
| Name | Type | Description |
|---|---|---|
category_idquery | string | Category id (default root). |
Response fields
200 with a TargetCategories, in the JSON Target’s own site reads.
| Field | Type | Description |
|---|---|---|
category_id | string | |
category | object | null | |
children | object[] |
Status codes
| Status | Meaning |
|---|---|
200 | The category and its children. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The item, category or place does not exist. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Target is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Target is a trademark of Target Brands, Inc. We are not affiliated with or endorsed by Target.