World Monitor
Real-time global intelligence on conflict, markets, energy, trade, shipping and cyber. 100 tools.
MCP server for Yandex Direct API v5: 113 methods from the machine-readable schema
Lists are ordered by a usage score (out of 100) built from these parts
| Popularity | 4/80 | GitHub stars or weekly downloads: the larger counts 60, the smaller 20 |
|---|---|---|
| Freshness | 7/12 | Full marks for a release or code change within 30 days |
| Still answering | 0/8 | The cloud endpoint answered at the last check |
| Usage score | 11/100 |
Quality: Passed 3/3 basic checks (shown, not used for ordering) · Momentum: No data yet (Used only on the Trending tab)
Pick the AI app you use, then copy the settings.
Let your AI install it with one sentence
Please install Яндекс Директ API v5. Follow https://mcp.popnx.com/i/artgas1-yandex-direct-api-mcp.md, show me the commands and wait for my OK before running them.Paste it into an AI that can work on your computer (such as Claude Code or Cursor). It reads our steps, shows you the commands and waits for your OK. No key, no sign-up. · See the full text your AI reads
Passed 3/3 checks · Runs on your computer · ✓ Commands checked Nov 14, 2026
First: which AI do you use?
Pick your app and the steps appear below.
Works with Claude, with some setup first
You need a Яндекс Директ API v5 key (create it on the maker’s site) · Install Node.js on your computer first (one time) · Only the Claude desktop app (Windows or Mac), not the web or phone
Copy this message into a Claude chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Яндекс Директ API v5 for Claude on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "yandex-direct-api": { "command": "npx", "args": [ "-y", "yandex-direct-api-mcp" ], "env": { "YANDEX_DIRECT_TOKEN": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For YANDEX_DIRECT_TOKEN, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Яндекс Директ API v5 tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
SettingsDeveloperEdit Config
{
"mcpServers": {
"yandex-direct-api": {
"command": "npx",
"args": [
"-y",
"yandex-direct-api-mcp"
],
"env": {
"YANDEX_DIRECT_TOKEN": "your-value"
}
}
}
}Paste the key only into the app’s field, never into a chat or to anyone
Use Яндекс Директ API v5 and tell me what you can do for me, then show me one thing✓ If Claude says it is using Яндекс Директ API v5 or shows a Яндекс Директ API v5 tool in the answer, you are connected
The command above works without these. Add them only if you want to change something, following the maker’s description.
YANDEX_DIRECT_LOGIN Логин кабинета для заголовка Client-Login. Нужен агентствам и представителям; для собственного кабинета не задаётсяDIRECT_PROFILE Набор объявляемых инструментов: core — узкий набор по умолчанию, read — все читающие, all — вся поверхность · default coreDIRECT_TOOLS Явный список инструментов или служб через запятую. Побеждает DIRECT_PROFILEDIRECT_ALLOW_WRITES Разрешить изменяющие методы (add/update/delete). Пока выключено, они не объявляются вовсе. Значения: 1, true, yes · default 0DIRECT_API_VERSION Версия пути API. Разные версии отдают разные наборы полей одной и той же кампании · default v501DIRECT_SANDBOX Отправлять запросы в песочницу Директа вместо боевого кабинета. Значения: 1, true, yes · default 0DIRECT_MAX_OUTPUT_CHARS Потолок размера ответа инструмента в символах; сверх него ответ усекается с пометкой · default 60000Descriptions are as written by the maker.
Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version
ChatGPT cannot connect Яндекс Директ API v5 yet
Яндекс Директ API v5 runs on your computer, but ChatGPT can only connect servers that run on the web
A · Use an app that can connect Яндекс Директ API v5
B · Others in Other that work with ChatGPT
Picked from the most used in the same category, only ones that connect by address with no key
Works with Claude Code, with some setup first
You need a Яндекс Директ API v5 key (create it on the maker’s site) · Install Node.js on your computer first (one time)
Copy this message into a Claude Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Яндекс Директ API v5 for Claude Code on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): claude mcp add --scope user yandex-direct-api --env YANDEX_DIRECT_TOKEN=your-value -- npx -y yandex-direct-api-mcp 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For YANDEX_DIRECT_TOKEN, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Яндекс Директ API v5 tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
Mac: press Command+Space and type Terminal · Windows: open PowerShell
claude mcp add --scope user yandex-direct-api --env YANDEX_DIRECT_TOKEN=your-value -- npx -y yandex-direct-api-mcpReplace “your-value” with your key before pressing Enter
Paste the key only into the app’s field, never into a chat or to anyone
You should see Яндекс Директ API v5 listed as connected
Use Яндекс Директ API v5 and tell me what you can do for me, then show me one thing✓ If Claude Code says it is using Яндекс Директ API v5 or shows a Яндекс Директ API v5 tool in the answer, you are connected
The command above works without these. Add them only if you want to change something, following the maker’s description.
YANDEX_DIRECT_LOGIN Логин кабинета для заголовка Client-Login. Нужен агентствам и представителям; для собственного кабинета не задаётсяDIRECT_PROFILE Набор объявляемых инструментов: core — узкий набор по умолчанию, read — все читающие, all — вся поверхность · default coreDIRECT_TOOLS Явный список инструментов или служб через запятую. Побеждает DIRECT_PROFILEDIRECT_ALLOW_WRITES Разрешить изменяющие методы (add/update/delete). Пока выключено, они не объявляются вовсе. Значения: 1, true, yes · default 0DIRECT_API_VERSION Версия пути API. Разные версии отдают разные наборы полей одной и той же кампании · default v501DIRECT_SANDBOX Отправлять запросы в песочницу Директа вместо боевого кабинета. Значения: 1, true, yes · default 0DIRECT_MAX_OUTPUT_CHARS Потолок размера ответа инструмента в символах; сверх него ответ усекается с пометкой · default 60000Descriptions are as written by the maker.
Menu names checked against Anthropic’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Works with Cursor, with some setup first
You need a Яндекс Директ API v5 key (create it on the maker’s site) · Install Node.js on your computer first (one time)
Copy this message into a Cursor chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Яндекс Директ API v5 for Cursor on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "mcpServers": { "yandex-direct-api": { "command": "npx", "args": [ "-y", "yandex-direct-api-mcp" ], "env": { "YANDEX_DIRECT_TOKEN": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For YANDEX_DIRECT_TOKEN, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Яндекс Директ API v5 tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
In the Яндекс Директ API v5 settings, YANDEX_DIRECT_TOKEN is empty; add your key and save
Paste the key only into the app’s field, never into a chat or to anyone
Use Яндекс Директ API v5 and tell me what you can do for me, then show me one thing✓ If Cursor says it is using Яндекс Директ API v5 or shows a Яндекс Директ API v5 tool in the answer, you are connected
The command above works without these. Add them only if you want to change something, following the maker’s description.
YANDEX_DIRECT_LOGIN Логин кабинета для заголовка Client-Login. Нужен агентствам и представителям; для собственного кабинета не задаётсяDIRECT_PROFILE Набор объявляемых инструментов: core — узкий набор по умолчанию, read — все читающие, all — вся поверхность · default coreDIRECT_TOOLS Явный список инструментов или служб через запятую. Побеждает DIRECT_PROFILEDIRECT_ALLOW_WRITES Разрешить изменяющие методы (add/update/delete). Пока выключено, они не объявляются вовсе. Значения: 1, true, yes · default 0DIRECT_API_VERSION Версия пути API. Разные версии отдают разные наборы полей одной и той же кампании · default v501DIRECT_SANDBOX Отправлять запросы в песочницу Директа вместо боевого кабинета. Значения: 1, true, yes · default 0DIRECT_MAX_OUTPUT_CHARS Потолок размера ответа инструмента в символах; сверх него ответ усекается с пометкой · default 60000Descriptions are as written by the maker.
Menu names checked against Cursor’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Works with VS Code, with some setup first
You need a Яндекс Директ API v5 key (create it on the maker’s site) · Install Node.js on your computer first (one time)
Copy this message into a VS Code chat. The AI checks your computer, tells you which file it will change, and waits for your OK every time.
Please install the MCP server Яндекс Директ API v5 for VS Code on this computer, in this order: 1) Check Node.js with node -v. If it is missing, tell me to install it from https://nodejs.org/en/download; do not install it yourself. 2) Use only this config (already checked by PopNx MCP): { "servers": { "yandex-direct-api": { "type": "stdio", "command": "npx", "args": [ "-y", "yandex-direct-api-mcp" ], "env": { "YANDEX_DIRECT_TOKEN": "your-value" } } } } 3) Tell me the full path of the file you will change, or the command you will run, and wait for my OK. 4) For YANDEX_DIRECT_TOKEN, leave "your-value" in place and tell me to paste the real value myself into the file or the app’s field. Never ask me to type a key in chat. 5) Do what we agreed, then check that the Яндекс Директ API v5 tools really show up.This message has no key in it. If a key is needed, the AI will ask you to paste it yourself into the file or the app’s field.
Already installed? Check first · Open Terminal, type this command and press Enter
node -vMac: press ⌘ + Space, type Terminal, press Enter
Windows: open Start, type Windows PowerShell, then Open
Not installed: Open the official download page, pick the LTS version and the click-through installer: .pkg on Mac · .msi on Windows. Double-click and follow it to the end. No curl command needed
Open the Node.js download page ↗
When it’s done, close Terminal, open it again and run the same command. You should see a version number: node -v
Install once; it works for everything that needs Node.js
Open the maker’s site, sign up and create an API key for the next step. Check the maker’s site for pricing and free plans.
In the Яндекс Директ API v5 settings, YANDEX_DIRECT_TOKEN is empty; add your key and save
Paste the key only into the app’s field, never into a chat or to anyone
Use Яндекс Директ API v5 and tell me what you can do for me, then show me one thing✓ If VS Code says it is using Яндекс Директ API v5 or shows a Яндекс Директ API v5 tool in the answer, you are connected
The command above works without these. Add them only if you want to change something, following the maker’s description.
YANDEX_DIRECT_LOGIN Логин кабинета для заголовка Client-Login. Нужен агентствам и представителям; для собственного кабинета не задаётсяDIRECT_PROFILE Набор объявляемых инструментов: core — узкий набор по умолчанию, read — все читающие, all — вся поверхность · default coreDIRECT_TOOLS Явный список инструментов или служб через запятую. Побеждает DIRECT_PROFILEDIRECT_ALLOW_WRITES Разрешить изменяющие методы (add/update/delete). Пока выключено, они не объявляются вовсе. Значения: 1, true, yes · default 0DIRECT_API_VERSION Версия пути API. Разные версии отдают разные наборы полей одной и той же кампании · default v501DIRECT_SANDBOX Отправлять запросы в песочницу Директа вместо боевого кабинета. Значения: 1, true, yes · default 0DIRECT_MAX_OUTPUT_CHARS Потолок размера ответа инструмента в символах; сверх него ответ усекается с пометкой · default 60000Descriptions are as written by the maker.
Menu names checked against VS Code’s help page on Nov 11, 2026 · your screen may differ slightly by app version
Other apps that use MCP, such as Windsurf, Zed or Gemini CLI, each add servers differently. See how in the app list.
JSON settings are under “For developers” below
Claude Code
claude mcp add --scope user yandex-direct-api --env YANDEX_DIRECT_TOKEN=your-value -- npx -y yandex-direct-api-mcpClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"yandex-direct-api": {
"command": "npx",
"args": [
"-y",
"yandex-direct-api-mcp"
],
"env": {
"YANDEX_DIRECT_TOKEN": "your-value"
}
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"yandex-direct-api": {
"command": "npx",
"args": [
"-y",
"yandex-direct-api-mcp"
],
"env": {
"YANDEX_DIRECT_TOKEN": "your-value"
}
}
}
}VS Code (mcp.json)
{
"servers": {
"yandex-direct-api": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"yandex-direct-api-mcp"
],
"env": {
"YANDEX_DIRECT_TOKEN": "your-value"
}
}
}
}YANDEX_DIRECT_TOKEN secret required envYANDEX_DIRECT_LOGIN envDIRECT_PROFILE envDIRECT_TOOLS envDIRECT_ALLOW_WRITES envDIRECT_API_VERSION envDIRECT_SANDBOX envDIRECT_MAX_OUTPUT_CHARS envDescriptions are as written by the maker.
These settings are generated from the maker’s registry entry. If the README says otherwise, follow the README.
npm: yandex-direct-api-mcpBased on how this server connects and on each app’s own docs, checked Nov 10, 2026.
Run on your computer in
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
Runs on your computer; the tool list appears in your AI app after you install it.
We check information anyone can see; we have not read the code. Checks that do not apply are left out of the count. · Checked Nov 18, 2026
The registry name was verified with the GitHub account artgas1, which owns the repo
Code last changed 2 months ago
Uses MIT
This one runs on your computer; there is no internet endpoint
Runs on your computer and uses local settings instead
Runs on your computer; we can only read tool lists from internet endpoints
No entries on OSV.dev for yandex-direct-api-mcp@1.1.1
Checks only this package version, not every dependency · checked Nov 16, 2026
If you made this, paste this code into your README. The badge links back to this page.
[](https://mcp.popnx.com/en/servers/artgas1-yandex-direct-api-mcp)Ask, share a tip or report that it does not work. Sorted by what people marked helpful.
No posts yet. Be the first to ask or share.
Posts here are written by users, not the PopNx team.
No reviews yet
Compared with every active server in this category in the registry. Stars count only when the publisher owns the repo.
It passed 3 of 3 applicable basic checks. We have not read the code. Before adding a key or token, see what access the server asks for and use a key with only the permissions you need.
You need to fill in: YANDEX_DIRECT_TOKEN
It runs on your computer. Your AI app starts it when needed, and data does not pass through the maker’s servers (unless it calls an online service itself).
The GitHub repo last changed 2 months ago, and the latest version (1.1.1) reached the registry 2 months ago.
Apps that support MCP, such as Claude Desktop, Claude Code, Cursor and VS Code. You also need Node.js on your computer.
In the same category: World Monitor, openstatus, Oh My Posh Validator, Strata, Jitsu
Same category, other makers, commands already checked. Official ones first, then by stars.
Reading a card:↓ Downloads per weeki★ GitHub starsiThree pillars: reviews · checks · usageiUpdated = latest version published to the registryi
Real-time global intelligence on conflict, markets, energy, trade, shipping and cyber. 100 tools.
Manage monitors, status pages, incidents and maintenances in your openstatus workspace.
Validate oh-my-posh configurations and segment snippets against the official schema.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Manage Jitsu data pipelines: destinations, streams, connections, functions, live events.
| This one Яндекс Директ API v5 | World Monitor | openstatus | Oh My Posh Validator | Strata | Jitsu | |
|---|---|---|---|---|---|---|
| Runs where | Installs on your computer | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install | Runs in the cloud, nothing to install |
| Needs a key | Yes | No | No | No | No | No |
| Add with + in Claude | No | No | No | No | No | No |
| Basic checks | 3/3 | 4/4 | 4/4 | 4/4 | 1/4 | 4/4 |
| License | MIT | AGPL-3.0 | AGPL-3.0 | MIT | Apache-2.0 | MIT |
| Price | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry | No cost listed in the registry |
Copied from the maker’s repo as written. PopNx MCP has not reviewed or endorsed it. HTML, images and scripts are removed. Links lead off this site.
MCP-сервер и командная строка к API Яндекс Директа v5. Покрыты все 113 методов, порождённые из машиночитаемой схемы; по умолчанию объявляются девять — те, которыми читают. Остальное включается одной переменной, изменение выключено.
mcp-name: io.github.artgas1/yandex-direct-api-mcp
*English*
Работает и как MCP-сервер для Claude Code, Cursor, Codex и других клиентов, и как обычная команда — если MCP не нужен.
Обе колонки настоящие: левая — тело ответа, разобранное обычным JSON.parse , то есть так, как его получил бы любой клиент; правая — то, что вернул сервер по JSON-RPC. Строка с идентификатором самодоказательна: слева он испорчен не потому, что так нарисовано, а потому что его действительно портит разбор. Ни токена, ни сети: запросы уводятся на локальную заглушку, поэтому прогон повторяется где угодно, включая CI. Повторить у себя — npm run demo , переснять — npm run demo:record (нужен vhs ).
npx -y yandex-direct-api-mcp
| что покрыто | служб | методов | из них в core | примеры инструментов |
|---|---|---|---|---|
| Кампании и объявления | 9 | 37 | 3 | direct_adgroups_get, direct_ads_get |
| Таргетинг | 9 | 45 | 1 | direct_keywords_get |
| Ставки и стратегии | 4 | 15 | 2 | direct_bidmodifiers_get, direct_keywordbids_get |
| Отчёты и справочники | 6 | 9 | 2 | direct_dictionaries_get, direct_reports_get |
| Клиенты и агентства | 2 | 7 | 1 | direct_clients_get |
| всего | 30 | 113 | 9 | плюс четыре служебных: direct_catalog, direct_fields, direct_schema, direct_inventory |
Таблица считается из спеки (npm run coverage), а не пишется руками: числа в прозе расходятся со схемой молча, и неправда выглядит ровно как правда.
Нужен OAuth-токен Яндекса со scope direct:api — https://oauth.yandex.ru/ (приложению требуется одобренная заявка на доступ к API Директа).
MCP:
{
"mcpServers": { "yandex-direct": { "command": "npx", "args": ["-y", "yandex-direct-api-mcp"], "env": { "YANDEX_DIRECT_TOKEN": "ваш-токен" } } } }
Командная строка:
export YANDEX_DIRECT_TOKEN="ваш-токен"
yandex-direct-mcp catalog --service campaigns yandex-direct-mcp describe campaigns.get yandex-direct-mcp call campaigns.get --FieldNames Id --FieldNames Name
Не удобства. Каждый пункт — место, где прямой запрос к Директу ошибается молча: ответ выглядит нормальным, ошибки нет, а число или вывод неверны. Всё перечисленное снято прогоном живого API, а не прочитано в документации.
DailyBudget.Amount = 1000000000 ← это 1000 единиц валюты счёта
Cost = 1234500000 ← это 1234,50 единицы валюты счёта
Ошибка ровно в миллион раз, и она не выглядит ошибкой: число правдоподобное, его можно сложить, поделить и построить по нему график. Заголовок returnMoneyInMicros, который выключает микро-единицы в отчётах, на обычные службы не действует — проверено на campaigns, значение не изменилось.
Сервер приводит суммы к валюте счёта и перечисляет в ответе, какие именно поля пересчитал:
"_мета": { "суммы_переведены_из_микроединиц": ["Amount", "Refund", "Spend"] }
Типичный Id объявления: 1234567890123456789 — девятнадцать цифр. JSON.parse держит пятнадцать и превращает его в 1234567890123456800.
И это не единичный курьёз: девятнадцатизначные идентификаторы встретились в каждом проверенном кабинете, а не в одном экземпляре. Схема Яндекса объявляет 358 полей типом xsd:long — то есть диапазон до 19 цифр нормален по контракту.
Опасен не сдвиг, а то, как он выходит наружу: испорченный идентификатор Директ принимает и отвечает HTTP 200 с телом {"result":{}}. То есть отказа нет — есть сообщение «такого объявления нет». Пустота как доказательство отсутствия.
Сервер разбирает тело так, что длинные целые остаются точными. Отдельно проверено, что API принимает идентификатор строкой, поэтому точность держится на всём пути — и на чтении, и на записи.
| что спросили | код | что в теле |
|---|---|---|
неверный FieldNames | 200 | error_code: 8000 |
| неизвестный метод | 202 | error_code: 55 |
| ошибка в отчёте | 400 | error_code: "8000" — строкой, не числом |
| отчёт поставлен в очередь | 201 | пусто, retryIn: 1 |
| отчёт считается | 202 | пусто, retryIn: 10 |
Один и тот же код 202 означает отказ у campaigns и «ещё считается» у reports. Проверка res.ok пропускает первые три строки таблицы: отказ уходит модели как удачный ответ.
201 → 202 → 200. Замер: до готовности потребовалось три запроса. Повтор идёт с тем же ReportName — имя и есть ключ поставленной задачи. Сервер ждёт сам.
Один и тот же запрос:
/json/v5/campaigns → N кампаний, у всех Type = TEXT_CAMPAIGN
/json/v501/campaigns → те же N, у всех Type = UNIFIED_CAMPAIGN
Это разные представления с разными наборами глубоких полей, и несовпадение отнимает их без всякого признака:
| путь | набор полей | глубокие поля |
|---|---|---|
v5 | TextCampaignFieldNames | приходят |
v5 | UnifiedCampaignFieldNames | пусто, ошибки нет |
v501 | TextCampaignFieldNames | пусто, ошибки нет |
v501 | UnifiedCampaignFieldNames | приходят |
Стратегия, настройки, счётчики просто отсутствуют — читается как «у кампании ничего не настроено». Умолчание v501 (документация называет адресом только его), переключается DIRECT_API_VERSION=v5, выбранная версия печатается в каждом ответе, а несовпадающий набор полей вызывает предупреждение.
Кампании Мастера кампаний не отдаются методом campaigns.get вовсе — ни списком, ни по явному Ids; ответ пустой и без ошибки. Ни v5, ни v501 этого не меняют.
Поэтому состав кабинета собирает отдельный инструмент `direct_inventory`: он склеивает список кампаний и отчёт и помечает каждую строку источником. Предупреждения в описании тут мало — оно требует, чтобы читатель помнил про него в момент вывода, а вывод делается по данным, которые выглядят нормально.
Прогон на живом кабинете: объединение оказалось на кампанию длиннее списка, и эта строка была видна только отчёту. Невидимая для campaigns.get кампания при этом откручивается и может нести основную долю показов — по списку кампаний этого не заметить.
ВНИМАНИЕ: 1 кампаний откручивались, но методом campaigns.get НЕ отдаются
(10000017). Управлять ими через API нельзя — только в интерфейсе.
В ответе на add/update каждому входному элементу отвечает выходной. Различать надо по Errors; Warnings означает «применено с замечанием». Счёт по наличию любого содержимого даёт «отклонено всё» там, где применилось всё. Сервер приводит итог отдельной строкой:
UpdateResults: применено 2, отклонено 1, с предупреждениями 1
RegionIds (maxOccurs=unbounded) → [225, 977]
RestrictedRegionIds (тип ArrayOfLong) → {"Items": [225]}
Обе формы одинаковы и на чтении, и на записи. Сервер снимает и ставит обёртку по графу типов, а не по виду значения, поэтому круг «прочитал → поправил → записал» не рвётся. Вам обе формы видны как обычные массивы.
Client-Login переключает кабинет по-настоящему, и ошибиться в нём можно молча. Несуществующий логин отбивается кодом 8800 — это видно сразу. А существующий, но не тот, отдаёт полные и правильные данные, просто из другого кабинета: по виду ответа это неотличимо.
Поэтому сервер спрашивает у API, кто отвечает, и пишет ответ в каждый конверт:
"_мета": { "кабинет": "example-login (ClientId 1234567)", "версия_api": "v501" }
Спрашивается один раз за запуск и кешируется — clients.get стоит 10 баллов.
Описания всех объявленных инструментов лежат в контексте модели на каждом ходу, вызываете вы их или нет. Поэтому по умолчанию объявляется не всё, что умеет API, а то, чем пользуются.
Замер tools/list на собранном сервере (npm run surface):
| профиль | инструментов | байт | ≈ токенов |
|---|---|---|---|
| `core` (умолчание) | 13 | 27 028 | 12 455 |
read | 37 | 61 158 | 28 183 |
all + DIRECT_ALLOW_WRITES=1 | 117 | 143 706 | 66 224 |
Умолчание в 5,3 раза легче полного набора. Главный рычаг — вложенные типы не разворачиваются в схему: транзитивно campaigns.add это 1083 поля и 54 КБ на один инструмент. Вместо разворачивания состав типа назван словами в описании, а точная схема выдаётся инструментом direct_schema по запросу.
Чего не видно — расскажет сам сервер: инструмент direct_catalog перечисляет все 113 методов и говорит, какие скрыты и как их включить.
Из 113 методов 80 меняют данные, 16 удаляют. У Директа нет подтверждающего шага: suspend останавливает показы в момент вызова, archive убирает кампанию из работы, delete необратим, а на другом конце — деньги.
Меняющие инструменты не объявляются вовсе, пока не задан DIRECT_ALLOW_WRITES=1. Объявлять их и отказывать на вызове — худший вариант: контекст за них платится полностью, а позвать всё равно нельзя.
Неизвестное имя профиля — отказ на старте, а не откат к полной поверхности: неверная настройка ограничения не должна превращаться в отсутствие ограничения.
Есть песочница: DIRECT_SANDBOX=1 (нужны отдельная регистрация и отдельный токен). Факт включения печатается при старте и в каждом ответе.
| переменная | по умолчанию | что делает |
|---|---|---|
YANDEX_DIRECT_TOKEN | — | OAuth-токен, scope direct:api. Обязательна |
YANDEX_DIRECT_LOGIN | — | логин кабинета (не почта). Переключает кабинет по-настоящему: под одним токеном отдаёт другой аккаунт со своей квотой. Фактический кабинет сервер называет в каждом ответе |
DIRECT_PROFILE | core | core, read, all |
DIRECT_TOOLS | — | явный список служб или инструментов, побеждает профиль |
DIRECT_ALLOW_WRITES | выкл. | объявить меняющие данные инструменты |
DIRECT_API_VERSION | v501 | v501 или v5 — меняет представление кампаний |
DIRECT_SANDBOX | выкл. | песочница вместо боевого кабинета |
DIRECT_MAX_OUTPUT_CHARS | 60000 | потолок ответа; усечение называется вслух |
Ни один метод не описан руками.
| источник | что даёт | почему нужен |
|---|
| WSDL 29 служб + 3 общие XSD | состав, типы, обязательность, массивность, перечисления | единственный полны