# Ambro API

<figure><img src="https://3626600155-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkDmbQNGCJMeCebyS3rIE%2Fuploads%2FENH87G3FsBeC9YamJFgi%2Fambroo.png?alt=media&#x26;token=a8df112f-ae3e-4997-9210-b37de67352c6" alt="" width="375"><figcaption></figcaption></figure>

You want to use ambro solutions to enable the buying and selling of crypto by thematic to your customers. Here is a document explaining how to use our API to allow you to manage your users, their KYC, their purchase and sale of crypto.

For more information on ambro do not hesitate to discover our website [<mark style="color:blue;">https://ambro-crypto.fr</mark>](#user-content-fn-1)[^1]

If you have any questions, do not hesitate to contact us at <contact@ambro-crypto.fr>

{% hint style="info" %}
You can access a postman here&#x20;

<https://www.postman.com/speeding-flare-522557/workspace/ambro-partners>
{% endhint %}

## URL(s)

| Environment | URL                    |
| ----------- | ---------------------- |
| Dev         | apidev.ambro-crypto.fr |
| Prod        | api.ambro-crypto.fr    |

## Authentification

By partnering with Ambro you received an **APP\_ID**, **API\_KEY** and an **API\_SECRET**.

{% hint style="danger" %}
If you think your API\_SECRET or API\_KEY is corrupt contact Ambro as soon as possible to deactivate and re-generate new keys
{% endhint %}

You must send each request the signature of this **APP\_ID**, **API\_KEY** and **API\_SECRET** in the header as the **X-Amb-Access-Sig** key as well as the timestamp in the key **X-Amb-Access-Ts**

<details>

<summary>Sample code for creating a JS client-side signature</summary>

```
const crypto = require('crypto');

function generateSignatureHeader(appId, apiKey, apiSecret) {
  const timestamp = Date.now().toString();
  const signature = crypto.createHmac('sha256', apiSecret)
                        .update(apiKey + timestamp)
                        .digest('hex');
  
  return {
    "X-Amb-Access-Sig" : signature,
    "X-Amb-Access-Ts" : timestamp,
    "X-Amb-App-Id": appId
  }
}

const apiKey = 'AMBRO_API_KEY';
const apiSecret = 'AMBRO_API_SECRET';
const appId = 'AMBRO_APP_ID';

const signedRequestHeader = generateSignatureHeader(appId, apiKey, apiSecret);
console.log('Header :', signedRequestHeader);
```

</details>

<details>

<summary>Sample code for creating a PHP client-side signature</summary>

```
<?php

function generateSignatureHeader($appId, $apiKey, $apiSecret) {
    $timestamp = time();
    $signature = hash_hmac('sha256', $apiKey . $timestamp, $apiSecret);

    return [
        "X-Amb-Access-Sig" => $signature,
        "X-Amb-Access-Ts" => $timestamp,
        "X-Amb-App-Id" => $appId
    ];
}

$apiKey = 'AMBRO_API_KEY';
$apiSecret = 'AMBRO_API_SECRET';
$appId = 'AMBRO_APP_ID';

$signedRequestHeader = generateSignatureHeader($appId, $apiKey, $apiSecret);

print_r($signedRequestHeader);

?>
```

</details>

<details>

<summary>Sample code for creating a Python client-side signature</summary>

```
import time
import hmac
import hashlib

def generate_signature_header(app_id, api_key, api_secret):
    timestamp = int(time.time())
    signature = hmac.new(bytes(api_secret, 'utf-8'), msg=bytes(api_key + str(timestamp), 'utf-8'), digestmod=hashlib.sha256).hexdigest()

    return {
        "X-Amb-Access-Sig" : signature,
        "X-Amb-Access-Ts" : timestamp,
        "X-Amb-App-Id": app_id
    }

api_key = 'AMBRO_API_KEY'
api_secret = 'AMBRO_API_SECRET'
app_id = 'AMBRO_APP_ID'

signed_request_header = generate_signature_header(app_id, api_key, api_secret)

print(signed_request_header)
```

</details>

<details>

<summary>Sample code for creating a Ruby client-side signature</summary>

```
require 'openssl'
require 'time'

def generate_signature_header(app_id, api_key, api_secret)
  timestamp = Time.now.to_i
  signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), api_secret, api_key + timestamp.to_s)

  {
    "X-Amb-Access-Sig" => signature,
    "X-Amb-Access-Ts" => timestamp,
    "X-Amb-App-Id" => app_id
  }
end

api_key = 'AMBRO_API_KEY'
api_secret = 'AMBRO_API_SECRET'
app_id = 'AMBRO_APP_ID'

signed_request_header = generate_signature_header(app_id, api_key, api_secret)

puts signed_request_header
```

</details>

{% hint style="danger" %}
If you think your API\_SECRET or API\_KEY is corrupt contact Ambro as soon as possible to deactivate and re-generate new keys
{% endhint %}

[^1]:
