Heyzine API
Application programming interface for developers or NoCode tools to integrate flipbooks in applications or workflows.
Començant
Heyzine uses API keys to authenticate the conversions. You have to provide an API key on every request. Both the manually and API converted flipbooks will show up on the Heyzine dashboard.
Accés o registre per veure la teva clau api aquí.
It's possible to convert a PDF with a simple link, API rest calls, or by using a javascript plugin to convert all the PDF links of a page automatically.
Conversió PDF a flipbook amb enllaç
Create a link with parameters pointing to your pdf file and use it in anchors, iframes, dialogs, or anywhere else.
The link will redirect to the final flipbook url. The conversion process starts with the first access, so it can take some time to load the first time you open it.
URL: https://heyzine.com/api1?pdf={pdfLink}&k={apiKey}
Exemples
https://heyzine.com/api1?pdf=http://www.pdf995.com/samples/pdf.pdf&k=d3m0
https://heyzine.com/api1?pdf=http://www.pdf995.com/samples/pdf.pdf&t=Test title&s=Test subtitle&d=1&k=d3m0
See the parameter reference for all the available customizations through the API.
To convert server-side to avoid revealing the original url, you can use the /rest path and get a json response.
PDF to flipbook REST API
Call the REST endpoint client or server-side, to convert the PDF and get a JSON response with the links to the flipbook, thumbnail, and PDF.
The endpoint will send the response right after the conversion ends. You have to make sure the client has a long enough time out for the largest documents.
URL: https://heyzine.com/api1/rest?pdf={pdfLink}&k={apiKey}
Exemple REST
Request:
https://heyzine.com/api1/rest?pdf=http://www.pdf995.com/samples/pdf.pdf&k=d3m0
Response:
{
"url": "https://heyzine.com/flip-book/1f083f5b3e.html",
"thumbnail": "https://cdnc.heyzine.com/flip-book/cover/1f083f5b3e.jpg",
"pdf": "https://cdnc.heyzine.com/flip-book/pdf/1f083f5b3ee73a562ca27afc0e2cfa29ba9eeedc.pdf"
}
See the parameter reference for all the available customizations through the API.
Asynchronous requests
Call the Async REST endpoint to get the JSON response immediately in case you don't want to wait for the conversion process.
Subsequent calls to the endpoint with the same parameters will return the current state of the conversion. (started, processed, or failed). During the conversion time, flipbook links will show a not-found page.
URL: https://heyzine.com/api1/async?pdf={pdfLink}&k={apiKey}
Exemple REST Async
Request:
https://heyzine.com/api1/async?pdf=http://www.pdf995.com/samples/pdf.pdf&k=d3m0
Response:
{
"url": "https://heyzine.com/flip-book/1f083f5b3e.html",
"thumbnail": "https://cdnc.heyzine.com/flip-book/cover/1f083f5b3e.jpg",
"pdf": "https://cdnc.heyzine.com/flip-book/pdf/1f083f5b3ee73a562ca27afc0e2cfa29ba9eeedc.pdf",
"state": "processed"
}
See the parameter reference for all the available customizations through the API.
Conversion parameters reference
Paràmetre | Requerit | Descripció |
---|---|---|
requerit | Url pointing to the pdf to be converted. Must be a direct link to PDF correctly url encoded. | |
k | requerit | Api key for the conversion. Get the key for free above |
tpl | opcional | Flipbook ID to use as a template. It copies the logo, page effect, background, controls, and all the styles. It doesn't copy the access list and interactions. |
t | opcional | Títol per a mostrar a la pàgina pdf |
s | opcional | Subtítol per a mostrar a la pàgina del pdf |
d | opcional | Permet descarregar el PDF original |
fs | opcional | Mostra el botó de pantalla completa. fs=1 per a mostrar-lo |
sh | opcional | Show the share button. sh=1 to show it. |
pn | opcional | Show the previous and next buttons. pn=1 to show it. |
st | opcional | Mostra títol, subtítol i descripció al fons del flipbook. st=1 per a mostrar-ho. |
bg | opcional | Eliminar el fons de la imatge i usar un color sòlid amb hex. bg=0000 per al negre bg=ffffff per al fons blanc |
lg | opcional | Url directa al logo d'empresa que s'afegirà al flipbook |
Find the ID of a flipbook on your account
jQuery PDF a flipbook
jQuery plugin to convert all the PDF links on your site to flipbooks.
Pasos d'ús:
1.-Inclure jquery i el plugin mitjançant un CDN o descarrega i inclou-ho al teu projecte:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnc.heyzine.com/release/jquery.pdfflipbook.4.js"></script>
2.-Crida al plugin amb la clau per convertir tots els enllaços:
$('a').pdfFlipbook({ key: 'd3m0' });
3.-Opcionalment, pots usar atributs DOM per personalitzar el flipbook i la presentació resultant:
Paràmetre | Requerit | Descripció | Exemple |
---|---|---|---|
flipbook | Opcional | Quan un element té un href, aquest atribut s'ignorarà, sino defineix la url del fitxer pdf i l'assigna al event de clic per a la navegació. | <span flipbook="/link-to-pdf.pdf">Això és un flipbook</span> |
title | Opcional | Títol per a la pàgina | <a flipbook="/link-to-pdf.pdf" title="title">Això és un flipbook</a> |
subtitle | Opcional | Subtítol per a la pàgina | <a flipbook="/link-to-pdf.pdf" subtitle="subtitle">Això és un flipbook</a> |
showdownload | Opcional | Mostra el botó de descarrega a la pàgina del flipbook | <a flipbook="/link-to-pdf.pdf" showdownload>Això és un flipbook</a> |
showmodal | Opcional | Obrir el flipbpok a un diàleg sencill sobre la pàgina | <a flipbook="/link-to-pdf.pdf" showmodal>Això és un flipbook</a> |
See the jquery demo here: Demo
oEmbed API
oEmbed is an API that allows third-party websites and apps to fetch an Html embed code to display Heyzine flipbooks.
Discovering oEmbed URIs
Most flipbooks support oEmbed. Your application can discover the corresponding oEmbed URI by searching the flipbook for a element with the type "application/json+oembed".
For example, the flipbook sample here, includes the following link tag:
<link rel="alternate" type="application/json+oembed" href="https://heyzine.com/api1/oembed?url=https%3A%2F%2Fheyzine.com%2Fflip-book%2Fdce36e099f.html&format=json" title="PDF to Flipbook | Heyzine" />
Using oEmbed data from Heyzine in your app or website
Send a GET request to /api1/oembed, with the url parameter set to a flipbook link to get his oEmbed data.
Heyzine supports the standard oEmbed 1.0 parameters (url, format, maxwidth, and maxheight).
Request:
https://heyzine.com/api1/oembed?url=https%3A%2F%2Fheyzine.com%2Fflip-book%2Fdce36e099f.html&format=json
Response:
{
"type": "rich",
"version": "1.0",
"title": "Venice guide",
"provider_name": "Heyzine",
"provider_url": "https:\/\/heyzine.com",
"html": "<iframe allowfullscreen=\"allowfullscreen\" scrolling=\"no\" class=\"fp-iframe\" style=\"width: 100%; height: 600px;\" src=\"https:\/\/heyzine.com\/flip-book\/dce36e099f.html\"><\/iframe>",
"width": 1920,
"height": 2717,
"thumbnail_url": "https:\/\/heyzine.com\/files\/uploaded\/v2\/dce36e099f71f95449f722bfc227cb4bdd1b30f0.pdf-thumb.jpg",
"thumbnail_width": 400,
"thumbnail_height": 566
}
Webhooks
Heyzine supports webhooks to notify events to an external endpoint URL with a predefined frequency.
Access your account webhooks section to define the endpoints and frequency.
Leads Webhook
The webhook will be called each time new leads are collected on any lead generation form in the account.
Request body reference:
data: {
"id_webhook": Identifier of the event,
"date": Date an time (UTC) of the event request,
"leads": [
0: {
date: Date and time (UTC) when the lead was collected,
first_value: Answer to the first field on the form,
second_value: Answer to the second field on the form,
flipbook: {
id: Identifier of the flipbook containing the form,
title: Title set on the publish settings of the flipbook
},
answer: [
0: {
label: Question on the form,
value: Lead answer,
},...
]
},...
]
}
Límits API
Amb el pla gratis, tens fins a 5 flipbooks gratis, després els més antics s'eliminaran.
With subscription you have unlimited conversions.