# collection.getEmbed

**Note:** Requests must be made to **<https://api.flipsnack.com/v1>**.

## 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](/how-to-sign-a-request.md) 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.getEmbed*. 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 embed code. If you do not specify a flipbook hash, then the request will return the error code "30 - Missing mandatory parameter".                                                                                                                                                                   |
| https (DEPRECATED)        | boolean | <p>If set to <em>true</em>, the embed code will load the player from our HTTPS location.</p><p>Default: <em>true</em>.</p>                                                                                                                                                                                                                           |
| responsive                | boolean | <p>If set to <em>true</em>, the Flipsnack embed will have the width and height set to 100% and it will take the entire size of the container.</p><p>Default: <em>false</em>.</p>                                                                                                                                                                     |
| startPage                 | number  | <p>The page number where the flipbook will open automatically.</p><p>Default: <em>1</em>.</p>                                                                                                                                                                                                                                                        |
| startBook (DEPRECATED)    | number  | <p>The player will automatically open the specified flipbook from the flipbook.</p><p>Default: <em>1</em>.</p>                                                                                                                                                                                                                                       |
| width                     | number  | The width of the embed. By default it will have the size specified by the flipbook width parameter. The flipbook width can be set when creating a new flipbook or when editing/updating an existing flipbook.                                                                                                                                        |
| height                    | number  | The height of the embed. By default it will have the size specified by the flipbook height parameter. The flipbook height can be set when creating a new flipbook or when editing/updating an existing flipbook.                                                                                                                                     |

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

| Name      | Type   | Description                                                            |
| --------- | ------ | ---------------------------------------------------------------------- |
| embedCode | string | The embed code as requested with the API call: iframe or object embed. |

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

For complete list of error codes and messages go to [API status codes](/api-status-codes.md) 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.getEmbed \
     -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.getEmbed">
    <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" %}

```javascript
{
    "code": 20,
    "status": "OK",
    "data": {
        "embedCode": "<iframe src=\"\https://player.flipsnack.com/?hash=sample-hash"></iframe>"
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.flipsnack.com/api-reference/api-method-collection.getembed.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
