--- title: "Baza słów kluczowych: frazy w grupie (`getGroupKeywords`)" source: https://docs.senuto.com/modules/keywords_analysis/ka-keywords-getGroupKeywords api: POST /api/keywords_analysis/reports/keywords/getGroupKeywords --- # Baza słów kluczowych: frazy w grupie (`getGroupKeywords`) **`POST /api/keywords_analysis/reports/keywords/getGroupKeywords`** Zwraca **pojedyncze frazy wraz z metrykami** dla zbioru zawężonego jak w [`getGroups`](/modules/keywords_analysis/ka-keywords-getGroups). Kształt wiersza jest taki sam jak w [`getKeywords`](/modules/keywords_analysis/ka-keywords-getKeywords), a wyniki można sortować polem `order`. --- ## Żądanie `POST` `/api/keywords_analysis/reports/keywords/getGroupKeywords` Nagłówki: `Authorization: Bearer `, `Content-Type: application/json`. Parametry przekazuje się w **treści żądania**. **Żądanie** ```jsonc filename="żądanie.jsonc" { "parameters": [ { "data_fetch_mode": "keyword", "value": [ "buty do biegania" ] } ], "match_mode": "wide", "country_id": 1, "limit": 3 } ``` **cURL** ```bash curl --location --request POST 'https://api.senuto.com/api/keywords_analysis/reports/keywords/getGroupKeywords' \ --header 'Authorization: Bearer $YOUR_TOKEN_HERE' \ --header 'Content-Type: application/json' \ --data '{"parameters": [{"data_fetch_mode": "keyword", "value": ["buty do biegania"]}], "match_mode": "wide", "country_id": 1, "limit": 3}' ``` ### Parametry ```ts type KeywordsGetGroupKeywordsRequest = { /** * **Wymagane**. Zapytanie do bazy: lista obiektów `{ data_fetch_mode, value }`. * Tryb `keyword` przyjmuje listę fraz w `value`. */ parameters: Array<{ data_fetch_mode: 'keyword' | string; value: string[] }>; /** **Wymagane**. Szerokość dopasowania frazy: `wide` | `medium` | `narrow`. */ match_mode: 'wide' | 'medium' | 'narrow'; /** **Wymagane**. Identyfikator kraju; nieznana wartość zwraca `418` z `Unknown country_id`. */ country_id: number; /** Filtry — tablica grup łączonych OR. Nieznany `key` zwraca `418` z `invalid_filtering`. */ filtering?: Array<{ filters: Array<{ key: string; match?: 'gt' | 'gte' | 'lt' | 'lte' | 'eq'; value: string | number | Array }>; conjunction?: 'and' | 'or'; }>; /** Sortowanie wyników. */ order?: { prop: string; dir: 'ASC' | 'DESC' }; /** Numer strony wyników. */ page?: number; /** Liczba wierszy na stronę. */ limit?: number; } export default KeywordsGetGroupKeywordsRequest ``` > **Ostrzeżenie:** > Metryki są **zdublowane trzykrotnie**: pola najwyższego poziomu, płaskie `trend_1` … `trend_12` oraz obiekt `statistics`. Wybierz jedno źródło. > **Ostrzeżenie:** > Pole **`snippets` powtarza wartości** — dla frazy `nike airmax` API zwróciło `image_thumbs`, `pla`, `top_bar` trzy razy pod rząd. Odfiltruj duplikaty po swojej stronie. > **Ostrzeżenie:** > Liczba wierszy podlega limitowi `keywords_analysis_rows_per_report`. ## Odpowiedź Przykład to **rzeczywista odpowiedź produkcyjna**, skrócona. ```json filename="przykładowa-odpowiedź" { "success": true, "data": [ { "added": "2021-10-19", "keyword": "nike airmax", "searches": 135000, "cpc": 0.67, "cpc_min": 0.23, "cpc_max": 1.1, "words_count": 2, "kid": "c9db40a54eacd9ab571c31b82d0b1ac5", "variations": [], "variations_number": 0, "snippets": [ "image_thumbs", "pla", "top_bar", "image_thumbs", "pla", "top_bar", "image_thumbs", "pla", "top_bar" ], "trends": [ 90500, 110000, 201000, 165000, 135000, 110000, 110000, 135000, 135000, 110000, 90500, 74000 ] } ], "pagination": { "page_count": 2982, "current_page": 1, "has_next_page": true, "has_prev_page": false, "count": 8944, "limit": 3 } } ``` ### Struktura odpowiedzi ```ts type KeywordsGetGroupKeywordsResponse = { success: boolean; data: Array<{ keyword: string; /** Data dodania frazy do bazy, `YYYY-MM-DD`. */ added: string; searches: number; cpc: number; cpc_min: number | null; cpc_max: number | null; words_count: number; kid: string; variations: string[]; variations_number: number; /** Cechy SERP. Lista **może zawierać powtórzenia**. */ snippets: string[]; /** 12-elementowy trend wyszukiwań. */ trends: number[]; /** Te same wartości co `trends`, rozbite na pola `trend_1` … `trend_12`. */ trend_1: number; trend_12: number; /** Te same metryki w formie zagnieżdżonej — duplikat pól najwyższego poziomu. */ statistics: Record; }>; pagination: { page_count: number; current_page: number; has_next_page: boolean; has_prev_page: boolean; count: number; limit: number; }; } export default KeywordsGetGroupKeywordsResponse ``` ## Błędy Błędy tego endpointu przychodzą we [wspólnej kopercie ze statusem `418`](/types/errors). ## Powiązane akcje - [`getKeywords`](/modules/keywords_analysis/ka-keywords-getKeywords) — ten sam kształt wiersza dla całego zbioru. - [`getGroups`](/modules/keywords_analysis/ka-keywords-getGroups) — lista grup.