{"id":48475,"library":"metaapi.cloud-sdk","title":"MetaApi Cloud SDK","description":"Official JavaScript SDK for MetaApi.cloud, a cloud-based forex trading API supporting MetaTrader 4 (MT4) and MetaTrader 5 (MT5). Current stable version is 29.3.3, with active releases. Key differentiators: provides both REST and WebSocket APIs, includes CopyFactory copy trading support, works in Node.js and browser environments, and ships TypeScript types. It abstracts away MetaTrader infrastructure complexity, offering a paid service with pricing comparable to self-hosting.","status":"active","version":"29.3.3","language":"javascript","source_language":"en","source_url":"https://github.com/metaapi/metaapi-javascript-sdk","tags":["javascript","metaapi.cloud","MetaTrader","MetaTrader 5","MetaTrader 4","MetaTrader5","MetaTrader4","MT","MT4","typescript"],"install":[{"cmd":"npm install metaapi.cloud-sdk","lang":"bash","label":"npm"},{"cmd":"yarn add metaapi.cloud-sdk","lang":"bash","label":"yarn"},{"cmd":"pnpm add metaapi.cloud-sdk","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"MetaApi is the default export from the main package. Named import will not work.","wrong":"import { MetaApi } from 'metaapi.cloud-sdk';","symbol":"MetaApi","correct":"import MetaApi from 'metaapi.cloud-sdk';"},{"note":"For Node.js native ESM (type: module), use the esm-node subpath import.","wrong":"import MetaApi from 'metaapi.cloud-sdk'; // only for CommonJS","symbol":"MetaApi (from ESM subpath)","correct":"import MetaApi from 'metaapi.cloud-sdk/esm-node';"},{"note":"When using the UMD bundle (e.g. via unpkg), the exported global is MetaApi and the constructor is MetaApi.default.","wrong":"const api = new MetaApi(token); // wrong when loaded via script tag","symbol":"MetaApi (browser UMD)","correct":"const api = new MetaApi.default(token);"}],"quickstart":{"code":"import MetaApi from 'metaapi.cloud-sdk';\n\nconst token = process.env.METAAPI_TOKEN ?? 'your-api-token';\nconst api = new MetaApi(token);\n\nasync function main() {\n  const accounts = await api.metatraderAccountApi.getAccounts();\n  console.log('Accounts:', accounts);\n}\n\nmain().catch(console.error);","lang":"typescript","description":"Initializes MetaApi client with API token and retrieves all MetaTrader accounts associated with the token."},"warnings":[{"fix":"Use 'import MetaApi from \"metaapi.cloud-sdk/esm-node\";' in ESM Node.js projects.","message":"The main package import is CommonJS. For ESM projects, use subpath import 'metaapi.cloud-sdk/esm-node'.","severity":"gotcha","affected_versions":"*"},{"fix":"Use 'new MetaApi.default(token)' instead of 'new MetaApi(token)'.","message":"When using UMD bundle in browser via script tag, the constructor is MetaApi.default, not MetaApi.","severity":"gotcha","affected_versions":"*"},{"fix":"Prefer ES module imports: import MetaApi from 'metaapi.cloud-sdk/esm-node'.","message":"Older SDK versions used require() by default; as of v29+ the primary export is still CommonJS but ES modules are supported via subpath.","severity":"deprecated","affected_versions":">=29.0.0"},{"fix":"Ensure your account has sufficient quota and API key is correct.","message":"The SDK is a paid service; API tokens require a valid subscription. Using free-tier tokens may result in '401 Unauthorized' or quota errors.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'29.3.3':28 '4':18,78 '5':22,76 'abstract':56 'activ':30 'api':15,39 'away':57 'base':12 'browser':49 'cloud':2,11 'cloud-bas':10 'compar':67 'complex':60 'copi':42 'copyfactori':41 'current':24 'differenti':33 'environ':50 'forex':13 'host':71 'includ':40 'infrastructur':59 'javascript':5,72 'key':32 'metaapi':1 'metaapi.cloud':8,73 'metatrad':17,21,58,74,75,77 'metatrader4':80 'metatrader5':79 'mt':81 'mt4':19,82 'mt5':23 'node.js':47 'offer':61 'offici':4 'paid':63 'price':66 'provid':34 'releas':31 'rest':36 'sdk':3,6 'self':70 'self-host':69 'servic':64 'ship':52 'stabl':25 'support':16,44 'trade':14,43 'type':54 'typescript':53,83 'version':26 'websocket':38 'work':45","created_at":"2026-06-07T16:56:51.005156+00:00","updated_at":"2026-06-07T16:56:51.005156+00:00","problems":[{"fix":"Run 'npm install --save metaapi.cloud-sdk' and ensure import statement is correct: 'import MetaApi from \"metaapi.cloud-sdk\";'","cause":"Package not installed or import path is wrong.","error":"Cannot find module 'metaapi.cloud-sdk'"},{"fix":"Use the correct import path: 'import MetaApi from \"metaapi.cloud-sdk/esm-node\";'","cause":"CommonJS require() used on an ES module subpath.","error":"Must use import to load ES Module: metaapi.cloud-sdk"},{"fix":"Use 'new MetaApi.default(token)' when using the UMD bundle via script tag.","cause":"Using UMD bundle but calling new MetaApi.default() incorrectly (missing .default).","error":"MetaApi.default is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/metaapi/metaapi-javascript-sdk#readme","github":"https://github.com/metaapi/metaapi-javascript-sdk","docs":null,"changelog":null,"pypi":null,"npm":"metaapi.cloud-sdk","openapi_spec":null,"status_page":null,"smithery":null,"categories":["finance"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}