АПИ за конверзију е-књига у EPUB - Професионална генерација EPUB 3.0

Генеришите валидне EPUB 3.0 е-књиге од структурираног садржаја са корицама, садржајем, вишејезичком подршком и 7 шаблона. Исти улазни формат као PDF АПИ — тренутна генерација.

Шта можете да радите?
Валидан EPUB 3.0 излаз

Генеришите преливајуће EPUB е-књиге са исправним OPF метаподацима, NCX садржајем, XHTML поглављима и уграђеним сликама корица. Компатибилно са свим главним читачима е-књига.

7 професионалних шаблона

Изаберите Модеран роман, Елегантан роман, Академски рад, Пословни извештај, Кувар, Туристички водич или Технички приручник — сваки са јединственим стилом.

21+ језик

Аутоматски преведени наслови садржаја, бројеви поглавља и текст ауторских права. Са енглеског на бугарски, немачки, јапански, арапски и друге.

99.9 % Доступност
Одговор
20 req/s
2 Кредити / захтев

Convert to EPUB

POST https://api.yeb.to/v1/ebooks/epub/convert-from-file
Параметар Тип Обавезан Опис
api_key string Yes Your API authentication key (send in Authorization header or as parameter)
file_url string Yes Public URL to JSON file containing book data (metadata, chapters, options)
Same input as PDF API. Use the exact same JSON structure as the Ebooks to PDF API. Simply change the endpoint URL to get EPUB output instead of PDF.

JSON File Structure

Your JSON file at file_url should contain:

Параметар Тип Обавезан Опис
template string Yes Template name: modern-novel, elegant-novel, academic-paper, business-report, cookbook, travel-guide, technical-manual
metadata object Yes Book metadata (title, author, etc.)
metadata.title string Yes Book title
metadata.author string Yes Author name
metadata.language string Optional Language code (e.g., en, bg, de). Affects TOC heading, chapter numbering, copyright text. Default: en. Supports 21+ languages.
metadata.description string Optional Book description (embedded in EPUB metadata)
metadata.year integer Optional Publication year (default: current year)
metadata.publisher string Optional Publisher name
metadata.isbn string Optional ISBN number (added as dc:identifier in OPF)
metadata.subtitle string Optional Book subtitle (shown on title page)
metadata.series string Optional Book series name (shown on title page)
metadata.cover_image string Optional Cover image URL (downloaded and embedded in EPUB)
chapters array Yes Array of chapter objects (max: 100)
chapters[].title string Yes Chapter title
chapters[].subtitle string Optional Chapter subtitle
chapters[].content string Yes Chapter content (plain text or HTML). Paragraphs separated by \n\n are auto-wrapped in <p> tags.
options object Optional Customization options
options.include_cover boolean Optional Include cover page if cover_image provided (default: true)
options.include_copyright boolean Optional Include copyright page (default: true)
options.font_size string Optional Base font size, e.g., 12pt (default: 12pt)
options.line_height string Optional Line height, e.g., 1.6 (default: 1.6)
texts object Optional Override auto-translated texts (copyright_text, publisher_text, chapter_number_format, toc_title, etc.)

JSON File Example

1. Create book.json on your server:
{
  "template": "elegant-novel",
  "metadata": {
    "title": "The Great Gatsby",
    "author": "F. Scott Fitzgerald",
    "subtitle": "A Novel of the Jazz Age",
    "description": "A story of decadence and excess...",
    "year": 1925,
    "publisher": "Charles Scribner's Sons",
    "isbn": "978-0-7432-7356-5",
    "language": "en",
    "cover_image": "https://example.com/gatsby-cover.jpg"
  },
  "chapters": [
    {
      "title": "Chapter I",
      "content": "In my younger and more vulnerable years...\n\nAnd, after boasting this way..."
    },
    {
      "title": "Chapter II",
      "content": "About half way between West Egg and New York..."
    }
  ],
  "options": {
    "font_size": "12pt",
    "line_height": "1.6",
    "include_copyright": true
  }
}
2. Upload to your server (e.g., https://yourdomain.com/books/book.json)
3. Call the API:

Integration Examples

curl -X POST https://api.yeb.to/v1/ebooks/epub/convert-from-file \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file_url": "https://yourdomain.com/books/book.json"}'
const response = await fetch('https://api.yeb.to/v1/ebooks/epub/convert-from-file', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    file_url: 'https://yourdomain.com/books/book.json'
  })
});
const result = await response.json();
console.log(result.epub_url);
$response = Http::withHeaders([
    'Authorization' => 'Bearer YOUR_API_KEY'
])->post('https://api.yeb.to/v1/ebooks/epub/convert-from-file', [
    'file_url' => 'https://yourdomain.com/books/book.json'
]);
$epub_url = $response->json()['epub_url'];
import requests

headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
payload = {
    "file_url": "https://yourdomain.com/books/book.json"
}
r = requests.post('https://api.yeb.to/v1/ebooks/epub/convert-from-file', json=payload, headers=headers)
print(r.json()['epub_url'])

Response Examples

{
  "success": true,
  "epub_url": "https://yeb.to/storage/ebooks/epub/epub_abc123.epub",
  "epub_size": 5772,
  "template": "elegant-novel",
  "chapters": 3,
  "generated_at": "2026-02-18T14:30:00+02:00",
  "response_code": 200,
  "response_time_ms": 12
}
{
  "error": "Metadata field 'title' is required",
  "response_code": 400,
  "response_time_ms": 5
}

Кодови одговора

КодОпис
200 SuccessЗахтев обрађен успешно.
400 Bad RequestВалидација уноса неуспешна.
401 UnauthorizedAPI кључ недостаје или је погрешан.
403 ForbiddenКључ неактиван или није дозвољен.
429 Rate LimitПревише захтева.
500 Server ErrorНеочекивана грешка.
EPUB 3.0 Standard

Generated EPUBs are fully compliant with the EPUB 3.0 specification:

  • Valid OPF package document with dc:metadata
  • NCX table of contents (EPUB 2 compat)
  • EPUB 3 navigation document (nav.xhtml)
  • XHTML chapters with template-based CSS
  • Embedded cover image (JPG, PNG, WebP)
  • Title page, copyright page, TOC
  • 21+ languages auto-translated
Same Input as PDF

Use the exact same JSON data for both PDF and EPUB generation. Simply switch the endpoint URL to get your preferred output format.

Convert to EPUB

ebooks/epub/convert-from-file 2.0000 credits

Parameters

API Key
body · string · required
File URL
body · string · required

Code Samples


                
                
                
            

Response

Status:
Headers

                
Body

                

List Templates

POST https://api.yeb.to/v1/ebooks/epub/templates
Параметар Тип Обавезан Опис
api_key string Yes Your API authentication key
Free endpoint! This endpoint costs 0 credits. Use it to discover available templates before generating.

Available Templates

Modern Novel

Clean, contemporary design. Drop-cap first letters, elegant typography.

modern-novel
Fiction, novels, short stories
Elegant Novel

Classic serif design with italic chapter titles and borders.

elegant-novel
Fiction, novels, multilingual
Academic Paper

Professional layout with bold headings and clear structure.

academic-paper
Research, academic, thesis
Business Report

Sans-serif corporate design with accent borders.

business-report
Business, reports, proposals
Cookbook

Recipe-friendly layout with warm colors.

cookbook
Recipes, cooking, food
Travel Guide

Compact sans-serif design with green accents.

travel-guide
Travel, guides, tourism
Technical Manual

Structured layout with shaded headers and monospace numbers.

technical-manual
Documentation, technical, manuals

Response Example

{
  "success": true,
  "templates": [
    {
      "slug": "modern-novel",
      "name": "Modern Novel",
      "description": "Clean, contemporary design...",
      "best_for": ["fiction", "novels", "short-stories"]
    },
    {
      "slug": "elegant-novel",
      "name": "Elegant Novel",
      "description": "Fully customizable elegant design...",
      "best_for": ["fiction", "novels", "multilingual"]
    }
  ],
  "total": 7,
  "response_code": 200,
  "response_time_ms": 8
}

Кодови одговора

КодОпис
200 SuccessЗахтев обрађен успешно.
400 Bad RequestВалидација уноса неуспешна.
401 UnauthorizedAPI кључ недостаје или је погрешан.
403 ForbiddenКључ неактиван или није дозвољен.
429 Rate LimitПревише захтева.
500 Server ErrorНеочекивана грешка.

