# How to sign a request

&#x20;This signature is calculated using an API Secret Key which we provide along with the API key. The signature proves that you are the owner of the account making the requests.

**Note:** These keys are secret and they should not be disclosed or shared with anyone else. Flipsnack does know your API key and secret key and no one who legitimately represents Flipsnack will ask for these keys.

Signing a Flipsnack API request is a easy:

1. Sort the request parameters alphabetically, but exclude the signature and file parameter (e.g `action=3, collectionHash=1, apiKey=2 results to action=3, apiKey=2, collectionHash=1`).
2. Create a string by concatenating the API secret key and request key-value pairs which were ordered alphabetically (e.g. `secretKeyaction3apiKey2collectionHash1`).
3. The signature is the MD5 hash of the previous string.
4. Include the signature parameter to the API request (e.g. `signature=26e781d3d1751d82ec284acf4a019def`).

If the request is incorrectly signed the API will return with the error code "44 - Invalid signature".

**Example:**\
&#x20;We need to get information about the collection identified with the hash `fxh4k89`. The API key is `45FD-267-7SG7832` and the API secret key is `123ABCDE-456-7890-FGH`. In this case the request parameters are:

* `action=collection.getCollection`
* `collectionHash=fxh4k89`
* `apiKey=45FD-267-7SG7832`

Next, we concatenate the secret key to the previous list:

```
123ABCDE-456-7890-FGHactioncollection.getCollectionapiKey45FD-267-7SG7832collectionHashfxh4k89
```

The MD5 hash generated for the previous string is 26e781d3d1751d82ec284acf4a019def. This hash is finally assigned to the **signature** parameter. The final request would look like this:

```bash
https://api.flipsnack.com/v1/?action=collection.getCollection&collectionHash=fxh4k89&apiKey=45FD-267-7SG7832&signature=26e781d3d1751d82ec284acf4a019def
```

**Note:** The API key, secret key and flipbook hash specified above are all fictional and are used for example purposes only.


---

# 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/how-to-sign-a-request.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.
