VI | EN
Message us on Messenger
Developer resources

Obtain details about location targeting tags by ID — TikTok Business API

Obtain details about location targeting tags by ID · call it through Quantri360 with one API key for your own accounts / assets that you connected and authorized — 360 handles request signing and refreshing the authorization you granted.

Obtain details about location targeting tags by ID

POST/tool/targeting/info/Via 360: POST https://partner.quantri360.com/v1/tiktok_business/tool/targeting/info/
Description

Use this endpoint to get information about location targeting tags by ID.

You can get details about three types of targeting tags: zip code IDs (currently only supported for the US) or postal code IDs (currently only supported for Canada, Brazil, Indonesia, Thailand, and Vietnam), location IDs, and ISP IDs.

See the "Supported parameters for different types of targeting tag" section below to learn about the request parameters you need to pass for different types of targeting tags.

>Note

  • You can only use this endpoint, rather than /too/region/, to get the information about zip code IDs or postal code IDs.
  • This endpoint requires POST method, because for GET requests the length of URL will be limited.

Request

Endpoint

POST https://partner.quantri360.com/v1/tiktok_business/tool/targeting/info/

Authentication & shop

NameInTypeSampleDescription
AuthorizationheaderheaderBearer q360_live_ab12cd34_…Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand.
platform_shop_idquerystring7000000000000000001Tài sản TikTok Business đã kết nối — "Mã tài sản" ở trang Nền tảng hoặc GET /v1/platforms (tài khoản quảng cáo cho Marketing API, tài khoản TikTok cho Organic / Messaging). Có thể bỏ khi chỉ kết nối một tài sản.

Request parameters

NameInTypeRequiredSampleDescription
scenebodystringNoThe targeting type that the specified targeting_ids is used for. Enum values: - GEO: Geographical targeting, which consists of administrative region targeting and zip code targeting (or postal code targeting). - ISP : Internet Service Provider targeting. Default value: GEO.
targeting_idsbodystring[]YesTargeting tag IDs. You can pass in location IDs, zip code IDs or postal code IDs, a combination of location IDs, zip code IDs or postal code IDs, or ISP IDs. Max size: 1,000. You can get location IDs, zip code IDs, or postal code IDs via geo_id returned from /tool/targeting/search/, or get location IDs via location_id returned from /tool/region/. You can get ISP IDs via isp_id returned from /tool/targeting/list/.
objective_typebodystringNoRequired when scene is set as GEO. Campaign objective. The allowed enum values: REACH, TRAFFIC, VIDEO_VIEWS, LEAD_GENERATION, ENGAGEMENT, APP_PROMOTION, WEB_CONVERSIONS, PRODUCT_SALES. For descriptions of the objectives, see Objectives.
promotion_typebodystringNoRequired when scene is set as GEO and objective_type is NOT set as REACH, VIDEO_VIEWS, or ENGAGEMENT. Promotion type and you can decide where you'd like to promote your products using this field. For enum values, see Enumeration - Promotion Type.
placementsbodystring[]NoRequired when scene is set as GEO. The apps where you want to deliver your ads. For enum values, see Enumeration - Placement. Note: If you want to get information about zip code IDs to be used for zip code targeting or postal code IDs to be used for postal code targeting, the value of this field needs to include PLACEMENT_TIKTOK.
operating_systembodystringNoValid only when scene is set as GEO. Device operating system that you want to target. Enum values: ANDROID, IOS.
brand_safety_typebodystringNoBrand safety type. Valid only when scene is set as GEO and placements is set as PLACEMENT_TIKTOK. Default value: NO_BRAND_SAFETY. Enum values: - NO_BRAND_SAFETY: To not use any brand safety solution. Full inventory, which means your ads may appear next to some content featuring mature themes. - EXPANDED_INVENTORY: Use TikTok's brand safety solution. Expanded inventory means that your ads will appear next to content where most inappropriate content has been removed, and that does not contain mature themes. In the next API version, EXPANDED_INVENTORY will replace NO_BRAND_SAFETY and will be the default brand safety option. - STANDARD_INVENTORY: Use TikTok's brand safety solution. Standard inventory means that ads will appear next to content that is appropriate for most brands. - LIMITED_INVENTORY: Use TikTok's brand safety solution. Limited inventory means that your ads will not appear next to content that contains mature themes. - THIRD_PARTY: Use a third-party brand safety solution. You also need to pass in a value to the brand_safety_partner field. To get the countries and regions that your ads can be deployed to based on your brand safety settings, use the /tool/region/ endpoint. Note: - Pre-bid first-party Brand Safety solutions for APP_PROMOTION, WEB_CONVERSIONS, TRAFFIC, LEAD_GENERATION objectives in Auction ads, and pre-bid third-party brand safety solutions are currently allowlist-only features. If you would like to access them, please contact your TikTok representative. - See Brand safety to learn about the supported advertising objectives for pre-bid Brand Safety filtering.
brand_safety_partnerbodystringNoRequired only when brand_safety_type is THIRD_PARTY. Brand safety partner. Enum values: IAS, OPEN_SLATE(The partner is named DoubleVerify on TikTok Ads Manager because the partner has been acquired by DoubleVerify). Note: Pre-bid third-party brand safety solutions are currently allowlist-only features. If you would like to access them, please contact your TikTok representative.

