SmartPDF Upload API
The upload API from SmartPDF — 2 operation(s) for upload.
The upload API from SmartPDF — 2 operation(s) for upload.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/smartpdf-ru:smartpdf-ru-upload-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: SmartPDF Upload API
description: 'Все операции асинхронные: `POST /v1/pdf/…` возвращает `task_id`, статус — `GET /v1/tasks/{task_id}`.
Авторизация — заголовок `X-API-Key` с ключом из кабинета (раздел «API и MCP»).
Запрос оплачивается с баланса API аккаунта (общий для всех ключей и MCP) по единицам: единица — каждые
начатые 10 МБ входа (файл до 10 МБ — 1 единица, 25 МБ — 3; у объединения считается сумма файлов). Тяжёлые
операции — ещё и по страницам, берётся большее: распознавание текста (OCR) — единица за каждые 10 страниц
(до 100 страниц за раз, больше — `422` без списания), PDF в Word / Excel / PowerPoint / JPG — за каждые
50 страниц (JPG 300 dpi — за 25). Цена единицы и ставки — `GET /v1/pricing/api` (`request_price`,
`page_rates`); цену меняют в админке, поэтому не зашивайте её в код. На тарифе
Бизнес сначала расходуются 500 включённых обычных запросов месяца. Нет денег на балансе или исчерпан
лимит ключа — `402` с объяснением, ничего не списано. Ошибка обработки возвращает оплату автоматически.
Остаток — `GET /v1/api-keys/balance` (`balance`, `spent_month`, `request_price`, `included_remaining`),
списанное — `charge` и `charge_units` в `GET /v1/account/operations`. Пополнение, лимиты ключей,
перевыпуск и удаление — в кабинете (раздел «API и MCP»).
## Вебхуки
Передайте в запросе операции `webhook_url` (только https) — по завершении SmartPDF отправит на него
`POST` с JSON: `event` (`task.done` / `task.failed`), `task_id`, `operation_type`, `status`, `timestamp`,
`download_url` и `filename` (для `task.done`, ссылка действует 1 час) или `error_message`.
Имя результата — `_smartpdf.` (оно же в заголовке `Content-Disposition`).
Ответьте кодом 2xx; иначе будет ещё 3 попытки (через 10, 30 и 90 секунд). Редиректы не выполняются.
Заголовки: `X-SmartPDF-Event`, `X-SmartPDF-Delivery` (id операции, одинаков у повторов — по нему
отсекайте дубли) и `X-SmartPDF-Signature: t=,v1=`.
**Проверка подписи.** Секрет — кабинет → «API и MCP» (там же выпускается новый, старый сразу
перестаёт действовать).
Подпись — HMAC-SHA256 от строки `.` в hex. Сравнивайте в постоянном
времени и отклоняйте запросы старше 5 минут.
```python
import hashlib, hmac, time
def verify(secret: str, body: bytes, header: str) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
ts = int(parts["t"])
if abs(time.time() - ts) > 300:
return False
expected = hmac.new(secret.encode(), f"{ts}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, parts["v1"])
```
```javascript
const crypto = require("crypto");
function verify(secret, rawBody, header) {
const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
if (Math.abs(Date.now() / 1000 - Number(parts.t)) > 300) return false;
const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.`).update(rawBody).digest("hex");
return expected.length === parts.v1.length &&
crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1));
}
```'
version: 1.0.0
servers:
- url: https://api.smartpdf.ru
tags:
- name: Upload
paths:
/v1/upload:
post:
tags:
- Upload
summary: Upload File
operationId: upload_file_v1_upload_post
security:
- HTTPBearer: []
parameters:
- name: X-API-Key
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: X-Api-Key
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/Body_upload_file_v1_upload_post'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/UploadResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v1/upload/from-task/{task_id}:
post:
tags:
- Upload
summary: Upload From Task
description: 'Результат своей операции → новый входной файл («Что дальше» на сайте).
Файл копируется внутри MinIO, как будто его загрузили заново: те же лимит
размера по тарифу, лимит загрузок гостя и срок жизни, что у POST /upload.
Скачиванием не считается — result_expires_at не трогаем. На бесплатном
тарифе результат после скачивания удаляется уборкой (до 15 мин) — тогда 410.'
operationId: upload_from_task_v1_upload_from_task__task_id__post
security:
- HTTPBearer: []
parameters:
- name: task_id
in: path
required: true
schema:
type: string
title: Task Id
- name: X-API-Key
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
title: X-Api-Key
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/UploadResponse'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
type: object
required:
- loc
- msg
- type
title: ValidationError
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
Body_upload_file_v1_upload_post:
properties:
file:
type: string
format: binary
title: File
type: object
required:
- file
title: Body_upload_file_v1_upload_post
UploadResponse:
properties:
file_id:
type: string
title: File Id
filename:
type: string
title: Filename
size:
type: integer
title: Size
text_layer:
anyOf:
- type: boolean
- type: 'null'
title: Text Layer
type: object
required:
- file_id
- filename
- size
title: UploadResponse
securitySchemes:
HTTPBearer:
type: http
scheme: bearer