Create Wallet

Create a new wallet

Building the creation request

When building your Creation request you'll need to use 2 out of these 4 fields:

  • name - Your unique identifier for this user.
  • callbackUrl - Optional callback when the user receives funds. The callbackUrl payload can be viewed here: Callbacks
  • notes - Optional notes about the user
  • type - The type of user you are creating, DEFAULT, ENTERPRISE or SAVINGS. When creating a wallet for SAVINGS, please follow the instructions: Creating Savings Accounts.

Params

keytypedescriptionrequired
nameStringUnique identifier for the usertrue
callbackUrlStringCallback for updatesfalse
notesStringNotes about the userfalse
typeStringThe type of user you are creating, defaults to DEFAULTfalse

Code Examples

curl -v -XPOST 'https://api.sendwyre.com/v2/wallets' \
	-H "Content-Type: application/json" \
  -H "X-Api-Key: {api-key}" \
  -H "X-Api-Signature: {signature}" \
	-d '{
        "type":"ENTERPRISE",
        "name":"{your-unique-identifier}",
        "callbackUrl":"https://your.website.io/callback",
        "notes":"Notes about the sub account"
      }'
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.Integer;
import java.lang.String;
import java.lang.StringBuffer;
import java.net.HttpURLConnection;
import java.net.URL;

public class Main {
	public static void main(String[] args) {
		String accountId = "k3f48j0rb2rp65c0sdog67vi43u80jas";
		String apiKey = "fll36l3t35udalcqlh4ng6bm4qpbgher";
		String secretKey = "tr3epinbk3maist0n3ijk18bm6dikrq6";

		String url = "https://api.sendwyre.com/v2/wallets";
		String method = "POST";
		String data = "";

		String result = excuteWyereRequest(url, "", method, apiKey, secretKey);
		System.out.println(result);

		data = "{" +
        "  \"type\":\"ENTERPRISE\"," +
				"  \"name\":\"{your-unique-identifier}\"," +
				"  \"callbackUrl\":\"https://your.website.io/callback\"," +
				"  \"notes\":\"Notes about the user\"," +
				"  \"verificationData\": {" +
        "      \"firstName\":\"{users-first-name}\"," +
        "      \"middleName\":\"{users-middle-name}\"," +
        "      \"lastName\":\"{users-last-name}\"," +
        "      \"ssn\":\"0000\"," +
        "      \"passport\":\"123456\"," +
        "      \"birthDay\":\"1\"," +
        "	     \"birthMonth\":\"1\"," +
        "      \"birthYear\":\"1970\"," +
        "      \"phoneNumber\":\"+15555555555\"," +
        "		   \"address\": {" +
        "          \"street1\":\"1 Market Street\"," +
        "          \"street2\":\"Suit 420\"," +
        "          \"city\":\"San Francisco\"," +
        "          \"state\":\"CA\"," +
        "          \"postalCode\":\"94105\"," +
        "          \"country\":\"US\"" +
        "      }" +
        "  }" +
				"}";
		result = excuteWyreRequest(url, data, method, apiKey, secretKey);

		System.out.println(result);
	}

	public static String excuteWyreRequest(String targetURL, String requestBody, String method, String apiKey, String secretKey) {
		URL url;
		HttpURLConnection connection = null;
		try {

			targetURL += ((targetURL.indexOf("?")>0)?"&":"?") + "timestamp=" + System.currentTimeMillis();

			//Create connection
			url = new URL(targetURL);
			connection = (HttpURLConnection)url.openConnection();
			connection.setRequestMethod(method);
			System.out.println(connection.getRequestMethod());

			connection.setRequestProperty("Content-Type", "application/json");
			connection.setRequestProperty("Content-Length", Integer.toString(requestBody.getBytes().length));

			//Specify API v2
			connection.setRequestProperty("X-Api-Version","2");

			// Provide API key and signature
			connection.setRequestProperty("X-Api-Key", apiKey);
			connection.setRequestProperty("X-Api-Signature",computeSignature(secretKey,targetURL,requestBody));

			//Send request
			if(method.equals("POST")) {
				connection.setDoOutput(true);
				connection.setRequestMethod(method);

				DataOutputStream wr = new DataOutputStream(
						connection.getOutputStream());

				wr.writeBytes(requestBody);
				wr.flush();
				wr.close();
			}

			//Get Response
			InputStream is = connection.getInputStream();
			BufferedReader rd = new BufferedReader(new InputStreamReader(is));
			String line;
			StringBuffer response = new StringBuffer();
			while((line = rd.readLine()) != null) {
				response.append(line);
				response.append('\r');
			}
			rd.close();
			return response.toString();

		} catch (Exception e) {

			e.printStackTrace();
			return null;

		} finally {

			if(connection != null) {
				connection.disconnect();
			}
		}
	}

	public static String computeSignature(String secretKey, String url, String reqData) {

		String data = url + reqData;

		System.out.println(data);

		try {
			Mac sha256Hmac = Mac.getInstance("HmacSHA256");
			SecretKeySpec key = new SecretKeySpec(secretKey.getBytes(), "HmacSHA256");
			sha256Hmac.init(key);

			byte[] macData = sha256Hmac.doFinal(data.getBytes());

			String result = "";
			for (final byte element : macData){
				result += Integer.toString((element & 0xff) + 0x100, 16).substring(1);
			}
			return result;

		} catch (Exception e) {
			e.printStackTrace();
			return "";
		}
	}
}
#dependencies:
#python3
#pip3 install requests

import json
import hmac
import time
from requests import request

class MassPay_API(object):
    def __init__(self, account_id, api_version, api_key, api_secret):
        self.account_id = account_id
        self.api_url = 'https://api.sendwyre.com/{}'.format(api_version)
        self.api_version = api_version
        self.api_key = api_key
        self.api_secret = api_secret

    #authentication decorator. May raise ValueError if no json content is returned
    def authenticate_request(func):
        def wrap(self, *args, **kwargs):
            url, method, body = func(self, *args, **kwargs)
            params = {}
            timestamp = int(time.time() * 1000)
            url += '?timestamp={}'.format(timestamp)
            bodyJson = json.dumps(body) if body != '' else ''
            headers = {}
            headers['Content-Type'] = 'application/json'
            headers['X-Api-Version'] = self.api_version
            headers['X-Api-Key'] = self.api_key
            headers['X-Api-Signature'] = hmac.new(self.api_secret.encode('utf-8'), (url + bodyJson).encode('utf-8'), 'SHA256').hexdigest()
            print(headers['X-Api-Signature'])
            resp = request(method=method, url=url, params=params, data=(json.dumps(body) if body != '' else None), json=None, headers=headers)
            if resp.text is not None: #Wyre will always try to give an err body
                return resp.status_code, resp.json()
            return 404, {}
        return wrap

    @authenticate_request
    def create_user(self, name, callbackUrl, notes, verificationData):
        url = self.api_url + '/wallets'
        method = 'POST'
        body = {'name':name,
                'verificationData':verificationData,
                'type':'ENTERPRISE'}
        if callbackUrl:
            body["callbackUrl"] = callbackUrl
        if notes:
            body['notes'] = notes
        return url, method, body 

#USAGE Example
account_id = "YOUR_ACCOUNT_ID_HERE" #optional
api_key = "YOUR_API_KEY_HERE"
secret_key = "YOUR_SECRET_KEY_HERE"
api_version = "2"

#create Wyre MassPay API object
Wyre = MassPay_API(account_id, api_version, api_key, secret_key)

#create user and print result
http_code, result = Wyre.create_user(
                                "{your-unique-identifier}", 
                                "https://your.website.io/callback", 
                                None, #notes
                                {
    															"firstName": "{users-first-name}",
                     							"middleName": "{users-middle-name}",
    															"lastName": "{users-last-name}",
    															"ssn": "0000",
    															"passport": "123456",
    															"birthDay": "1",
    															"birthMonth": "1",
    															"birthYear": "1970",
    															"phoneNumber": "+15555555555",
    															"address": {
      															"street1":"1 Market Street",
      															"street2":"Suite 420",
      															"city":"San Francisco",
      															"state":"CA",
      															"postalCode":"94105",
      															"country":"US"
      														}
    														})
print(result)
users_srn = result['srn'] #grab our srn identifier for the user
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;

