Get Account
Retrieve all profile data for an account along with verification status.
Use Masquerading
If you're requesting an account that is not your own because you're acting on behalf of the accountholder, you will need to use the masqueradeAs URL parameter.
You will encounter AccessDeniedException
responses if you attempt to access a different account without this
Get Account
GET
https://api.sendwyre.com/v3/accounts/:accountId
Path Parameters
Name
Type
Description
accountId
string
The ID of the account you wish to retrieve
{
"id" : "AC-U4BWHGZDG6W",
"status" : "PENDING",
"type" : "INDIVIDUAL",
"country" : "US",
"createdAt" : 1541789972000,
"depositAddresses" : {
"ETH" : "0x98B031783d0efb1E65C4072C6576BaCa0736A912",
"BTC" : "14CriXWTRoJmQdBzdikw6tEmSuwxMozWWq"
},
"totalBalances" : {
"BTC" : 1.0000000,
"ETH" : 0.1000000000000000000
},
"availableBalances" : {
"BTC" : 1.0000000,
"ETH" : 0.1000000000000000000
},
"profileFields" : [ {
"fieldId" : "individualCellphoneNumber",
"fieldType" : "CELLPHONE",
"value" : null,
"note" : "Must be verified by user.",
"status" : "OPEN"
}, {
"fieldId" : "individualEmail",
"fieldType" : "EMAIL",
"value" : "johnnyquest22@yolo.com",
"note" : "Must be verified by user.",
"status" : "OPEN"
}, {
"fieldId" : "individualLegalName",
"fieldType" : "STRING",
"value" : "Johnny Quest",
"note" : null,
"status" : "PENDING"
}, {
"fieldId" : "individualDateOfBirth",
"fieldType" : "DATE",
"value" : null,
"note" : null,
"status" : "OPEN"
}, {
"fieldId" : "individualSsn",
"fieldType" : "STRING",
"value" : null,
"note" : null,
"status" : "OPEN"
}, {
"fieldId" : "individualResidenceAddress",
"fieldType" : "ADDRESS",
"value" : {
"street1": "1 Market St",
"street2": "Suite 402",
"city": "San Francisco",
"state": "CA",
"postalCode": "94105",
"country": "US"
},
"note" : null,
"status" : "PENDING"
}, {
"fieldId" : "individualGovernmentId",
"fieldType" : "DOCUMENT",
"value" : [],
"note" : null,
"status" : "OPEN"
}, {
"fieldId" : "individualSourceOfFunds",
"fieldType" : "PAYMENT_METHOD",
"value" : null,
"note" : "Payment method not yet submitted",
"status" : "OPEN"
} ]
}
Example
'''
This is a Python 3.7 Module that gets a Wyre Account
information using secret key authentication.
You can only use this module for getting individual
or business accounts if you already have an account set up.
If you do not have a business or individual account with a secretKey/ApiKey,
go through the sign-up process for a test account here: https://www.testwyre.com/
'''
import hashlib
import hmac
import json
import os
import requests
import time
import urllib.parse
class WyreApi:
ACCOUNT_ID = os.getenv("ACCOUNT_ID")
API_KEY = os.getenv("WYRE_APIKEY")
SEC_KEY = os.getenv("WYRE_TOKEN")
API_VER3 = "/v3"
API_ACCOUNT_PATH = "/accounts"
API_URL = "https://api.testwyre.com"
'''
This method calculates the auth signature hash required for secret key
authentication
'''
def calc_auth_sig_hash(self, url_body):
# calculates a signature per Wyre API:
# https://docs.sendwyre.com/docs/authentication#secret-key-signature-auth
message, secret = bytes(
url_body, 'utf-8'), bytes(WyreApi.SEC_KEY, 'utf-8')
newhash = hmac.new(secret, message, hashlib.sha256)
return newhash.hexdigest()
'''
This method calculates a timesteamp required for the secret key
authentication
'''
def calcTimeStamp(self):
# creates a timestamp to the millisecond
return str(round(time.time() * 1000))
'''
This method gets account information and returns it as a json object
Prints an error message if call is unsuccessful.
'''
def getAccountInfo(self):
params = {
"timestamp": self.calcTimeStamp()
# If you are masquerading (acting on behalf) of your subaccount
# enter your account_id associated with your business account
# You could add that field in when passing data into the method
# "masqueradeAs": "ENTER ACCOUNT ID HERE"
}
url = WyreApi.API_URL + WyreApi.API_VER3 + WyreApi.API_ACCOUNT_PATH + \
"/" + WyreApi.ACCOUNT_ID + "?" + \
urllib.parse.urlencode(params, encoding='utf-8')
headers = {
'X-API-Key': WyreApi.API_KEY,
'X-API-Signature': self.calc_auth_sig_hash(url)
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
return json.loads(response.text)
else:
print(response)
if __name__ == "__main__":
#=========== Initializes a Wyre Obj ============= #
account = WyreApi()
response = account.getAccountInfo()
# response is the server response
if response:
print(response)
Last updated
Was this helpful?