{"openapi":"3.1.0","info":{"title":"Synaplex API","version":"1.0.0","description":"Генерация фото, видео, музыки и озвучки из своих сайтов, ботов, n8n и Claude Code. Сервер в России, оплата алмазами Synaplex в рублях. Ключ — только на сервере. Документация: https://synaplex.ru/docs/api"},"servers":[{"url":"https://api.synaplex.ru"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Ключ sx_live_… из кабинета. Права: generate, read, balance"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"}}}}},"Started":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["waiting","queued","running","succeeded","failed"]},"model":{"type":"string"},"kind":{"type":"string","enum":["image","video","audio"]},"price":{"type":"integer","description":"Списано алмазов"},"balance":{"type":"integer","description":"Баланс после списания"}}},"Generation":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["waiting","queued","running","succeeded","failed"]},"model":{"type":"string"},"kind":{"type":"string"},"price":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","description":"Подписанная ссылка, живёт сутки"},"type":{"type":"string"}}}},"expiresAt":{"type":["string","null"],"format":"date-time"},"error":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"finishedAt":{"type":["string","null"],"format":"date-time"}}},"NeedTopUp":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/Error/properties/error"},"needDiamonds":{"type":"integer"},"balance":{"type":"integer"},"topUpUrl":{"type":"string"}}}}},"paths":{"/v1/me":{"get":{"summary":"Баланс, права ключа, лимиты и траты","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права или запрос из браузера","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/models":{"get":{"summary":"Модели с ценами в алмазах и возможностями (кадры, звук, длительности)","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/voices":{"get":{"summary":"Голоса для озвучки и аватаров","responses":{"200":{"content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/uploads":{"post":{"summary":"Загрузить файл (multipart, поле file) или скачать по публичной https-ссылке ({ url })","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}}}},"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"}}}}}},"responses":{"201":{"content":{"application/json":{"schema":{"type":"object","properties":{"inputKey":{"type":"string"},"kind":{"type":"string"}}}}}},"400":{"description":"Неверные параметры","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права или запрос из браузера","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/generations":{"post":{"summary":"Запустить генерацию","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Повтор запроса с тем же ключом вернёт ту же генерацию и не спишет алмазы второй раз","schema":{"type":"string","pattern":"^[\\w.:-]{8,100}$"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["model"],"properties":{"model":{"type":"string","example":"nano-banana-2"},"prompt":{"type":"string","maxLength":4000},"params":{"type":"object","description":"resolution, aspectRatio, duration, sound, imageMode (first_frame | first_last)…","additionalProperties":true},"inputKeys":{"type":"array","items":{"type":"string"},"maxItems":10},"webhookUrl":{"type":"string","format":"uri","description":"Публичный https-адрес: сюда придёт подписанный вебхук о результате"}}}}}},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Started"}}}},"400":{"description":"Неверные параметры","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NeedTopUp"}}}},"403":{"description":"У ключа нет нужного права или запрос из браузера","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Запрос с этим Idempotency-Key ещё обрабатывается","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Лимит запросов, одновременных генераций или трат ключа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"summary":"История генераций владельца ключа","parameters":[{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Generation"}},"nextCursor":{"type":["string","null"]}}}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права или запрос из браузера","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/generations/{id}":{"get":{"summary":"Статус и ссылки на результат","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Generation"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"У ключа нет нужного права или запрос из браузера","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найдено","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/tools/{slug}":{"post":{"summary":"Инструменты приложения: аватар, поздравление, апскейл, удаление фона, примерка, товар, перенос движения","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","enum":["restore","recreate","upscale","upscale-video","remove-bg","tryon","product","motion","avatar","greeting","lipsync"]}},{"name":"Idempotency-Key","in":"header","required":false,"description":"Повтор запроса с тем же ключом вернёт ту же генерацию и не спишет алмазы второй раз","schema":{"type":"string","pattern":"^[\\w.:-]{8,100}$"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","description":"Поля инструмента — как в приложении; плюс необязательный webhookUrl"}}}},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Started"}}}},"400":{"description":"Неверные параметры","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Нет ключа, ключ неверный или отозван","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NeedTopUp"}}}},"403":{"description":"У ключа нет нужного права или запрос из браузера","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Не найдено","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Лимит запросов, одновременных генераций или трат ключа","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"webhooks":{"generation":{"post":{"summary":"Генерация завершилась: event = generation.succeeded | generation.failed","description":"Заголовки: X-Synaplex-Event, X-Synaplex-Event-Id (для идемпотентности), X-Synaplex-Signature: sha256=<HMAC-SHA256(сырое тело, секрет вебхука ключа)>. Не 2xx — повторы с паузой 4 с × 2ⁿ, 11 попыток (около часа).","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"event":{"type":"string"},"eventId":{"type":"string"},"createdAt":{"type":"string"},"generation":{"$ref":"#/components/schemas/Generation"}}}}}},"responses":{"200":{"description":"Принято"}}}}}}