Request examples

curl -s -X POST "https://partner.quantri360.com/v1/tiktok_business/tool/targeting/info/" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"targeting_ids":[]}'
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.post(
    "https://partner.quantri360.com/v1/tiktok_business/tool/targeting/info/",
    params={},
    json={
        "targeting_ids": []
    },
    headers={"Authorization": f"Bearer {KEY}"},
    timeout=60,
)
print(r.status_code)
print(r.json())
Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/tiktok_business/tool/targeting/info/');
for (const [k, v] of Object.entries({})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
  method: 'POST',
  headers: { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({"targeting_ids":[]}),
});
console.log(r.status, await r.json());
PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/tiktok_business/tool/targeting/info/' . '?' . http_build_query([]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key, 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"targeting_ids":[]}');
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;

Response

Response fields (as returned by TikTok Business)

NameTypeSampleDescription
codenumberResponse code. For the complete list of response codes and descriptions, see Appendix-Return Code.
messagestringResponse message. For details, see Appendix - Return Codes.
request_idstringThe log ID of a request, which uniquely identifies the request.
dataobjectReturned data.
targeting_tag_listobject[]Information about the targeting tags that are matched by the specified targeting tag IDs.
targeting_typestringThe targeting type that the targeting tag is used for. Enum values: - `GEO`: Geographical targeting, which consists of administrative region targeting and zip code targeting (or postal code targeting). - `ISP`: Internet Service Provider targeting.
namestringThe name of the targeting tag.
status_infoobjectInformation about the status of the targeting tag.
statusstringThe status of the targeting tag. Enum values: `ENABLED` (can be used for targeting), `DISABLED`(cannot be used for targeting).
reasonstringThe reason why the targeting tag cannot be used for targeting. Returned when `status` = `DISABLED`. Enum values: - `OFFLINE`: The targeting tag is offline. - `NOT_SUPPORTED`: The targeting tag is not offline but is not supported for the specified settings.
geoobjectInformation about the targeting tag that is used for location targeting. Returned when `targeting_type` is `GEO`.
geo_idstringLocation ID, zip code ID, or postal code ID. Location IDs can be used for administrative region targeting while zip code IDs can be used for zip code targeting and postal code IDs can be used for postal code targeting. - When the corresponding `geo_type` is `ZIP_CODE`, you can pass the value of this field as zip code ID or postal code ID to `zipcode_ids` when calling /adgroup/create/, /adgroup/update/ or /ad/audience_size/estimate/. - When the corresponding `geo_type` is not `ZIP_CODE`, you can pass the value of this field as location ID to `location_ids` when calling /adgroup/create/, /adgroup/update/ or /ad/audience_size/estimate/.
geo_typestringThe type of location that the `geo_id` corresponds to. Enum values: `COUNTRY` (country), `PROVINCE` (province), `CITY` (city), `DISTRICT` (district), `DMA` (DMA), `ZIP_CODE` (zip code or postal code).
descriptionstringThe description of the targeted location.
region_codestringThe code of the country or region that the targeted location belongs to.
parent_idstringID of the parent location. Returns `0` if no parent location exists.
ispobjectInformation about the targeting tag that is used for Internet service provider targeting. Returned when `targeting_type` is `ISP`.
isp_idstringThe ID of the Internet service provider that you can target.
location_idstringThe location ID that the `isp_id` can be used together with. Only location IDs at the country or region level are supported.
region_codestringThe code of the region or country that the `isp_id` belongs to.
parent_tagsobject[]Information about all the parent targeting tags.
targeting_typestringThe targeting type that the parent targeting tag is used for. Enum values: `GEO` (Geographical targeting, which consists of administrative region targeting and zip code targeting (or postal code targeting)).
namestringThe name of the parent targeting tag.
status_infoobjectInformation about the status of the parent targeting tag.
statusstringThe status of the parent targeting tag. Enum values: `ENABLED` (can be used for targeting), `DISABLED` (cannot be used for targeting).
reasonstringThe reason why the parent targeting tag cannot be used for targeting. Returned when `status` = `DISABLED`. Enum values: - `OFFLINE`: The parent targeting tag is offline. - `NOT_SUPPORTED`: The parent targeting tag is not offline but is not supported for the specified settings.
geoobjectInformation about the parent targeting tag that is used for location targeting. Returned when `targeting_type` is `GEO`.
geo_idstringParent location ID, zip code ID, or postal code ID. - When the corresponding `geo_type` is `ZIP_CODE`, you can pass the value of this field to `zipcode_ids` when calling /adgroup/create/, /adgroup/update/ or /ad/audience_size/estimate/. - When the corresponding `geo_type` is not `ZIP_CODE`, you can pass the value of this field to `location_ids` when calling /adgroup/create/, /adgroup/update/ or /ad/audience_size/estimate/.
geo_typestringThe type of location that the `geo_id` corresponds to. Enum values: `COUNTRY` (country), `PROVINCE` (province), `CITY` (city), `DISTRICT` (district), `DMA` (DMA), `ZIP_CODE` (zip code or postal code).
descriptionstringThe description of the parent location.
region_codestringThe code of the country or region that the parent location belongs to.
parent_idstringID of the parent location for the parent location. Returns `0` if no parent location exists.

Response sample

HTTPS/1.1 200 OK
{
    "code": 0,
    "message": "OK",
    "request_id": "{{request_id}}",
    "data": {
        "parent_tags": [
            {
                "status_info": {
                    "status": "ENABLED",
                    "reason": null
                },
                "name": "United States",
                "geo": {
                    "region_code": "US",
                    "geo_type": "COUNTRY",
                    "description": "state",
                    "parent_id": "0",
                    "geo_id": "6252001"
                },
                "targeting_type": "GEO"
            },
            {
                "status_info": {
                    "status": "ENABLED",
                    "reason": null
                },
                "name": "Wisconsin",
                "geo": {
                    "region_code": "US",
                    "geo_type": "PROVINCE",
                    "description": "State",
                    "parent_id": "6252001",
                    "geo_id": "5279468"
                },
                "targeting_type": "GEO"
            },
            {
                "status_info": {
                    "status": "ENABLED",
                    "reason": null
                },
                "name": "Oneida County",
                "geo": {
                    "region_code": "US",
                    "geo_type": "CITY",
                    "description": "County",
                    "parent_id": "5279468",
                    "geo_id": "5265726"
                },
                "targeting_type": "GEO"
            },
            {
                "status_info": {
                    "status": "ENABLED",
                    "reason": null
                },
                "name": "Minocqua",
                "geo": {
                    "region_code": "US",
                    "geo_type": "DISTRICT",
                    "description": "City",
                    "parent_id": "5265726",
                    "geo_id": "5263156"
                },
                "targeting_type": "GEO"
            },
            {
                "status_info": {
                    "status": "ENABLED",
                    "reason": null
                },
                "name": "Iron County",
                "geo": {
                    "region_code": "US",
                    "geo_type": "CITY",
                    "description": "County",
                    "parent_id": "5279468",
                    "geo_id": "5257533"
                },
                "targeting_type": "GEO"
            },
            {
                "status_info": {
                    "status": "ENABLED",
                    "reason": null
                },
                "name": "Gile",
                "geo": {
                    "region_code": "US",
                    "geo_type": "DISTRICT",
                    "description": "City",
                    "parent_id": "5257533",
                    "geo_id": "116027566"
                },
                "targeting_type": "GEO"
            }
        ],
        "targeting_tag_list": [
            {
                "status_info": {
                    "status": "ENABLED",
                    "reason": null
                },
                "name": "54548",
                "geo": {
                    "region_code": "US",
                    "geo_type": "ZIP_CODE",
                    "description": "postcode",
                    "parent_id": "5263156",
                    "geo_id": "8840000454548"
                },
                "targeting_type": "GEO"
            },
            {
                "status_info": {
                    "status": "ENABLED",
                    "reason": null
                },
                "name": "54525",
                "geo": {
                    "region_code": "US",
                    "geo_type": "ZIP_CODE",
                    "description": "postcode",
                    "parent_id": "116027566",
                    "geo_id": "8840000454525"
                },
                "targeting_type": "GEO"
            }
        ]
    }
}

Get started

  1. Sign up for Partner
  2. Enable a data type of the Ads (Marketing API) group on the platform page
  3. Create an API key (tick the TikTok Business channel)
  4. Call it as in the examples above