{"openapi":"3.1.0","info":{"title":"Antiplag API","version":"1.0.0","description":"Локальный анализ, редактура и библиотека. Долгие операции возвращают 202 и job id. Координаты UTF-16 [start,end). Метрики и ограничения: https://antiplag.online/methodology"},"servers":[{"url":"https://antiplag.online/api/v1"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"ap_<43 base64url characters>"}},"schemas":{"AnalysisInput":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","minLength":20,"maxLength":50000},"title":{"default":"Новая проверка","type":"string","maxLength":180},"modules":{"minItems":1,"maxItems":14,"type":"array","items":{"type":"string","enum":["water","spam","readability","style","integrity","seo","ai","plagiarism","semantics","spelling","nausea","evidence","structure","terminology"]}},"genre":{"default":"article","type":"string","enum":["article","academic","business","creative"]},"query":{"default":"","type":"string","maxLength":500},"keywords":{"default":[],"maxItems":30,"type":"array","items":{"type":"string","minLength":1,"maxLength":80}},"questions":{"default":[],"maxItems":10,"type":"array","items":{"type":"string","minLength":1,"maxLength":200}},"metadata":{"default":{},"type":"object","properties":{"title":{"type":"string","maxLength":200},"description":{"type":"string","maxLength":500},"author":{"type":"string","maxLength":200},"authorUrl":{"type":"string","maxLength":2000,"format":"uri"},"publishedAt":{"type":"string","maxLength":40},"updatedAt":{"type":"string","maxLength":40},"experience":{"type":"string","maxLength":2000}}},"sources":{"default":[],"maxItems":8,"type":"array","items":{"type":"object","properties":{"title":{"type":"string","maxLength":200},"text":{"type":"string","minLength":20,"maxLength":50000},"url":{"type":"string","maxLength":2000,"format":"uri"}},"required":["title","text"]}},"sourceUrls":{"default":[],"maxItems":5,"type":"array","items":{"type":"string","maxLength":2000,"format":"uri"}},"webSearch":{"default":false,"type":"boolean"},"excludeQuotes":{"default":true,"type":"boolean"}},"required":["text"],"additionalProperties":false},"RewriteInput":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"text":{"type":"string","minLength":40,"maxLength":10000},"style":{"default":"clear","type":"string","enum":["clear","concise","academic","friendly"]},"preserveTerms":{"default":[],"maxItems":30,"type":"array","items":{"type":"string","maxLength":100}},"query":{"default":"","type":"string","maxLength":500}},"required":["text"],"additionalProperties":false},"SourceInput":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"text":{"default":"","type":"string","maxLength":50000},"url":{"type":"string","maxLength":2000,"format":"uri"},"shared":{"default":false,"type":"boolean"}},"required":["title"],"additionalProperties":false},"AcceptedJob":{"type":"object","required":["id","status"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"enum":["queued","running","complete","failed","cancelled"]},"pollUrl":{"type":"string"},"reused":{"type":"boolean"}}},"Finding":{"type":"object","required":["id","module","start","end","title","explanation","suggestion"],"properties":{"id":{"type":"string"},"module":{"type":"string"},"start":{"type":"integer","minimum":0},"end":{"type":"integer","minimum":0},"severity":{"enum":["info","suggestion","warning","critical"]},"title":{"type":"string"},"explanation":{"type":"string"},"suggestion":{"type":"string"},"replacement":{"type":"string"},"sourceId":{"type":"string"},"evidenceUrl":{"type":"string","format":"uri"}}},"AnalysisResult":{"type":"object","required":["version","text","metrics","findings","states","coverage"],"properties":{"version":{"const":"1.0"},"text":{"type":"string"},"language":{"enum":["ru","en","mixed"]},"statistics":{"type":"object"},"metrics":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"module":{"type":"string"},"label":{"type":"string"},"value":{"type":["number","null"]},"unit":{"type":"string"},"status":{"enum":["ok","attention","problem","insufficient_data","unavailable"]},"description":{"type":"string"},"formula":{"type":"string"}}}},"findings":{"type":"array","items":{"$ref":"#/components/schemas/Finding"}},"states":{"type":"array","items":{"type":"object","properties":{"module":{"type":"string"},"status":{"enum":["complete","partial","unavailable","insufficient_data"]},"detail":{"type":"string"}}}},"matches":{"type":"array","items":{"type":"object"}},"coverage":{"type":"object","description":"sources,webSearchRequested,scope,retrieval: состояние каждого URL и провайдера"},"recommendations":{"type":"array","items":{"type":"object"}},"model":{"type":"object"},"elapsedMs":{"type":"number"},"createdAt":{"type":"string","format":"date-time"}}},"Job":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"enum":["analyze","rewrite","source"]},"status":{"enum":["queued","running","complete","failed","cancelled"]},"input":{"type":"object"},"result":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AnalysisResult"},{"type":"object","description":"Rewrite: text,before,after,similarity,degradation,model,reviewRequired. Source: id,title,characters,indexedPassages,scope."}]},"error_code":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"}}}}},"paths":{"/analyze":{"post":{"operationId":"analyzeText","summary":"Проверить текст; scope analyze","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":100,"pattern":"^[\\w.-]+$"},"description":"Тот же ключ и тело возвращают прежнее задание без списания квоты. Другое тело — 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalysisInput"}}}},"responses":{"202":{"description":"Задание принято: id,status,pollUrl,reused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptedJob"}}}},"400":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"401":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"403":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"409":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"413":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"429":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"}}}},"/rewrite":{"post":{"operationId":"rewriteText","summary":"Редакторский черновик; scope rewrite","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":100,"pattern":"^[\\w.-]+$"},"description":"Тот же ключ и тело возвращают прежнее задание без списания квоты. Другое тело — 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RewriteInput"}}}},"responses":{"202":{"description":"Задание принято: id,status,pollUrl,reused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptedJob"}}}},"400":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"401":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"403":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"409":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"413":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"429":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"}}}},"/sources":{"post":{"operationId":"addSource","summary":"Добавить личный источник; scope sources","parameters":[{"name":"Idempotency-Key","in":"header","schema":{"type":"string","minLength":8,"maxLength":100,"pattern":"^[\\w.-]+$"},"description":"Тот же ключ и тело возвращают прежнее задание без списания квоты. Другое тело — 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceInput"}}}},"responses":{"202":{"description":"Задание принято: id,status,pollUrl,reused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptedJob"}}}},"400":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"401":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"403":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"409":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"413":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"429":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"}}},"get":{"operationId":"listSources","summary":"Свои источники; scope sources","responses":{"200":{"description":"items, до 1000 источников"},"401":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"}}}},"/sources/{id}":{"delete":{"operationId":"deleteSource","summary":"Исключить свой источник; scope sources","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Скрыто, физическая очистка после суток"},"404":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"}}}},"/jobs/{id}":{"get":{"operationId":"getJob","summary":"Состояние и результат своего задания; scope read","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Задание","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"401":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"},"404":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"}}},"delete":{"operationId":"deleteJob","summary":"Скрыть результат и отменить незавершённое; read + analyze","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Скрыто, физическая очистка после суток"},"404":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"}}}},"/jobs":{"get":{"operationId":"listJobs","summary":"История; scope read","parameters":[{"name":"before","in":"query","schema":{"type":"string","format":"date-time"},"description":"Курсор nextCursor предыдущей страницы"}],"responses":{"200":{"description":"items до 50 элементов, nextCursor или null"},"401":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"}}}},"/usage":{"get":{"operationId":"getUsage","summary":"Использование и квоты; scope read","responses":{"200":{"description":"timezone UTC, dailyCharacterLimit, dailyRequestLimit, days за 30 дней"},"401":{"description":"Ошибка запроса: error.code, error.message, fields при валидации"}}}},"/checks":{"get":{"operationId":"listChecks","security":[],"summary":"Модули и лимиты","responses":{"200":{"description":"modules,offsets,maxCharacters,guestMaxCharacters"}}}},"/health":{"get":{"operationId":"health","security":[],"summary":"Состояние API, базы и вычислителя","responses":{"200":{"description":"ok"},"503":{"description":"degraded"}}}}}}