# collection.downloadHTML

**Note:**&#x20;

* requests must be made to **<https://api.flipsnack.com/v1>**
* this method is not available while the flipbook is in the processing state

## Request parameters <a href="#request_params" id="request_params"></a>

| Name                      | Type   | Description                                                                                                                                                                                                                                                                                                                                                                       |
| ------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| apiKey (required)         | string | The API key provided for your user. If it is not specified, the request will return the error code "30 - Missing mandatory parameter". If the key is incorrect the request returns the error code "41 - Invalid credentials".                                                                                                                                                     |
| signature (required)      | string | The signature must be calculated by you and added to the request. See [How to sign a request](https://developers.flipsnack.com/how-to-sign-a-request) for more information. If the parameter is missing the request will return the error code "30 - Missing mandatory parameter". If the signature is incorrect the request will return the error code "44 - Invalid signature". |
| action (required)         | string | The API method that should be called. In this case the value should be *collection.getStats*. If it is not specified, the request will return the error code "30 - Missing mandatory parameter".                                                                                                                                                                                  |
| collectionHash (required) | string | The hash of the flipbook for which you want the download package. If you do not specify a flipbook hash, then the request will return the error code "30 - Missing mandatory parameter".                                                                                                                                                                                          |

## Response parameters <a href="#response_params" id="response_params"></a>

| Name        | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| status      | string | <p>The status of the download package. Possible values are</p><ul><li><em>PROCESSING</em>: the request is being processed;</li><li><em>COMPLETE</em>: the package has been successfully generated;</li><li><em>FAILED</em>: the package could not be generated</li></ul><p> Generating a download package is a time consuming process. You can check the status at a few second intervals by using the <strong>collection.downloadHTML</strong> method. The requests to <strong>collection.downloadHTML</strong> should be made until the download package is generated. If the download package is already generated when the first request to <strong>collection.downloadHTML</strong> is made, the COMPLETE status will be returned.</p> |
| resourceUrl | string | The url for the download package. The url will expire after one minute due to security reasons.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

## Error codes <a href="#error_codes" id="error_codes"></a>

For complete list of error codes and messages go to [api-status-codes](https://developers.flipsnack.com/api-status-codes "mention") section.

## Examples <a href="#example" id="example"></a>

### Request

{% tabs %}
{% tab title="cURL" %}

```bash
# GET   
curl -X GET \
     -G \
     https://api.flipsnack.com/v1/ \
     -d action=collection.downloadHTML \
     -d apiKey=<YOUR-API-KEY> \
     -d collectionHash=d3m0h45h \
     -d signature=<YOUR-REQUEST-SIGNATURE>
```

{% endtab %}

{% tab title="HTML" %}

```html
<form method="get" action="https://api.flipsnack.com/v1/">
    <input type="hidden" name="action" value="collection.downloadHTML">
    <input type="hidden" name="apiKey" value="<YOUR-API-KEY>">
    <input type="hidden" name="collectionHash">
    <input type="hidden" name="signature" value="<YOUR-REQUEST-SIGNATURE>">
    <button type="submit">Submit</button>
</form>
```

{% endtab %}
{% endtabs %}

### Response

{% tabs %}
{% tab title="JSON" %}

```json
{
    "code": 20,
    "status": "OK",
    "data": {
        "status": "COMPLETE",
        "resourceUrl": "https://cdn.flipsnack.com/sample-path/to-html.zip",
    }
}
```

{% endtab %}
{% endtabs %}
