Non-Permeable Membrane
    TypeScript icon, indicating that this package has built-in type declarations

    20.10.4 • Public • Published SDK for node.js and browser javascript

    MetaApi is a powerful, fast, cost-efficient, easy to use and standards-driven cloud forex trading API for MetaTrader 4 and MetaTrader 5 platform designed for traders, investors and forex application developers to boost forex application development process. MetaApi can be used with any broker and does not require you to be a brokerage.

    CopyFactory is a simple yet powerful copy-trading API which is a part of MetaApi. See below for CopyFactory readme section.

    MetaApi is a paid service, but API access to one MetaTrader account is free of charge.

    The MetaApi pricing was developed with the intent to make your charges less or equal to what you would have to pay for hosting your own infrastructure. This is possible because over time we managed to heavily optimize our MetaTrader infrastructure. And with MetaApi you can save significantly on application development and maintenance costs and time thanks to high-quality API, open-source SDKs and convenience of a cloud service.

    Official REST and websocket API documentation:

    Please note that this SDK provides an abstraction over REST and websocket API to simplify your application logic.

    For more information about SDK APIs please check esdoc documentation in source codes located inside lib folder of this npm package.

    Working code examples

    Please check this short video to see how you can download samples via our web application.

    You can also find code examples at examples folder of our github repo or in the examples folder of the npm package.

    We have composed a short guide explaining how to use the example code


    npm install --save

    Installing SDK in browser SPA applications

    npm install --save

    Installing SDK in browser HTML applications

    <script src=""></script>
        const token = '...';
        const api = new MetaApi(token);

    Connecting to MetaApi

    Please use one of these ways:

    1. web UI to obtain your API token.
    2. An account access token which grants access to a single account. See section below on instructions on how to retrieve account access token.

    Supply token to the MetaApi class constructor.

    import MetaApi from '';
    const token = '...';
    const api = new MetaApi(token);

    Retrieving account access token

    Account access token grants access to a single account. You can retrieve account access token via API:

    let accountId = '...';
    let account = await api.metatraderAccountApi.getAccount(accountId);
    let accountAccessToken = account.accessToken;

    Alternatively, you can retrieve account access token via web UI on page (see this video).

    Table of contents

    1. MT account management

    2. MetaApi RPC API

    3. MetaApi real-time streaming API (websocket API)

    4. Risk management API

    5. CopyFactory copy trading API

    6. MetaStats trading statistics API

    7. MetaApi MT manager API

    8. Tracking latencies

    9. Enable log4js logging

    10. Rate limits & quotas


    npm i

    DownloadsWeekly Downloads






    Unpacked Size

    13.3 MB

    Total Files


    Last publish


    • agiliumtrade