{"_id":"5bc634877db17000250c43e0","project":"550f74bb6fc8130d0038aad3","version":{"_id":"550f75de61d9d30d00af9e01","__v":17,"project":"550f74bb6fc8130d0038aad3","forked_from":"550f74bb6fc8130d0038aad6","createdAt":"2015-03-23T02:09:34.221Z","releaseDate":"2015-03-23T02:09:34.221Z","categories":["550f75de61d9d30d00af9e02","551027e38579861900a86698","551029e08579861900a8669a","551029e7498062190006328a","5bc633a722d682005c9ad9e4","5bc633b08c4b0b000d6a7eaa","5bc633b48f3ff600626e3e18","5bc63538e5a6ba000d22ee6d","5bc63587a18a6b000decd295","5bc635c0937fcb0056223d9c","5bc6360f42f41800319aeaa6","5be5d13ff1d319002baca9ce","5be5d2287cd14d00291fbfdb","5be8b3b09f7cb70023c56a39","5be8b3cbb910100044e20206","5c1d769a4f6aed001fe527f0","5c402942010f0d001496dded"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"3.0.0","version":"3"},"category":{"_id":"5bc633a722d682005c9ad9e4","project":"550f74bb6fc8130d0038aad3","version":"550f75de61d9d30d00af9e01","__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2018-10-16T18:53:27.204Z","from_sync":false,"order":6,"slug":"accounts","title":"Accounts"},"user":"56ddd4424acab82000ae9d30","__v":24,"parentDoc":null,"updates":["5c68cb3266c99d00456c00cd"],"next":{"pages":[],"description":""},"createdAt":"2018-10-16T18:57:11.869Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"method":"post","examples":{"codes":[{"language":"python","code":"'''\nThis is a Python 3.7 Module that creates a Wyre Account\nusing secret key authentication.\n\nYou can only use this module for creating INDIVIDUAL accounts\nif you already have a business account set up.\n\nIf you do not have a business account with a secretKey/ApiKey, \ngo through the signup process for a test account here: https://www.testwyre.com/\n'''\n\n# You can file account_validation_helpers file here: https://github.com/nickolasteixeira/Wyre_API/blob/master/account_validation_helpers.py\n# This file helps for validating entries from users.\n# Currently this process is a command line interface program\nimport account_validation_helpers as avh\nimport hashlib\nimport hmac\nimport json\nimport os\nimport requests\nimport time\nimport urllib.parse\n\n\nclass WyreApi:\n    ACCOUNT_ID = os.getenv(\"ACCOUNT_ID\")\n    API_KEY = os.getenv(\"WYRE_APIKEY\")\n    SEC_KEY = os.getenv(\"WYRE_TOKEN\")\n    API_VER3 = \"/v3\"\n    API_ACCOUNT_PATH = \"/accounts\"\n    API_URL = \"https://api.testwyre.com\"\n    # These are the object attributes that you'll want to fill in before sending the request to Wyre's API. Feel free to add more if you want a thorough onboarding process for your users\n    # Reference for more fields: https://docs.sendwyre.com/docs/account-resource#section-field-ids\n    OBJ_ATTRS = ('type', 'country', 'individualLegalName',\n                 'individualEmail', 'individualCellphoneNumber')\n    # 'individualResidenceAddress', 'individualDateOfBirth', 'individualSsn')\n\n    '''\n        This method initializes all the OBJ_ATTRS above to this class object.\n        It takes in a createObj object if you want to pass one in, if not,\n        you'll go through the fillInfo method process below.\n    '''\n\n    def __init__(self, createObj=None):\n        if not createObj:\n            createObj = WyreApi.OBJ_ATTRS\n\n        self.fillInfo(createObj)\n\n\n\n\n\n    '''\n        This method loops through each OBJ_ATTR tuple above in the class \n        attributes and set's an the obj attributes to the newly created WyreAPI \n        object. It also goes through and validates each entry from the user.\n        You can find the avh validateEntry and printAccountSetup methods\n        here: https://github.com/nickolasteixeira/Wyre_API/blob/master/account_validation_helpers.py\n    '''\n\n    def fillInfo(self, createObj):\n        avh.printAccountSetup()\n        # loop through all the obj_attrs and initialize them to the obj\n\n        for attr in createObj:\n            setattr(self, attr, self.validateEntry(attr))\n\n        avh.printCreateAccount()\n\n\n\n\n\n    '''\n        This method validates all entries from the users. It first finds the \n        validation function based on the attribute being passed and then calls \n        that function to validate the user's entry\n        You can find the switchCase function here: https://github.com/nickolasteixeira/Wyre_API/blob/master/account_validation_helpers.py \n    '''\n\n    def validateEntry(self, attr):\n        # finds the function to use based on the object attr\n        # from the account_validation_helpers.py file\n        func = avh.switchCase(attr)\n        # validates the text input with the function assigned to the\n        # obj attribute from OBJ_ATTRS (Class attribute)\n        text = func(self, attr)\n        # returns the text to then get set to the specific attribute of the obj\n        return text\n\n\n\n\n\n    '''\n        This method calculates the auth signature hash required for secret key \n        authentication\n    '''\n\n    def calc_auth_sig_hash(self, url_body):\n        # calculates a signature per Wyre API:\n        # https://docs.sendwyre.com/docs/authentication#secret-key-signature-auth\n        message, secret = bytes(\n            url_body, 'utf-8'), bytes(WyreApi.SEC_KEY, 'utf-8')\n        newhash = hmac.new(secret, message, hashlib.sha256)\n        return newhash.hexdigest()\n\n\n\n\n\n\n    '''\n        This method calculates a timesteamp required for the secret key \n        authentication\n    '''\n\n    def calcTimeStamp(self):\n        # creates a timestamp to the millisecond\n        return str(round(time.time() * 1000))\n\n\n\n\n\n    '''\n        This method creates an account and sends a request to Wyre's API\n        API Endpoint:https://api.sendwyre.com/v3/accounts\n    '''\n\n    def createAccount(self):\n        # additional timesteamp for the URL per Wyre Specs on the documentation\n        # https://docs.sendwyre.com/docs/authentication#secret-key-signature-auth\n        params = {\n            \"timestamp\": self.calcTimeStamp()\n        }\n        # Data for the post request to create the account\n        # These are fields required to create an \"INDIVIDUAL\" account\n        # https://docs.sendwyre.com/docs/account-resource#section-field-ids\n        post_data = {\n            \"type\": self.type,\n            \"country\": self.country,\n            \"subaccount\": True,\n            \"profileFields\": [\n                {\"fieldId\": \"individualLegalName\",\n                            \"value\": self.individualLegalName},\n                {\"fieldId\": \"individualEmail\",\n                            \"value\": self.individualEmail},\n                {\"fieldId\": \"individualCellphoneNumber\",\n                            \"value\": self.individualCellphoneNumber},\n                # {\"fieldId\": \"individualResidenceAddress\", \"value\": self.individualResidenceAddress},\n                # {\"fieldId\": \"individualDateOfBirth\", \"value\": self.individualDateOfBirth},\n                # {\"fieldId\": \"individualSsn\", \"value\": self.individualSsn}\n            ]}\n        # concatinating the URL to then create a Signature hash\n        url = WyreApi.API_URL + WyreApi.API_VER3 + WyreApi.API_ACCOUNT_PATH + \\\n            \"?\" + urllib.parse.urlencode(params, encoding='utf-8')\n        # headers needed to authorize the post request\n        # https://docs.sendwyre.com/docs/authentication#secret-key-signature-auth\n        headers = {\n            'X-API-Key': WyreApi.API_KEY,\n            'X-API-Signature': self.calc_auth_sig_hash(url + json.dumps(post_data))\n        }\n        # sending a request with the post data, timestamp and signed headers\n        response = requests.post(url, headers=headers, json=post_data)\n        if response.status_code == 200:\n            # print success message\n            return json.loads(response.text)\n        else:\n            print(response.text)\n\n\n\n\nif __name__ == \"__main__\":\n    # =========== Creating an account =========== #\n    account = WyreApi()\n    # You can either pass in an iterable with the\n    # required obj attributes. Ex below:\n    # createObj = ('type', 'country', 'individualLegalName', 'individualEmail')\n    # account = WyreApi(createObj)\n\n    # Or you can create an account without passing in an argument\n    new_account = account.createAccount()\n    if new_account:\n    \tprint(new_account)"},{"language":"curl","code":"################### Generate a secrey key ###################\n# First generate your own secret key/Api, if you do not already have one.\n# If you do not have a business account with a secretKey/ApiKey, \n# go through the signup process for a test account here: https://www.testwyre.com/\n\n# If you do, skip down to Create a Wyre Account in this view. \n\n\n################### Create a Wyre Account ###################\n# After receiving your secret key, your next step should be create an account.\n# In this example below, I'm using the test env. When you are ready, use the production url: https://api.sendwyre.com\n\n# Feel free to input your own account object below. \n\ncurl -X POST \\\n-H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer YOUR-BEARER-TOKEN\" \\\n-d '{\"type\":\"INDIVIDUAL\",\"country\": \"US\",\"subaccount\": true,\"profileFields\":[{\"fieldId\": \"individualLegalName\",\"value\": \"YOUR_NAME\"},{\"fieldId\": \"individualEmail\",\"value\": \"YOUREMAIL:::at:::EMAIL.com\"},{\"fieldId\": \"individualResidenceAddress\",\"value\": {\"street1\": \"1 Market St\",\"street2\": \"Suite 402\",\"city\": \"San Francisco\",\"state\": \"CA\",\"postalCode\": \"94105\",\"country\": \"US\"}}]}' \\\nhttps://api.testwyre.com/v3/accounts"},{"language":"json","code":"{\n\t\"type\":\"INDIVIDUAL\",\n\t\"country\": \"US\",\n  \"subaccount\": true,\n\t\"profileFields\":[\n\t\t{\n\t\t\t\"fieldId\": \"individualLegalName\",\n\t\t\t\"value\": \"Johnny Quest\"\n\t\t},\n\t\t{\n\t\t\t\"fieldId\": \"individualEmail\",\n\t\t\t\"value\": \"JohnnyQuest22@yolo.com\"\n\t\t},\n\t\t{\n\t\t\t\"fieldId\": \"individualResidenceAddress\",\n\t\t\t\"value\": {\n\t\t\t\t\"street1\": \"1 Market St\",\n\t\t\t\t\"street2\": \"Suite 402\",\n\t\t\t\t\"city\": \"San Francisco\",\n\t\t\t\t\"state\": \"CA\",\n\t\t\t\t\"postalCode\": \"94105\",\n\t\t\t\t\"country\": \"US\"\n\t\t\t}\n\t\t}\n\t]\n}"}]},"results":{"codes":[{"name":"","code":"{\n  \"id\" : \"AC-U4BWHGZDG6W\",\n  \"status\" : \"PENDING\",\n  \"type\" : \"INDIVIDUAL\",\n  \"country\" : \"US\",\n  \"createdAt\" : 1541789972000,\n  \"depositAddresses\" : {\n    \"ETH\" : \"0x98B031783d0efb1E65C4072C6576BaCa0736A912\",\n    \"BTC\" : \"14CriXWTRoJmQdBzdikw6tEmSuwxMozWWq\"\n  },\n  \"totalBalances\" : { \n    \"BTC\" : 1.0000000,\n    \"ETH\" : 0.1000000000000000000\n  },\n  \"availableBalances\" : { \n    \"BTC\" : 1.0000000,\n    \"ETH\" : 0.1000000000000000000\n  },\n  \"profileData\" : [ {\n    \"fieldId\" : \"individualCellphoneNumber\",\n    \"fieldType\" : \"CELLPHONE\",\n    \"value\" : null,\n    \"note\" : \"Must be verified by user.\",\n    \"status\" : \"OPEN\"\n  }, {\n    \"fieldId\" : \"individualEmail\",\n    \"fieldType\" : \"EMAIL\",\n    \"value\" : \"johnnyquest22@yolo.com\",\n    \"note\" : \"Must be verified by user.\",\n    \"status\" : \"OPEN\"\n  }, {\n    \"fieldId\" : \"individualLegalName\",\n    \"fieldType\" : \"STRING\",\n    \"value\" : \"Johnny Quest\",\n    \"note\" : null,\n    \"status\" : \"PENDING\"\n  }, {\n    \"fieldId\" : \"individualDateOfBirth\",\n    \"fieldType\" : \"DATE\",\n    \"value\" : null,\n    \"note\" : null,\n    \"status\" : \"OPEN\"\n  }, {\n    \"fieldId\" : \"individualSsn\",\n    \"fieldType\" : \"STRING\",\n    \"value\" : null,\n    \"note\" : null,\n    \"status\" : \"NULL\"\n  }, {\n    \"fieldId\" : \"individualResidenceAddress\",\n    \"fieldType\" : \"ADDRESS\",\n    \"value\" : {\n\t\t\t\t\"street1\": \"1 Market St\",\n\t\t\t\t\"street2\": \"Suite 402\",\n\t\t\t\t\"city\": \"San Francisco\",\n\t\t\t\t\"state\": \"CA\",\n\t\t\t\t\"postalCode\": \"94105\",\n\t\t\t\t\"country\": \"US\"\n\t\t},\n    \"note\" : null,\n    \"status\" : \"PENDING\"\n  }, {\n    \"fieldId\" : \"individualGovernmentId\",\n    \"fieldType\" : \"DOCUMENT\",\n    \"value\" : [],\n    \"note\" : null,\n    \"status\" : \"OPEN\"\n  }, {\n    \"fieldId\" : \"individualSourceOfFunds\",\n    \"fieldType\" : \"PAYMENT_METHOD\",\n    \"value\" : null,\n    \"note\" : \"Payment method not yet submitted\",\n    \"status\" : \"OPEN\"\n  } ]\n}","language":"json","status":200}]},"settings":"","apiSetting":"5c50b085aae6150014b3e80e","auth":"required","params":[{"_id":"5be6007145a5490061789903","ref":"","in":"body","required":true,"desc":"the type of account, currently `INDIVIDUAL` is the only supported value","default":"","type":"string","name":"type"},{"_id":"5be6007145a5490061789902","ref":"","in":"body","required":true,"desc":"the country of the account holder. For individuals this is the country of residence","default":"","type":"string","name":"country"},{"_id":"5be6007145a5490061789901","ref":"","in":"body","required":true,"desc":"an array of the Fields submitted at the time of Account creation. You can submit as many or as few fields as you need at the time of Account creation. [More information](doc:account-resource#section-fields)","default":"","type":"array_object","name":"profileFields"},{"_id":"5c400d555c006f0050b996c8","ref":"","in":"body","required":false,"desc":"Supply your own Account ID when creating noncustodial accounts. This field is used to track which account referred the new account into our system","default":"","type":"string","name":"referrerAccountId"},{"_id":"5c400d555c006f0050b996c7","ref":"","in":"body","required":false,"desc":"When true, the newly created account will be a custodial subaccount owner by the caller. Otherwise, the account will be a standalone non-custodial account.","default":"true","type":"string","name":"subaccount"}],"url":"/v3/accounts"},"isReference":true,"order":2,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Note on fields required\",\n  \"body\": \"When creating the account you can submit as many or as few profileFields as you need at the time of Account creation. [More information](doc:account-resource#section-fields)\"\n}\n[/block]","excerpt":"","slug":"create-account","type":"endpoint","title":"Create Account"}

postCreate Account


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

type:
required
string
the type of account, currently `INDIVIDUAL` is the only supported value
country:
required
string
the country of the account holder. For individuals this is the country of residence
profileFields:
required
array of objects
an array of the Fields submitted at the time of Account creation. You can submit as many or as few fields as you need at the time of Account creation. [More information](doc:account-resource#section-fields)
referrerAccountId:
string
Supply your own Account ID when creating noncustodial accounts. This field is used to track which account referred the new account into our system
subaccount:
stringtrue
When true, the newly created account will be a custodial subaccount owner by the caller. Otherwise, the account will be a standalone non-custodial account.

Examples


Result Format


Documentation

[block:callout] { "type": "info", "title": "Note on fields required", "body": "When creating the account you can submit as many or as few profileFields as you need at the time of Account creation. [More information](doc:account-resource#section-fields)" } [/block]