curl --fail-with-body -X POST \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
-H "Content-Type: application/json" \
--data-raw '{"kind":"image","url":"https://example.com/reference.png"}' \
"https://apergrex.ru/franklab/api/franklab/jobs/import"
Prepare an input file
Import a direct public HTTPS URL or inspect a file already owned by your account. Supply exactly one of url and storedFileId. Returns data.storedFileId, url, mimeType, sizeBytes and measured width/height, durationSeconds/fps or pageCount depending on kind. Limits: image 30 MiB, video 100 MiB, audio 50 MiB, PDF/TXT/MD 20 MiB. The selected model may impose stricter limits. No transcoding is performed.
Request body
kind *
string
image, video, audio or document
url
string
Direct public HTTPS file URL; mutually exclusive with storedFileId.
storedFileId
string
UUID v4 of an owned file; mutually exclusive with url.
Responses
200 File prepared; success=true, metadata in data.
400 Invalid source, unavailable file, unsupported format or size.
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Import limit: 10 requests per minute; concurrent downloads and inspections are bounded. Retry later.
billing
get/v1/billing/api-keys
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/api-keys"
List API keys
The partner's keys: prefix, label, active flag, dates. Raw keys are never returned.
Responses
200 Key list
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
Creates a new fl_live_… key (partner SESSION auth, not an API key: a key must not be able to mint keys). The raw value is returned exactly once — store it immediately.
Request body
label
string
Free-form label (up to 120 chars)
Responses
201 Key created; the raw value is shown once
401 Missing or expired cabinet session
403 Access denied; a cabinet session is required, not an API key
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
Deactivates one of your keys by its id (partner SESSION auth). Idempotent: a foreign id matches nothing and returns no error.
Parameters (1)
id *
path · string
Key identifier
Responses
200 Key deactivated (or already inactive)
401 Missing or expired cabinet session
403 Access denied; a cabinet session is required, not an API key
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/billing/balance
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/balance"
Partner balance
Returns total (lifetime credited), used (lifetime confirmed spend), reserved (held by open task reservations), available (total − used − reserved, floored at 0) the isLow flag (true when available is below lowBalanceThresholdFranks) and that threshold itself as lowBalanceThresholdFranks — the same one that triggers the billing.low_balance webhook. Amounts are in franks (₣), the platform's internal accounting unit.
Responses
200 Balance returned
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/billing/legal-invoices/{id}/pdf
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/legal-invoices/${FRANKLAB_ID:?Set the resource identifier}/pdf"
Invoice PDF
The invoice PDF (inline; occasionally a redirect to the bank's file). Limit: 12 requests/min.
Parameters (1)
id *
path · string
Invoice identifier
Responses
200 PDF file
302 Redirect to the bank's PDF file
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
post/v1/billing/legal-invoices/{id}/refresh
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X POST \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/legal-invoices/${FRANKLAB_ID:?Set the resource identifier}/refresh"
Refresh an invoice
Fetches the current invoice status from the bank. Limit: 6 requests/min.
Parameters (1)
id *
path · string
Invoice identifier
Responses
200 Current status
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
post/v1/billing/legal-invoices/{id}/sbp-link
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X POST \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/legal-invoices/${FRANKLAB_ID:?Set the resource identifier}/sbp-link"
SBP B2B link
Creates an SBP B2B payment QR link for the invoice. Limit: 6 requests/min.
Parameters (1)
id *
path · string
Invoice identifier
Responses
200 SBP link
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
post/v1/billing/legal-invoices/create
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X POST \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
-H "Content-Type: application/json" \
--data-raw '{"amountRub":1000,"expectedProfileRevision":1}' \
"https://apergrex.ru/franklab/api/v1/billing/legal-invoices/create"
Create a legal invoice
Creates an invoice via T-Bank Business; on payment the balance is credited automatically (RUB→₣ 1:1). Limit: 3 requests/min. Replace sample company details with your own; obtain expectedProfileRevision from the current GET /v1/billing/legal-invoices/profile response.
Request body
amountRub *
integer
Invoice amount in rubles (1–100,000)
expectedProfileRevision *
integer
The profile revision to create against (≥1; guards against stale requisites)
comment
string
Comment (up to 140 chars)
Responses
201 Invoice created
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/billing/legal-invoices/history
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/legal-invoices/history"
Invoice history
Legal invoices with statuses, amounts and credit dates.
Parameters (2)
page
query · integer
Page number
limit
query · integer · ≤100
Page size
Responses
200 Invoice list
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/billing/legal-invoices/profile
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/legal-invoices/profile"
Legal company profile
The company profile used for legal invoicing (tax id, name, address, etc.).
Responses
200 Profile
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
put/v1/billing/legal-invoices/profile
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X PUT \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
-H "Content-Type: application/json" \
--data-raw '{"companyName":"Example company","inn":"0000000000","email":"billing@example.com"}' \
"https://apergrex.ru/franklab/api/v1/billing/legal-invoices/profile"
Upsert the company profile
Creates or updates the invoicing company profile. Replace sample company details with your own; obtain expectedProfileRevision from the current GET /v1/billing/legal-invoices/profile response.
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/billing/payment/history
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/payment/history"
Top-up history
The list of top-up payments with their statuses (pending/authorized/confirmed/canceled/rejected/failed). Returns the last 50 payments.
Responses
200 Top-up history
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
post/v1/billing/payment/link
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X POST \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
-H "Idempotency-Key: ${FRANKLAB_IDEMPOTENCY_KEY:?Set this header; reuse its value for the same operation}" \
-H "Content-Type: application/json" \
--data-raw '{"amountRub":1000}' \
"https://apergrex.ru/franklab/api/v1/billing/payment/link"
Top-up payment link
Creates a T-Bank payment link for topping up the balance (RUB→₣ 1:1). The Idempotency-Key header is required: a retry with the same key returns the same payment instead of creating a new one. Card saving is not available programmatically. The link is opened by the payer in a browser. Limit: 3 requests/min.
Parameters (1)
Idempotency-Key *
header · string
Idempotency key (up to 128 chars; a retry with the same key and amount returns the same payment, a different amount yields 409)
Request body
amountRub *
integer
Amount in rubles (1–100,000); 1 RUB = 1 ₣
description
string
Free-form description (up to 140 chars)
Responses
201 Payment created (or an existing one returned): paymentUrl to pay
400 Missing/invalid Idempotency-Key or amount out of range
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/billing/pricing/catalog
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/pricing/catalog"
Price catalog
The base price showcase grouped by media family (video/image/audio/text/processing) with billing units. All prices are in franks — the platform's internal accounting unit (not a currency); the item.unitOfAccount field is 'Франки'. The item.currency field is a deprecated alias of unitOfAccount (transition period, will be removed). The response is not cached (no-store); re-reading once per 24 hours is enough (refreshAfterSeconds).
Responses
200 Price catalog
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
post/v1/billing/pricing/estimate
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X POST \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
-H "Content-Type: application/json" \
--data-raw '{"modelId":"mars-v1-5","duration":5,"operation":"text_to_video","mode":"std","resolution":"720p"}' \
"https://apergrex.ru/franklab/api/v1/billing/pricing/estimate"
Operation cost estimate
A side-effect-free cost quote for a planned operation at your tariff (the same seam that reserves funds on submit). Pass the model and parameters; media URLs are not accepted — pass reference counts instead.
Quality tier: low/medium for gpt-image-2 (codex route) and xAI Image 2 (low/medium); high applies to gpt-image-2 only
prompt
string
Prompt (up to 3000 chars; needed for google-model token pricing)
imageCount
integer
Input image count (MIST i2i)
referenceImageCount
integer
Reference image count (0–30)
referenceVideoCount
integer
Reference video count (0–10)
referenceAudioCount
integer
Reference audio count (0–10)
imageOutputCount
integer
Images per request, `n` (1–9): price multiplier for xAI Image / Image 2, Kling omni-image (jupiter-v1-5) and GPT Image
voiceCount
integer
Kling video: number of voices in the launch voice_list (0–10). The voice surcharge applies only when the prompt contains <<<voice_N>>> markup
Responses
200 Cost quote at the effective tariff
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/billing/tariff
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/tariff"
Tariff plan
The effective tariff (base/pro/max/ultra), assigned and earned plans, lifetime spend (₣), the next tier and the spend still required, plus the discount percent against the base price list.
Responses
200 Tariff returned
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/billing/transactions
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/transactions"
Transaction history
Paginated ledger of operations: type (topup/reservation/confirm/refund; debit is a rare legacy row kind; bonus_reversal claws back a bonus credit and is not spend), amount in ₣, price per unit, task, date, attribution; kind is the operation kind (top-up, bonus, task or order hold/charge/refund, adjustment, etc.) and label/description carry its short Russian caption. Pagination by page/limit (limit ≤ 100).
Filter by transaction type (debit is a legacy row kind; bonus_reversal claws back a bonus credit)
attribution
query · string · all | company | personal
Whose top-ups to show: all / company / personal
dateFrom
query · string
Range start (ISO 8601)
dateTo
query · string
Range end (ISO 8601)
page
query · integer
Page number
limit
query · integer · ≤100
Page size
Responses
200 Paginated transaction list
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/billing/transactions/export
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/transactions/export"
Export transactions as CSV
CSV download of the ledger (attachment). Same filters as the list endpoint; up to 10,000 rows per export — beyond that a `# truncated: …` comment line with the full count is appended.
Filter by transaction type (debit is a legacy row kind; bonus_reversal claws back a bonus credit)
dateFrom
query · string
Range start (ISO 8601)
dateTo
query · string
Range end (ISO 8601)
format
query · string · csv
Export format; csv is the only option
attribution
query · string · all | company | personal
Whose top-ups to include: all / company / personal
Responses
200 CSV file
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/billing/usage/daily
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/billing/usage/daily"
Daily usage
Confirmed spend per UTC day: confirm rows minus task-less refunds.
Parameters (2)
dateFrom
query · string
Range start (ISO 8601)
dateTo
query · string
Range end (ISO 8601)
Responses
200 Per-day aggregation
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
webhooks
get/v1/webhooks/deliveries
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/webhooks/deliveries"
Delivery history
The partner's last 50 deliveries with statuses (pending/delivering/delivered/uncertain/dead_lettered), attempts and response codes.
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
post/v1/webhooks/deliveries/{id}/replay
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X POST \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/webhooks/deliveries/${FRANKLAB_ID:?Set the resource identifier}/replay"
Replay a delivery
Re-queues a delivery (uncertain, dead_lettered or delivered) under the same eventId. Limit: 30 requests/min.
Parameters (1)
id *
path · string
Delivery identifier
Responses
200 Delivery re-queued
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
get/v1/webhooks/endpoints
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X GET \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/webhooks/endpoints"
List webhook endpoints
The partner's endpoints: URL, subscriptions, active flag. Secrets are never returned.
Responses
200 Endpoint list
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
post/v1/webhooks/endpoints
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X POST \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
-H "Content-Type: application/json" \
--data-raw '{"url":"https://example.com/franklab-hook","eventTypes":["billing.settled","task.succeeded"]}' \
"https://apergrex.ru/franklab/api/v1/webhooks/endpoints"
Register an endpoint
Creates an endpoint; the whsec_… secret is returned exactly once. The URL must be public HTTPS; internal addresses are rejected. Up to 10 endpoints per partner. Limit: 10 requests/min.
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
delete/v1/webhooks/endpoints/{id}
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X DELETE \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/webhooks/endpoints/${FRANKLAB_ID:?Set the resource identifier}"
Delete an endpoint
Deletes one of your endpoints; its pending deliveries go with it.
Parameters (1)
id *
path · string
Endpoint identifier
Responses
200 Endpoint deleted
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
post/v1/webhooks/endpoints/{id}/rotate-secret
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X POST \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/webhooks/endpoints/${FRANKLAB_ID:?Set the resource identifier}/rotate-secret"
Rotate the secret
Generates a new signing secret; the new value is returned exactly once. The old secret keeps working for 6 more hours (grace window): deliveries are signed with the new secret (X-Franklab-Signature) and additionally with the previous one (X-Franklab-Signature-Previous) — during the grace window the receiver may verify either signature. The response carries previousSecretValidUntil, the end of the window. After the window the previous secret is wiped. Limit: 10 requests/min.
Parameters (1)
id *
path · string
Endpoint identifier
Responses
200 The new secret
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets
post/v1/webhooks/endpoints/{id}/test
Authentication: partner API key.
Request example (replace sample values)
curl --fail-with-body -X POST \
-H "X-API-Key: ${FRANKLAB_KEY:?Set your API key}" \
"https://apergrex.ru/franklab/api/v1/webhooks/endpoints/${FRANKLAB_ID:?Set the resource identifier}/test"
Send a test event
Enqueues a webhook.test event for EXACTLY this endpoint — verify receipt and the signature. Limit: 6 requests/min.
Parameters (1)
id *
path · string
Endpoint identifier
Responses
200 Event enqueued
401 Missing or invalid API key
403 Legacy service keys are rejected: a partner API key is required
429 Rate limit exceeded (default 60 requests/minute per API key; session-authenticated cabinet operations are counted per partner); the Retry-After header gives seconds until the window resets