Flipsnack API

collection.create

Uploads a single PDF document and creates a collection with a single item (flipbook).Once the upload has finished, the collection is created and the PDF document starts theconversion process. Converting a PDF document into a flipbook might take up to severalminutes, depending on the size of the document.

The API method will return a response as soon as the document finished uploading. You cancheck the status of the collection item using the collection.getCollection method. Itwill let you know if the document is still converting, has finished conversion or ifthe conversion process has failed.

Note: Requests must be made to https://upload.flipsnack.com/v1.Once the API call is successful, even if the document fails to convert, the request iscounted to the monthly upload counts. If the request fails, the request is not takeninto consideration for the monthly upload counts.

Request parameters

NameTypeDescription
apiKey (required)stringThe API key provided for your user. If it is not specified, the request willreturn the error code "30 - Missing mandatory parameter". If the key is incorrect therequest returns the error code "41 - Invalid credentials".
signature (required)stringThe signature must be calculated by you and added to the request. SeeHow to sign a request for more information.If the parameter is missing the request will return the error code "30 - Missingmandatory parameter". If the signature is incorrect the request will return theerror code "44 - Invalid signature".
action (required)stringThe API method that should be called. In this case the value should becollection.create. If it is not specified, the request will return theerror code "30 - Missing mandatory parameter".
file (required)fileThe PDF document that should be uploaded.

Documents can be uploaded either using a local file, through thefile parameter, or from an external URL, using thefileUrl parameter. You must specify at least one of them. Ifboth parameters are specified, the API will take into consideration only thefile parameter.

If neither file or fileUrl are specified the request will return the error code"30 - Missing mandatory parameter". Also, file uploads are bound to APIlimitations, which allow only PDF files ofmaximum 100 MB and 500 pages.
fileUrl (required)stringThe URL of a PDF document.

Documents can be uploaded either using a local file, through thefile parameter, or from an external URL, using thefileUrl parameter. You must specify at least one of them. Ifboth parameters are specified, the API will take into consideration only thefile parameter.

If neither file or fileUrl are specified the request will return the error code"30 - Missing mandatory parameter". Also, file uploads are bound to APIlimitations, which allow only PDF files ofmaximum 100 MB and 500 pages.
formatstringThe format of the response from the server. Possible values are json,jsonp and xml. If you set format tojsonp, you must also specify the callback parameter.

Default: json.
callbackstringThe name of the callback function used for the jsonp response. This parameteris required if format is set to jsonp. Otherwise itis ignored.
titlestringThe title of the collection. This title will appear on the collection's directlink and in the My Collections page. By default, if a title is not given,Flipsnack will try to extract the title from the uploaded document.
descriptionstringThe description of the collection. By default, during the conversion process,Flipsnack extracts the first few words from the document. You can overwrite thatdescription with yours, using this parameter.
collectionWidthnumberThe embed width of the widget (measured in pixels).

Default: 650.
collectionHeightnumberThe embed height of the widget (measured in pixels).

Default: 385.
collectionStatusstringThe type of collection. Possible values are public, editableand unlisted.

Public collections are listed on your public profile and in search results.They are publicly available to other users.

Editable collections are not published. They must be published manually from theFlipsnack editor or have their status updated using thecollection.update method.

Unlisted collections are published but not listed on your profile page and insearch results. Other users may view them only if they receive a direct link oran embedded widget from you.

Note: Once a collection receives the public status, itcannot be changed to unlisted, even if the current status is set toeditable. But unlisted collections can be changed topublic collections.

Default: public.
showControlsbooleanIf set to true, then the navigation controls will be displayed in normal mode

Default: false.
enableDownloadbooleanIf set to true, displays the download button in the flash widget menu.The menu is displayed only when the widget is in fullscreen.

Default: true.
enablePrintbooleanIf set to true, displays the print button in the widget menu. The menu is displayed when the widget is in fullscreen.

Default: true.
enableFullScreenbooleanIf set to true, allows the Flash widget to enter fullscreen mode: a"Click to read" button is displayed.