List Templates

ebooks/epub/templates 0.0000 credits

Parameters

API Key
body · string · required

Code Samples


                
                
                
            

Response

Status:
Headers

                
Body

                

АПИ за конверзију е-књига у EPUB - Професионална генерација EPUB 3.0 — Practical Guide

A hands-on guide to generating EPUB 3.0 ebooks from structured content: metadata, chapters, and templates. Same input format as the PDF API — just switch the endpoint to get reflowable EPUB output.

#What this API does

Send structured book content (metadata + chapters) and receive a valid EPUB 3.0 file with automatic table of contents, cover page, copyright page, and template-based styling. The output is reflowable — readers can adjust font size and layout on any device. Supports 21+ languages with auto-translated section headings.

Same input as PDF API. If you already use the Ebooks to PDF API, you can use the exact same JSON — just change the endpoint URL to get EPUB output instead.

#Endpoint

#POST https://api.yeb.to/v1/ebooks/epub/convert-from-file

  • Best for: Converting novels, articles, manuals, or any multi-chapter content into EPUB ebooks.
  • How it works: Pure PHP generation via ZipArchive — no external tools needed. XHTML chapters, OPF metadata, NCX + nav.xhtml TOC.
  • Output format: Valid EPUB 3.0 with NCX fallback for EPUB 2 readers.
  • Processing time: ~5-50ms depending on chapter count and cover image download.

#Quick start

Step 1: Create a JSON file with your book data:

{
  "template": "elegant-novel",
  "metadata": {
    "title": "My Book",
    "author": "Jane Doe",
    "language": "en",
    "description": "A wonderful story.",
    "cover_image": "https://example.com/cover.jpg"
  },
  "chapters": [
    {
      "title": "Chapter 1",
      "subtitle": "The Beginning",
      "content": "It was a dark and stormy night...\n\nThe wind howled through the trees."
    },
    {
      "title": "Chapter 2",
      "content": "The next morning brought sunshine and hope."
    }
  ]
}

Step 2: Upload to your server and call the API:

curl -X POST https://api.yeb.to/v1/ebooks/epub/convert-from-file \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file_url": "https://yourdomain.com/book.json"}'

Step 3: Download the EPUB from the returned URL:

{
  "success": true,
  "epub_url": "https://yeb.to/storage/ebooks/epub/epub_abc123.epub",
  "epub_size": 5772,
  "template": "elegant-novel",
  "chapters": 2
}

#Available templates

TemplateStyleBest for
modern-novelSerif, drop-cap first letters, contemporaryFiction, novels, short stories
elegant-novelPalatino serif, italic chapters, bordered headingsFiction, novels, multilingual
academic-paperTimes, bold headings, left-aligned, cleanResearch, academic, thesis
business-reportSans-serif, blue accent borders, corporateReports, proposals, white papers
cookbookSerif, warm red accents, recipe-friendlyRecipes, cooking, food
travel-guideVerdana, green accents, compactTravel guides, tourism
technical-manualSans-serif, shaded headers, monospace numbersDocumentation, manuals

#Multilingual support

Set metadata.language to a 2-letter ISO code and the EPUB will automatically use translated text for section headings:

  • Table of Contents heading (e.g., "Съдържание" for Bulgarian)
  • Chapter numbering format (e.g., "Глава {n}" for Bulgarian)
  • Copyright text (e.g., "© {year} {author}. Всички права запазени.")

Supported: en, bg, de, fr, es, it, pt, ru, uk, pl, nl, tr, ja, zh, ko, ar, cs, ro, el, sr, hr.

#Generated EPUB structure

book.epub (ZIP archive)
├── mimetype                     # "application/epub+zip" (uncompressed)
├── META-INF/
│   └── container.xml            # Points to content.opf
└── OEBPS/
    ├── content.opf              # Package document (metadata + manifest + spine)
    ├── toc.ncx                  # NCX table of contents (EPUB 2 compat)
    ├── nav.xhtml                # EPUB 3 navigation document
    ├── style.css                # Template-based stylesheet
    ├── cover.xhtml              # Cover page (if cover_image provided)
    ├── titlepage.xhtml          # Title page
    ├── copyright.xhtml          # Copyright page
    ├── chapter_001.xhtml        # Chapter 1
    ├── chapter_002.xhtml        # Chapter 2
    ├── ...
    └── images/
        └── cover.jpg            # Embedded cover image

