***

title: Working with the Voximplant's API
subtitle: Call the Voximplant Management API directly from a VoxEngine scenario
---------------------

For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

VoxEngine allows developers to make Voximplant's [Management API](/platform/management-api/basics) requests from within the scenario. For example, you can send an SMS message, or request a call history. Normally you can do one of these actions by calling one of [Management API methods](https://voximplant.com/docs/references/httpapi).

## How to use

To make Management API requests from a scenario, first prepare your account:

1. Generate a private API key in the [Voximplant control panel](https://manage.voximplant.com/settings/service_accounts). See [Service accounts](/platform/management-api/authorization#service-accounts) for more information.
2. Bind the API key to the routing rule by calling the [SetRuleInfo](https://voximplant.com/docs/references/httpapi/rules#setruleinfo) Management API method and specifying it in the `bind_key_id` parameter.

In the scenario, first require the `VoximplantApi` module:

```javascript
require(Modules.VoximplantAPI);
```

And create the `Voximplant.Client` instance:

```javascript
const client = new VoximplantApi.Client();
```

Now you are ready to make a request from your scenario.

You can find the list of available requests in the [API reference](https://voximplant.com/docs/references/voxengine/voximplantapi).

## Request examples

Here you can find examples of how to perform management API requests from a scenario.

This example sends an SMS message containing a "Test message" text from the 447443332211 phone number to the 447443332212 phone number:

```javascript title="Send an SMS"
client.SMS.sendSmsMessage({
  source: '447443332211',
  destination: '447443332212',
  smsBody: 'Test message'
})
  .then((ev) => Logger.write(ev))
  .catch((err) => Logger.write(err));

```

This example gets the first call session history record from the 2012-01-01 00:00:00 UTC to the 2014-01-01 00:00:00 UTC:

```javascript title="Get a call history item"
client.History.getCallHistory({
  fromDate: new Date('2012-01-01 00:00:00 GMT'),
  toDate: new Date('2014-01-01 00:00:00 GMT'),
  count: '1',
  timezone: 'Etc/GMT'
})
  .then((ev) => Logger.write(ev))
  .catch((err) => Logger.write(err));

```