Default: true.
enableSearchbooleanIf set to true, displays the search button in the flash widget menu.The menu is displayed only when the widget is in fullscreen.

If there is no text to search within the current collection item, the searchbutton is displayed, but disabled.

Default: true.
tooltipsLanguagestringSelects the language for the tooltips displayed in the flash widget. Possiblelanguages are: Basque, Bosanski, Català, Czech, Dansk, Deutsch, English,Español, כשר, Française, ελληνικά, Hrvatski, Indonesian, Italiano, Magyar,Nederlands, Nederlands, Norsk, Polski, Português, Português do Brasil, Română,Pусский, Cрпски, Slovene, Suomi, Slovak, Swedish, Turkish.

Default: English.
backgroundstringThe background color of the widget. Possible values are color andtransparent. If set to transparent, the widget is displayedwith no background. Background color value can be set using thecolor parameter, explained below.

Default: color.
colorstringThe background color of the widget, specified as a hexadecimal value. If thebackground is set to transparent, the widget willignore the color parameter.

Default: 444444.
backgroundScaleTypestringThe scale mode of images used as background for the widget. Possible values arescaleCrop, center and tile. Background images can beset using the collection.setBackgroundImage method.

Default: scaleCrop.
autoFlipbooleanIf set to true, allows the widget to automatically turn the pages ofthe flipbook. The pages turn after a time specified by theautoFlipDelay parameter.

Default false.
autoFlipDelaynumberSpecifies the time in seconds for pages to turn automatically. IfautoFlip is false, this parameter is ignored.

Default: 6.
rightToLeftOrientationbooleanIf set to true, allows the flipbook to be viewed from right to left:the first page is starts from the end, as viewed in normal mode. This option isuseful for documents written in right to left languages.

Default: false.
singlePageViewbooleanIf set to true, allows the flipbook to be viewed a single page at a time.

Default: false.
logoUrlstringThe URL of the logo image. A logo image can be set only by uploading it with thecollection.setLogo method.

Response parameters

If the upload is successful, the API call returns information about the collection whichwas just created.

Name Type Description
collectionHash string The hash for the newly created collection. If the collection status is editable the generated hash will be temporary. Once the collection is published, a new, final hash will be generated for it.
collectionTitle string The title of the collection.
collectionDescription string The description of the collection. It can be specified in the creation parameters or generated by the conversion system.
collectionStatus string The current status of the collection: public, editable or unlisted.
coverImage string The url of the collection's thumbnail image. This thumbnail is generated from the first page of the first collection item.
collectionPageCount number The number of pages in the collection, for all the collection items.
createdDate date The date when the collection was created (not necessarily published).
publishDate date The date when the collection was published.
directLink string The public link of the collection.
flipbookPageCount number The number of pages of the collection item.

For collections created with the API, collectionPageCount and flipbookPageCount should have the same value.
flipbookStatus string The status of the flipbook. Possible values are
  • processing: the document is still converting;
  • complete: the document was converted successfully;
  • failed: the conversion process failed.
Converting a PDF document is a time consuming process. You can check the status of a flipbook at a few seconds intervals by using the collection.getCollection method. The requests to collection.getCollection should be made until the flipbook has completed or failed converting.
settings object An object containing the configuration parameters of the collection, as set from the API call. See the list below.
collectionItems array The list of collection items belonging to the collection. In case of collections created using the API, the list contains a single item.

The parameters of the collection item are listed below.

Configuration parameters

Name Type Description
collectionWidth number The embed width of the widget (measured in pixels).
collectionHeight number The embed height of the widget (measured in pixels).
collectionStatus string The type of collection. Possible values are public, editable and unlisted.

Public collections are listed on your public profile and in search results. They are publicly available to other users.

Editable collections are not published. They must be published manually from the Flipsnack editor or updated using the collection.update method.

