Documentos
Ctrl+K Buscar Alt+[Alt+] Guías
Obtener clave API

API · TikTok Shop

API de sugerencias de búsqueda de TikTok Shop

Endpoint (API key)

GET /api/v1/tiktok-shop/suggestions

Send Clave X-API (o Autorización: al portador) like every other metered programmatic route. Behavior matches the in-app autocomplete for the same path shape.

Dashboard (session): GET /api/tiktok-shop/suggestions — used when you are logged into the web app. For scripts and integrations, always use the /api/v1/... URL.

Description

Autocomplete for TikTok Shop entities (categorías, tiendas, creadores, productos, vídeos): short id + nombre rows as the user types.

Request Parameters

Parámetro Tipo Obligatorio Descripción Ejemplo
tipo cadena Tipo de entidad a buscar categorías, tiendas, creadores, productos, vídeos
q cadena Consulta de búsqueda (coincidencia parcial del nombre) moda, Nike, elegir
límite entero No Maximum number of suggestions to return (default: 10, cap enforced server-side) 5, 10, 20

Response Format

Success Response

Código de estado: 200 OK

Tipo de contenido: application/json

{
  "success": true,
  "suggestions": [
    {
      "id": "category_12345",
      "name": "Fashion & Apparel"
    },
    {
      "id": "category_67890",
      "name": "Fitness Equipment"
    }
  ]
}

Error Response

Código de estado: 400 Solicitud incorrecta

{
  "success": false,
  "error": "Invalid entity type"
}

Código de estado: Error 500 del servidor interno

{
  "success": false,
  "error": "Internal server error"
}

Entity Types

Tipo Típico id Típico nombre Descripción
categorías Category id or path Category label Categorías de productos
tiendas Shop id Nombre de la tienda Tiendas de TikTok
creadores Creator id Username or display name Creators / affiliates
productos Product id Título del producto Productos
vídeos Video id Título del vídeo Video content

Request Examples

cURL

# Replace {origin} and $WH_API_KEY.
curl -sS -H "X-API-Key: $WH_API_KEY" \
  "{origin}/api/v1/tiktok-shop/suggestions?type=categories&q=fash&limit=10"

curl -sS -H "X-API-Key: $WH_API_KEY" \
  "{origin}/api/v1/tiktok-shop/suggestions?type=shops&q=nike&limit=5"

curl -sS -H "X-API-Key: $WH_API_KEY" \
  "{origin}/api/v1/tiktok-shop/suggestions?type=creators&q=fitness&limit=10"

JavaScript Fetch

// Programmatic (API key)
const response = await fetch(`${ORIGIN}/api/v1/tiktok-shop/suggestions?type=categories&q=fash&limit=10`, {
  headers: {
    Accept: 'application/json',
    'X-API-Key': process.env.WH_API_KEY,
  },
});

const data = await response.json();
console.log(data.suggestions);
// [{ id: "category_123", name: "Fashion & Apparel" }, ...]

Behavior Notes

  • Matching: Case-insensitive partial match on the primary label field for each entity (for creators, both username and display name are considered).
  • Sorting: Results are ordered by a popularity-style signal per entity (e.g. revenue, followers, views) so common matches surface first.
  • Empty input: Very short queries may return an empty sugerencias array; the web app often waits until at least 2 characters before calling.
  • Client UX: If you build a typeahead, debounce requests (~300ms) and cache recent tipo+q pairs briefly to avoid redundant calls (same idea as the in-app search bar).

Auth and errors

Véase