namespace test
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			WyreApi wyreApi = new WyreApi();

			string userData = "{" +
        "  \"type\":\"ENTERPRISE\"," +
				"  \"name\":\"{your-unique-identifier}\"," +
				"  \"callbackUrl\":\"https://your.website.io/callback\"," +
				"  \"notes\":\"Notes about the user\"," +
				"  \"verificationData\": {" +
        "      \"firstName\":\"{users-first-name}\"," +
        "      \"middleName\":\"{users-middle-name}\"," +
        "      \"lastName\":\"{users-last-name}\"," +
        "      \"ssn\":\"0000\"," +
        "      \"passport\":\"123456\"," +
        "      \"birthDay\":\"1\"," +
        "	     \"birthMonth\":\"1\"," +
        "      \"birthYear\":\"1970\"," +
        "      \"phoneNumber\":\"+15555555555\"," +
        "		   \"address\": {" +
        "          \"street1\":\"1 Market Street\"," +
        "          \"street2\":\"Suit 420\"," +
        "          \"city\":\"San Francisco\"," +
        "          \"state\":\"CA\"," +
        "          \"postalCode\":\"94105\"," +
        "          \"country\":\"US\"" +
        "      }" +
        "  }" +
				"}";
			string new_user = wyreApi.createUser(userData);
			Console.WriteLine(new_user);
		}
	}

	public class WyreApi {
		private const string domain = "https://api.sendwyre.com";
		private const string apiKey = "xxxxxx";
		private const string secKey = "xxxxxx";

		public string createUser(string jsonString)
		{
			return MakePostReq("/wallets", jsonString);
		}

		private string MakePostReq(string apiRoute, string jsonData)
		{
			WebRequest req = AssembleWebRequest(apiRoute, jsonData);
			req.Method = "POST";
			WriteJsonToRequest(req, jsonData);

			WebResponse response = req.GetResponse();
			string responseString = ParseWebResponse(response);
			return responseString;
		}

		private WebRequest AssembleWebRequest(string apiRoute, string jsonData = "")
		{
			string url = domain + apiRoute + (apiRoute.Contains("?")?"&":"?") + "timestamp="+DateTime.Now.Ticks; 
			WebRequest request = WebRequest.Create(url);
			string authSig = CalcAuthSigHash(secKey, url + jsonData);

			request.ContentType = "application/json";
			request.Headers["X-Api-Key"] = apiKey;
			request.Headers["X-Api-Signature"] = authSig;
			request.Headers["X-Api-Version"] = "2";
			return request;
		}

		private void WriteJsonToRequest(WebRequest req, string jsonData)
		{
			var streamWriter = new StreamWriter(req.GetRequestStream ());
			streamWriter.Write(jsonData);
			streamWriter.Close();
		}

		private byte[] GetBytes(string str)
		{
			return Encoding.UTF8.GetBytes(str);
		}

		private string GetString(byte[] bytes)
		{
			return BitConverter.ToString(bytes);
		}

		private string CalcAuthSigHash(string key, string value)
		{
			HMACSHA256 hmac = new HMACSHA256(GetBytes(key));
			string hash = GetString(hmac.ComputeHash(GetBytes(value)));
			hash = hash.Replace("-", "");
			return hash;
		}

		private string ParseWebResponse(WebResponse response)
		{
			StreamReader streamReader = new StreamReader(response.GetResponseStream());
			string result = streamReader.ReadToEnd();
			streamReader.Close();
			return result;
		}
	}
}
<?php
    function make_authenticated_request($endpoint, $method, $body) {
        $url = 'https://api.sendwyre.com';
        $api_key = "bh405n7stsuo5ut30iftrsl71b4iqjnv";
        $secret_key = "a19cvrchgja82urvn47kirrlrrb7stgg";

        $timestamp = floor(microtime(true)*1000);
        $request_url = $url . $endpoint;

        if(strpos($request_url,"?"))
            $request_url .= '&timestamp=' . $timestamp;
        else
            $request_url .= '?timestamp=' . $timestamp;

        if(!empty($body))
            $body = json_encode($body, JSON_FORCE_OBJECT);
        else
            $body = '';

        $headers = array(
            "Content-Type: application/json",
            "X-Api-Key: ". $api_key,
            "X-Api-Signature: ". calc_auth_sig_hash($secret_key, $request_url . $body),
            "X-Api-Version: 2"
        );
        $curl = curl_init();

        if($method=="POST"){
          $options = array(
            CURLOPT_URL             => $request_url,
            CURLOPT_POST            =>  true,
            CURLOPT_POSTFIELDS      => $body,
            CURLOPT_RETURNTRANSFER  => true);
        }else {
          $options = array(
            CURLOPT_URL             => $request_url,
            CURLOPT_RETURNTRANSFER  => true);
        }
        curl_setopt_array($curl, $options);
        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
        $result = curl_exec($curl);
        curl_close($curl);
        var_dump($result);
        return json_decode($result, true);
    }

    function calc_auth_sig_hash($seckey, $val) {
        $hash = hash_hmac('sha256', $val, $seckey);
        return $hash;
    }

		$userData = array(
      "type"=>"ENTERPRISE",
      "name"=>"{your-unique-identifier}",
      "callbackUrl"=>"https://your.website.io/callback",
      "notes"=> "Notes about the user",
      "verificationData"=> array(
        	"firstName"=> "{users-first-name}",
          "middleName"=> "{users-middle-name}",
          "lastName"=> "{users-last-name}",
          "ssn"=> "0000",
          "passport"=> "12345",
          "birthDay"=> "1",
          "birthMonth"=> "1",
          "birthYear"=> "1970",
          "phoneNumber"=> "+15555555555",
          "address"=> array(
            "street1":"1 Market Street",
            "street2":"Suite 420",
            "city":"San Francisco",
            "state":"CA",
            "postalCode":"94105",
            "country":"US"
          )
        )
      );
		echo make_authenticated_request("/wallets", "POST", $userData);