Unlisted collections are published but not listed on your profile page and in search results. Other users may view them only if they receive a direct link or an embedded widget from you.
enableDownload boolean If set to true, displays the download button in the flash widget menu. The menu is displayed only when the widget is in fullscreen.
enableFullScreen boolean If set to true, allows the Flash widget to enter fullscreen mode: a "Click to read" button is displayed.
enableSearch boolean If set to true, displays the search button in the flash widget menu. If there is no text to search within the current collection item, the search button is displayed as disabled.
tooltipsLanguage string Selects the language for the tooltips displayed in the flash widget. Possible languages are: Basque, Bosanski, Català, Czech, Dansk, Deutsch, English, Español, כשר, Française, ελληνικά, Hrvatski, Indonesian, Italiano, Magyar, Nederlands, Nederlands, Norsk, Polski, Português, Português do Brasil, Română, Pусский, Cрпски, Slovene, Suomi, Slovak, Swedish, Turkish.
transparentBackground boolean If set to true, the widget is displayed with no background. When embedding Flash widgets, make sure that the wmode parameter of the embed tag is set to 'transparent'.
backgroundColor string The background color of the widget, specified as a hexadecimal value. If the transparentBackground is set to true, the widget will ignore the backgroundColor parameter.
backgroundScaleType string The scale mode of images used as background for the widget. Possible values are scaleCrop, center and tile. Background images can be set using the collection.setBackgroundImage method.
autoFlip boolean If set to true, allows the widget to automatically turn the pages of the flipbook. The pages turn after a time specified by the autoFlipDelay parameter.
autoFlipDelay number Specifies the time in seconds for pages to turn automatically. If autoFlip is false, this parameter is ignored.
rightToLeftOrientation boolean If set to true, allows the flipbook to be viewed from right to left: the first page is starts from the end as viewed in normal mode. This option is useful for documents written in right to left languages.
singlePageView boolean If set to true, allows the flipbook to be viewed a single page at a time.
logoUrl string The URL of the logo image. A logo image can be set only by uploading it with the collection.setLogo method.
shareFacebook boolean If set to true, the Flash widget displays a Facebook sharing option in the widget menu, in fullscreen mode.
shareTwitter boolean If set to true, the Flash widget displays a Twitter sharing option in the widget menu, in fullscreen mode.
shareGooglePlus boolean If set to true, the Flash widget displays a Google+ sharing option in the widget menu, in fullscreen mode.
sharePinterest boolean If set to true, the Flash widget displays a Pinterest sharing option in the widget menu, in fullscreen mode.
shareEmail boolean If set to true, the Flash widget displays an email sharing option in the widget menu, in fullscreen mode.
shareLinkText string The link opened from the link sharing option, within the widget. By default, this link is the direct link of the collection.

Collection item (flipbook) parameters

.
Name Type Description
flipbookHash string The hash generated for the collection item.
flipbookPageCount number The number of pages of the collection item.
flipbookTitle string The title of the flipbook.
flipbookDescription string The description of the flipbook.
extension string The extension of the document that the flipbook is based on. Extensions can be pdf, jpg or png.
convertStatus string The status of the flipbook specifies if it has finished converting or if it is still in the process of conversion. Possible values are PROCESSING, FAILED and COMPLETE.

Error codes

CodeMessageExplanation
30Missing mandatory parameterThe request does not contain one or more required parameters. There are at least 3required parameters for every request: apiKey, signatureand action. Other methods may also have extra mandatory parameters.Please check the API Reference for more information.
31Requests per second limit exceededThere were too many requests per second made with the same API key.
32Requests per minute limit exceededThere were too many requests per minute made with the same API key.
33Uploads per month exceededYou have exceeded the maximum number of uploads allowed per month.
34File size too largeThe file you have uploaded has a size that exceeds the maximum file size allowed.For more information please see the limitations imposed bythe API.
35Collection maximum pages number exceededYou have uploaded a document that exceeds the maximum of 500 pages allowed. For moreinformation please see the limitations imposed by theAPI.
36Multiple files upload not allowedFlipsnack API allows only one file per upload request. Upload requests are made viathe collection.create, collection.setLogo,collection.setBackgroundImage and flipbook.add.
40Bad request
  • You made a POST request for an API call that is not uploading files.
  • You made a GET request for an API call that uploads files.
  • Your request is incorrectly formatted or the URL is invalid.