#When to use EPUB vs PDF

FeatureEPUBPDF
Reflowable text Yes Fixed layout
Reader font control Yes No
E-ink devices (Kindle) Ideal Usable
Print-ready No Yes
Fixed page numbers No Yes
Generation speed~5-50ms~2-5 seconds
File sizeSmall (5-50KB)Larger (500KB-5MB)

Често постављана питања

Генеришемо EPUB 3.0 фајлове са NCX резервном опцијом за EPUB 2 читаче. Излаз је компатибилан са Apple Books, Calibre, Kobo, Google Play Books и свим главним читачима е-књига.

Да! EPUB АПИ прихвата тачно исту JSON структуру (метаподаци, поглавља, шаблон, опције) као АПИ за е-књиге у PDF. Једноставно промените URL крајње тачке да добијете EPUB уместо PDF.

Седам шаблона: Модеран роман, Елегантан роман, Академски рад, Пословни извештај, Кувар, Туристички водич и Технички приручник. Сваки пружа јединствен CSS стил оптимизован за читаче е-књига.

Подесите metadata.language на било који од 21+ ISO кодова (en, bg, de, fr, es, it, pt, ru, uk, pl, nl, tr, ja, zh, ko, ar, cs, ro, el, sr, hr). Наслови секција, бројеви поглавља и текст ауторских права се аутоматски преводе.

Да. Подесите metadata.cover_image на јавни URL (JPG, PNG, WebP). Слика се преузима и уграђује директно у EPUB фајл као страница корице.

Свако генерисање EPUB-а кошта 2 кредита. Крајња тачка за шаблоне је бесплатна (0 кредита). Кредити се могу купити у пакетима од 10 $.

Генерисање EPUB-а је изузетно брзо — обично 5–50 мс за књиге са до 100 поглавља. Нису потребни спољни алати или контејнери; све је изграђено у чистом PHP-у.

Генерисани EPUB фајлови се чувају 30 дана, а затим се аутоматски бришу. Преузмите свој фајл благовремено или га сачувајте на сопственом CDN-у.

Да. Сваки захтев, чак и они са грешком, троши кредите. Ваши кредити су везани за број захтева, без обзира на успех или неуспех. Ако је грешка јасно узрокована проблемом платформе на нашој страни, вратићемо погођене кредите (без новчаних рефундација).

Контактирајте нас на [email protected]. Озбиљно схватамо повратне информације—ако је ваш извештај о грешци или захтев за функцију смислен, можемо брзо поправити или унапредити API и доделити вам 50 бесплатних кредита као захвалност.

Зависи од API-ја и понекад чак и од крајње тачке. Неке крајње тачке користе податке из спољних извора, који могу имати строже лимите. Такође примењујемо лимите да бисмо спречили злоупотребу и одржали стабилност платформе. Проверите документацију за конкретан лимит сваке крајње тачке.

Радимо на кредитном систему. Кредити су унапред плаћене, неповратне јединице које трошите на API позиве и алате. Кредити се троше по FIFO принципу (најстарији прво) и важе 12 месеци од датума куповине. Контролна табла приказује сваки датум куповине и његов истек.

Да. Сви купљени кредити (укључујући делимичне салда) важе 12 месеци од куповине. Некоришћени кредити аутоматски истичу и трајно се бришу на крају периода важности. Истекли кредити се не могу повратити или претворити у готовину или другу вредност. Прелазно правило: кредити купљени пре 22. септ. 2025. третирају се као купљени 22. септ. 2025. и истичу 22. септ. 2026. (осим ако је при куповини наведен ранији истек).

Да—у оквиру периода важности. Некоришћени кредити остају доступни и преносе се из месеца у месец док не истекну 12 месеци након куповине.

Кредити су неповратни. Купујте само оно што вам треба—увек можете допунити касније. Ако грешка платформе изазове неуспешно задужење, можемо вратити погођене кредите након истраге. Без новчаних рефундација.

Цене су постављене у кредитима, не у доларима. Свака крајња тачка има своју цену—погледајте значку „Кредити / захтев" изнад. Увек ћете тачно знати колико трошите.
← Назад на API-је