?>
#!/bin/bash
apiKey='P8Lc7vzwR6dSpWY'
secret='Atk0MZ1xSOlW250'

timestamp=`date +%s`
timestamp+="000"
url='https://api.sendwyre.com/v2/wallets?timestamp='
url+=$timestamp

body='{"type":"ENTERPRISE","name":"{your-unique-identifier3}","callbackUrl":"https://your.website.io/callback","notes":"Notes about the sub account","verificationData":{"firstName":"{users-first-name}","middleName":"{users-middle-name}","lastName":"{users-last-name}","ssn":"0000","passport":"123456","birthDay":"1","birthMonth":"1","birthYear":"1970","phoneNumber":"+15555555555","address":{"street1":"1 Market Street","street2":"Suite 420","city":"San Francisco","state":"CA","postalCode":"94105","country":"US"}}}'

data=$url
data+=$body
signature=`echo -n $data | openssl dgst -sha256 -hex -hmac $secret`

echo $apiKey
echo $signature
echo $url

curl -v -XPOST $url \
	-H "Content-Type: application/json" \
  -H "X-Api-Key: $apiKey" \
  -H "X-Api-Signature: $signature" \
	-H "X-Api-Version: 2" \
	-d "$body"
const axios = require('axios');
const YOUR-WYRE-API-KEY = AK-XXXX-XXXX-XXXX

async makeWallet(req, res, next) {
        try {
            const timestamp = new Date().getTime();
            const url = `https://api.sendwyre.com/v2/wallets?timestamp=${timestamp}`;
            const headers = {};
            const body = {
                name: "USER-UID-FROM-YOUR-APP",
                callbackUrl: "",
                type: "ENTERPRISE", //Options: DEFAULT, ENTERPRISE, SAVINGS
                notes: "AC-XXXX-XXXX"
            };

            const details = JSON.stringify(body);

            headers['Content-Type'] = 'application/json';
            headers['X-Api-Key'] = YOUR-WYRE-API-KEY;
            headers['X-Api-Signature'] = signature(url, details);

            const config = {
                method: "POST",
                url: url,
                headers: headers,
                data: details
            }

            const response = await axios(config);
            res.send(response.data);

        } catch (error) {
            next(error)
        }
    }

Response

When a new wallet is created you will receive the following:

  • name - Your identifier
  • id - Wyre's identifier
  • depositAddresses - Digital currency deposit addresses for the user
  • totalBalances - Total balance for the user
  • availableBalances - Funds available to the user
  • pusherChannel - Pusher update channel
  • srn - Wyre Reference Name identifier
  • balances - Balances for the user
  • callbackUrl - Your callback url
  • notes - Your note for the user
  • verificationData - KYC information for the user
{
    "owner": "account:AC_XXXXXXXXXX",
    "status": null,
    "pusherChannel": "d89ecb3deae49a753c0df3a2166f46dd",
    "createdAt": 1610571740000,
    "callbackUrl": null,
    "balances": {},
    "depositAddresses": {
       "BTC": "1GyDFgcbzdHNzfF8ammKbMqqhUtCsDLxAX",
       "AVAX": "X-avax1nn3ax8dfgmy3g80wxxmq5pltacp7ks6qzecuu0",
       "XLM": "GBRNYP3MCASHJYUZLB7ORY37RNEL7Z6B2QATAZ7LGQLCTUU2ZLQVN65A:MBJBTDQARAM",
       "ETH": "0xa6d885b0f66c8219e5b66a67ffcca7d37449e652"
    },
    "totalBalances": {},
    "availableBalances": {},
    "notes": null,
    "srn": "wallet:WA_XXXXXXXXXX",
    "name": "user:6d-00000-00000",
    "id": "WA_XXXXXXXXXX",
    "type": "DEFAULT"
}
Language
Credentials
Header
Click Try It! to start a request and see the response here!