{"openapi":"3.1.0","info":{"title":"GEO-pult API","version":"1.0.0","description":"Проекты, материалы, отчёты и управление автопилотом из ваших скриптов и систем. Ответы — JSON, деньги — целые рубли, даты — ISO 8601. Лимит — 60 запросов в минуту на ключ."},"servers":[{"url":"https://pixelpult.ru/api/v1"}],"security":[{"bearer":[]},{"apiToken":[]}],"tags":[{"name":"Проекты","description":"Ваши проекты: состояние автопилота, бюджет, баланс и итоги."},{"name":"Материалы","description":"Контент-план по месяцам: этап, площадка, цена и цитирования."},{"name":"Отчёты","description":"Расходы по месяцам и видимость бренда по съёмам GEO-проекта."},{"name":"Автопилот","description":"Пауза и запуск автопилота проекта."},{"name":"Спецификация","description":"Этот контракт в формате OpenAPI 3.1 — для генераторов клиентов, Postman и ИИ-ассистентов."}],"paths":{"/projects":{"get":{"tags":["Проекты"],"operationId":"listProjects","summary":"Список проектов","description":"Все ваши проекты, новые сверху.","responses":{"200":{"description":"Проекты","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Project"}}}},"example":{"data":[{"id":3,"brand":"Пиксель Тулс","domain":"pixeltools.ru","state":"running","budget":{"mode":"month","amount":15000,"balance":3500,"auto_topup":true},"geo_project_id":11,"published":2,"citations":4,"created_at":"2026-10-01T09:00:00+03:00"}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/projects/{project}":{"get":{"tags":["Проекты"],"operationId":"getProject","summary":"Проект","description":"Project и бюджет текущего месяца: потрачено, на модерации, свободно и вернулось за отказы.","parameters":[{"name":"project","in":"path","required":true,"description":"ID проекта из списка проектов","schema":{"type":"integer","minimum":1},"example":3}],"responses":{"200":{"description":"Проект с бюджетом месяца","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/ProjectDetails"}}},"example":{"data":{"id":3,"brand":"Пиксель Тулс","domain":"pixeltools.ru","state":"running","budget":{"mode":"month","amount":15000,"balance":3500,"auto_topup":true},"geo_project_id":11,"published":2,"citations":4,"created_at":"2026-10-01T09:00:00+03:00","month":{"spent":7000,"in_work":4500,"free":3500,"refunded":5500}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/projects/{project}/materials":{"get":{"tags":["Материалы"],"operationId":"listMaterials","summary":"Материалы","description":"Материалы контент-плана за месяц в порядке плана.","parameters":[{"name":"project","in":"path","required":true,"description":"ID проекта из списка проектов","schema":{"type":"integer","minimum":1},"example":3},{"name":"month","in":"query","required":false,"description":"Месяц плана `YYYY-MM` или `all` — все месяцы. По умолчанию текущий месяц.","schema":{"type":"string","pattern":"^(\\d{4}-\\d{2}|all)$"},"example":"2026-12"}],"responses":{"200":{"description":"Материалы","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Material"}}}},"example":{"data":[{"id":12,"title":"Сравнение сервисов для анализа конкурентов в SEO","platform":"vc","status":"published","price":5500,"cost_write":500,"cost_place":5000,"plan_month":"2026-10","published_at":"2026-10-06T12:00:00+03:00","url":"https://vc.ru/seo/1840221-sravnenie-servisov","citations":3,"cited_by":"Алиса — 2, Perplexity — 1","rejection_reason":null}]}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/projects/{project}/report":{"get":{"tags":["Отчёты"],"operationId":"getReport","summary":"Отчёт","description":"Итоги, расходы по месяцам (новые сверху) и видимость бренда по съёмам GEO-проекта.","parameters":[{"name":"project","in":"path","required":true,"description":"ID проекта из списка проектов","schema":{"type":"integer","minimum":1},"example":3}],"responses":{"200":{"description":"Отчёт","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Report"}}},"example":{"data":{"totals":{"spent":11500,"published":2,"citations":4,"per_citation":2875},"months":[{"month":"2026-10","topup":15000,"spent":11500,"refunded":5500,"published":2,"citations":4}],"visibility":{"series":[{"date":"28.09.2026","value":35.6},{"date":"12.10.2026","value":41}],"neurals":[{"name":"Поиск с Алисой","value":48.2},{"name":"ChatGPT","value":33}],"current":41,"delta":5.4}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/projects/{project}/autopilot":{"patch":{"tags":["Автопилот"],"operationId":"setAutopilot","summary":"Включить или поставить на паузу","description":"На паузе уже оплаченные материалы будут опубликованы, новые система не начнёт. В ответе — обновлённый Project.","parameters":[{"name":"project","in":"path","required":true,"description":"ID проекта из списка проектов","schema":{"type":"integer","minimum":1},"example":3}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean","description":"`true` — автопилот работает, `false` — пауза"}}},"example":{"enabled":false}}}},"responses":{"200":{"description":"Обновлённый проект","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"}},"content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Project"}}},"example":{"data":{"state":"paused","id":3,"brand":"Пиксель Тулс","domain":"pixeltools.ru","budget":{"mode":"month","amount":15000,"balance":3500,"auto_topup":true},"geo_project_id":11,"published":2,"citations":4,"created_at":"2026-10-01T09:00:00+03:00"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/openapi.json":{"get":{"tags":["Спецификация"],"operationId":"getOpenApi","summary":"Спецификация OpenAPI","description":"Этот документ. Открыт без ключа.","security":[],"responses":{"200":{"description":"Документ OpenAPI 3.1","content":{"application/json":{"schema":{"type":"object"},"example":{"openapi":"3.1.0","info":{"title":"GEO-pult API","version":"1.0.0"},"paths":{}}}}}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Личный ключ: `Authorization: Bearer <ключ>`"},"apiToken":{"type":"apiKey","in":"header","name":"X-API-Token","description":"То же, другим заголовком"}},"headers":{"X-RateLimit-Limit":{"description":"Запросов в минуту","schema":{"type":"integer","example":60}},"X-RateLimit-Remaining":{"description":"Осталось в текущей минуте","schema":{"type":"integer","example":59}},"Retry-After":{"description":"Через сколько секунд можно повторить","schema":{"type":"integer","example":42}}},"responses":{"Unauthorized":{"description":"Нет ключа или он неверный","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"message":"API token required"}}}},"NotFound":{"description":"Проекта нет или он принадлежит другому пользователю","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"message":"Not found"}}}},"Invalid":{"description":"Неверные параметры запроса — подробности в `errors`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"},"example":{"message":"The enabled field is required.","errors":{"enabled":["The enabled field is required."]}}}}},"TooManyRequests":{"description":"Превышен лимит 60 запросов в минуту","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"message":"Too Many Attempts."}}},"headers":{"Retry-After":{"$ref":"#/components/headers/Retry-After"}}}},"schemas":{"Project":{"type":"object","description":"Проект","required":["id","brand","domain","state","budget","geo_project_id","published","citations","created_at"],"properties":{"id":{"type":"integer","description":"ID проекта"},"brand":{"type":"string","description":"Бренд"},"domain":{"type":"string","description":"Домен сайта"},"state":{"type":"string","enum":["running","paused","no_money","awaiting_payment"],"description":"`running` — работает, `paused` — на паузе, `no_money` — кончились деньги, `awaiting_payment` — ждёт оплаты"},"budget":{"type":"object","description":"Бюджет","required":["mode","amount","balance","auto_topup"],"properties":{"mode":{"type":"string","enum":["month","once"],"description":"`month` — каждый месяц, `once` — разово"},"amount":{"type":"integer","description":"Бюджет, ₽"},"balance":{"type":"integer","description":"Баланс проекта, ₽"},"auto_topup":{"type":"boolean","description":"Списывать бюджет 1-го числа с баланса Пиксель Тулс"}}},"geo_project_id":{"type":["integer","null"],"description":"Подключённый GEO-проект"},"published":{"type":"integer","description":"Опубликовано материалов за всё время"},"citations":{"type":"integer","description":"Цитирований за всё время"},"created_at":{"type":"string","format":"date-time","description":"Когда создан"}}},"ProjectDetails":{"allOf":[{"$ref":"#/components/schemas/Project"},{"type":"object","required":["month"],"properties":{"month":{"type":"object","description":"Бюджет текущего месяца","required":["spent","in_work","free","refunded"],"properties":{"spent":{"type":"integer","description":"Потрачено на опубликованные, ₽"},"in_work":{"type":"integer","description":"В работе: текст пишется, ждёт проверки или на модерации, ₽"},"free":{"type":"integer","description":"Свободно на балансе, ₽"},"refunded":{"type":"integer","description":"Вернулось за отказы, ₽"}}}}}]},"Material":{"type":"object","description":"Материал","required":["id","title","platform","status","price","cost_write","cost_place","plan_month","published_at","url","citations","cited_by","rejection_reason"],"properties":{"id":{"type":"integer","description":"ID материала"},"title":{"type":"string","description":"Тема"},"platform":{"type":"string","enum":["vc","pv","dtf"],"description":"`vc` — vc.ru, `pv` — PixelVibe, `dtf` — DTF"},"status":{"type":"string","enum":["planned","writing","review","moderation","published","rejected","declined"],"description":"`planned` → `writing` → `review` (ждёт вашей проверки) → `moderation` → `published` или `rejected`; `declined` — тему отклонили вы"},"price":{"type":"integer","description":"Цена: написание + размещение, ₽"},"cost_write":{"type":"integer","description":"Написание, ₽"},"cost_place":{"type":"integer","description":"Размещение, ₽"},"plan_month":{"type":"string","pattern":"^\\d{4}-\\d{2}$","description":"Месяц плана"},"published_at":{"type":["string","null"],"format":"date-time","description":"Когда опубликован"},"url":{"type":["string","null"],"format":"uri","description":"Ссылка на публикацию"},"citations":{"type":"integer","description":"Цитирований ИИ-ассистентами"},"cited_by":{"type":["string","null"],"description":"Кто и сколько раз процитировал"},"rejection_reason":{"type":["string","null"],"description":"Причина отказа модерации"}}},"Report":{"type":"object","description":"Отчёт","required":["totals","months","visibility"],"properties":{"totals":{"type":"object","description":"Итоги","required":["spent","published","citations","per_citation"],"properties":{"spent":{"type":"integer","description":"Потрачено за всё время, ₽"},"published":{"type":"integer","description":"Опубликовано"},"citations":{"type":"integer","description":"Цитирований"},"per_citation":{"type":["integer","null"],"description":"Цена цитирования, ₽; `null`, пока цитирований нет"}}},"months":{"type":"array","description":"По месяцам, новые сверху","items":{"type":"object","required":["month","topup","spent","refunded","published","citations"],"properties":{"month":{"type":"string","pattern":"^\\d{4}-\\d{2}$","description":"Месяц"},"topup":{"type":"integer","description":"Пополнено, ₽"},"spent":{"type":"integer","description":"Потрачено за вычетом возвратов, ₽"},"refunded":{"type":"integer","description":"Вернулось за отказы, ₽"},"published":{"type":"integer","description":"Опубликовано"},"citations":{"type":"integer","description":"Цитирований"}}}},"visibility":{"anyOf":[{"$ref":"#/components/schemas/Visibility"},{"type":"null"}],"description":"`null`, если GEO-проект не подключён или в нём ещё нет съёмов"}}},"Visibility":{"type":"object","description":"Видимость бренда","required":["series","neurals","current","delta"],"properties":{"series":{"type":"array","description":"Видимость по датам съёмов","items":{"type":"object","required":["date","value"],"properties":{"date":{"type":"string","description":"Дата съёма, ДД.ММ.ГГГГ"},"value":{"type":"number","description":"Видимость, %"}}}},"neurals":{"type":"array","description":"Видимость по нейросетям на последнем съёме","items":{"type":"object","required":["name","value"],"properties":{"name":{"type":"string","description":"Нейросеть"},"value":{"type":"number","description":"Видимость, %"}}}},"current":{"type":"number","description":"Текущая видимость, %"},"delta":{"type":"number","description":"Изменение за период, п. п."}}},"Error":{"type":"object","description":"Ошибка","required":["message"],"properties":{"message":{"type":"string","description":"Что пошло не так"}}},"ValidationError":{"required":["message"],"type":"object","description":"Ошибка проверки","properties":{"message":{"type":"string","description":"Первая ошибка"},"errors":{"type":"object","description":"Ошибки по полям; у неверного `month` его нет","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}}}