41Invalid credentialsThe API key provided in the request is invalid.
42Invalid actionThe API method you specified in the request is incorrect. Please see the APIReference for the list of possible methods.
44Invalid signatureThe signature you provided is incorrect - it does not match the request.
45Invalid file formatThe file you are trying to upload has an incorrect file type. For more informationplease see the limitations imposed by the API.

Example

HTML form example

<form method="post" action="https://upload.flipsnack.com/v1/" enctype="multipart/form-data">
    <input type="hidden" name="action" value="collection.create">
    <input type="hidden" name="apiKey" value="LK12NS-0-IOBW3S89VVJH12Z">
    <input type="hidden" name="format" value="json">
    <input type="hidden" name="collectionStatus" value="public">
    <input type="file" name="file">
    <input type="text" name="title">
    <textarea name="description"></textarea>
    <button type="submit">Submit</button>
</form>

Curl example

curl -F "action=collection.create"\
     -F "apiKey=LK12NS-0-IOBW3S89VVJH12Z"\
     -F "format=json"\
     -F "collectionStatus=public"\
     -F "file=@\"/mydocs/document.pdf\";filename=\"document.pdf\""\
     -F "title=Lorem ipsum"\
     -F "description=Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."\
     -F "signature=2298a6456c1dd2d12b895ce4688ffe31"\
     https://upload.flipsnack.com/v1/

Responses

<?xml version="1.0" encoding="utf-8"?>
<response>
    <code>20</code>
    <status>OK</status>
    <data>
        <collectionHash>d3m0h45h</collectionHash>
        <collectionTitle>Lorem ipsum</collectionTitle>
        <collectionStatus>published</collectionStatus>
        <coverImage>https://files.flipsnack.net/collections/items/7c5e600d4459fe4e04d23ae5ei188777/covers/page_1/medium</coverImage>
        <directLink>https://www.flipsnack.com/user/lorem-ipsum.html</directLink>
        <createdDate>2015-06-09 01:43:05</createdDate>
        <publishDate>2015-06-09 01:43:07</publishDate>
        <collectionPageCount>2</collectionPageCount>
        <collectionItems>
            <collectionItem>
                <flipbookHash>7c5e600d4459fe4e04d23ae5ei188777</flipbookHash>
                <flipbookPageCount>2</flipbookPageCount>
                <flipbookTitle>Lorem ipsum</flipbookTitle>
                <flipbookDescription>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</flipbookDescription>
                <extension>pdf</extension>
                <convertStatus>COMPLETE</convertStatus>
            </collectionItem>
        </collectionItems>
        <settings>
            <collectionWidth>640</collectionWidth>
            <collectionHeight>385</collectionHeight>
            <enableFullScreen>true</enableFullScreen>
        </settings>
    </data>
</response>
{
    "code": 20,
    "status": "OK",
    "data": {
        "collectionHash": "d3m0h45h",
        "collectionTitle": "Lorem ipsum",
        "collectionStatus": "published",
        "coverImage": "https://files.flipsnack.net/collections/items/7c5e600d4459fe4e04d23ae5ei188777/covers/page_1/medium",
        "directLink": "https://www.flipsnack.com/user/lorem-ipsum.html",
        "createdDate": "2015-06-09 01:43:05",
        "publishDate": "2015-06-09 01:43:07",
        "collectionPageCount": 2,
        "collectionItems": [
            {
                "flipbookHash": "7c5e600d4459fe4e04d23ae5ei188777",
                "flipbookPageCount": "2",
                "flipbookTitle": "Lorem ipsum",
                "flipbookDescription": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                "extension": "pdf",
                "convertStatus": "COMPLETE"
            }
        ],
        "settings": {
            "collectionWidth": "640",
            "collectionHeight": "385",
            "enableFullScreen": "true"
        }
    }
}
callbackFunctionName({data});
// callbackFunctionName is the function name specified by the callback parameter, in the request
// the {data} is the actual JSON response