{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"522abf11-5388-4d30-844e-2f64b14463be","name":"api.any.money ENG","description":"### Implementation\n\nThe **Any.Money** system **API** is based on the [JSON-RPC](https://www.jsonrpc.org/specification) \nremote procedure call protocol with several limitations:  \n\n- Notifications are not processed;  \n- Batch requests/responses are not supported;  \n- All arguments' values ​​in the request are transmitted **only** in string (str) or boolean (bool) formats;\n- The **params** field supports arguments transmission in the JSON object format, not as an array;  \n- If  `null`  is transmitted for the argument - the default value will be used. If the default is not defined, the **Any.Money** system will return the [corresponding exception](https://docs.any.money/en/exc/).\n\n### Request organization\n\nThe API requests are sent to **`https://api.any.money/`** endpoint.  \n*The request must be signed. Merchant's data is transmitted in the headers.*\n\n#### HEADERS\n\n- **x-merchant**    - merchant's identifier;  \n- **x-signature**   - hash signature of the request;\n- **x-utc-now-ms**  - request creation time, in milliseconds (utc timestamp).\n\n#### PARAMS\n\n- **method** - the name of the request method;  \n- **params** - method parameters, formed of `key: value`;\n- **jsonrpc** - specification version (always equals to \"2.0\");  \n- **id** - request identifier.  \n\n\n#### SIGNATURE\n\nTo authenticate a request, you need to sign it and transfer the signature in the **x-signature** header. The signature is generated by the HEX algorithm (HMAC-SHA512 (**data, api_key**)), where: \n\n- **data** - a string, composed from the **params** object values.   \nTo form a string it is necessary to:\n    - sort **params** keys by alphabet;\n    - compose a string of their values, excepts for the nested objects and `null`;\n    - add the **x-utc-now-ms** header value to the end of the received line;\n    - cast a composed string to lowercase;\n- **api_key** - merchant's key for interaction via API.  \n\n\n##### API REQUEST EXAMPLE\n\n``` python\nimport hashlib\nimport hmac\nimport requests\nimport time\n\ndef create_sign(key: str, data: dict, utc_now: str) -> str:\n    if data: sorted_data = sorted(data.items())\n    else: sorted_data = {}\n\n    msg = ''.join(\n        str(v) for k, v in sorted_data\n        if not isinstance(v, (dict, list, type(None)))\n    ) + str(utc_now)\n    msg = msg.lower()\n\n    return hmac.new(key.encode(), msg.encode(), hashlib.sha512).hexdigest()\n\ndata = {\n    \"method\": \"merchant.balance\",\n    \"params\": { \"curr\": \"BTC\" },\n    \"jsonrpc\": \"2.0\",\n    \"id\": \"1\"\n}\n\nMERCHANT_ID = 'your merchant here'\nAPI_KEY = 'your merchant api key here'\nTIME_SENT = str(int(time.time() * 1000))\nURL = 'https://api.any.money/'\n\nheaders = {\n    \"x-merchant\": MERCHANT_ID,\n    \"x-signature\": create_sign(API_KEY, data['params'], TIME_SENT),\n    \"x-utc-now-ms\": TIME_SENT\n}\n\nresponse = requests.post(url=URL, json=data, headers=headers)\n```\n\n### System response options\n\nIn the case of correct request, the method execution result will be returned by the `result` key as a JSON object.\n\n##### Method response\n\n```json  \n{\n  \"result\": {\"UAH\": \"0\"}, \n  \"id\": \"1\", \n  \"jsonrpc\": \"2.0\",\n}\n```\n\n<dl>\n    <dt><strong>result </strong></dt> <dd> method execution result </dd>\n    <dt><strong>id     </strong></dt> <dd> request ID of received response</dd>\n    <dt><strong>jsonrpc</strong></dt> <dd>\nspecification version (always equal to \"2.0\")</dd>\n</dl>\n\nOtherwise, the code, message and the data of the occurred `exception` will be returned by the `error` key :\n\n##### Exception\n\n```json\n{\n  \"error\": {\n    \"code\": -32004, \n    \"message\": \"EParamInvalid\", \n    \"data\": {\n      \"type\": \"EParamType\", \n      \"args\": [\"balance() missing 1 required positional argument: 'curr'\"], \n      \"message\": \"balance() missing 1 required positional argument: 'curr'\",\n    },\n  }, \n  \"id\": \"2\", \n  \"jsonrpc\": \"2.0\",\n}\n```\n#### The data, returned in headers\n<dl>\n    <dt><strong>x-utc-now-ms</strong></dt> <dd> response time, in milliseconds (utc timestamp)</dd>\n    <dt><strong>x-signature </strong></dt> <dd>hash signature of the response</dd>\n</dl>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":false,"owner":"10991798","team":269239,"collectionId":"522abf11-5388-4d30-844e-2f64b14463be","publishedId":"SzfCTRMH","public":true,"publicUrl":"https://documenter-api.postman.tech/view/10991798/SzfCTRMH","privateUrl":"https://go.postman.co/documentation/10991798-522abf11-5388-4d30-844e-2f64b14463be","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"documentationLayout":"classic-double-column","customisation":null,"version":"8.11.6","publishDate":"2020-04-27T08:19:10.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/4623c8d00ac666cef447d261be726701480362b5f238f4f9ce8b49153a152d63","favicon":""},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://documenter.gw.postman.com/view/metadata/SzfCTRMH"}