A wallet comprises a private key, a public key, and many addresses. To enable a user to accept tokens or digital assets, create a wallet for them using our API.
You can create one wallet per blockchain.
Here are routes for the profile management.
Before you create a wallet, make sure that you create a profile
Create a wallet
This operation creates a wallet
POST
https://sandbox.oumla.com/api/v1/wallets/
generate
Request body
Sample code of the request:
TypeScript TypeScript (Axios) Python
Copy async function generateWallet (reference : string , network : string ) {
const apiKey = "Your API Key" ;
const url = "https://sandbox.oumla.com/api/v1/wallets/generate" ;
const data = JSON .stringify ({ reference , network });
const response = await fetch (url , {
method : "POST" ,
headers : {
"Content-Type" : "application/json" ,
"x-api-key" : apiKey ,
} ,
body : data ,
});
const responseData = await response .json ();
console .log (responseData);
}
// Example usage
generateWallet ( "dba1fea5-2004-4ea8-a06d-a7c7c5559b8f" , "BTC" );
Copy import axios from "axios" ;
async function generateWallet (reference : string , network : string ) {
const apiKey = "Your API Key" ;
const url = "https://sandbox.oumla.com/api/v1/wallets/generate" ;
try {
const response = await axios .post (url , {
reference ,
network ,
} , {
headers : {
"x-api-key" : apiKey ,
"Content-Type" : "application/json" ,
} ,
});
console .log ( response .data);
} catch (error) {
console .error ( "Error:" , error);
}
}
// Example usage
generateWallet ( "dba1fea5-2004-4ea8-a06d-a7c7c5559b8f" , "BTC" );
Copy import requests
import json
url = "https://sandbox.oumla.com/api/v1/wallets/generate"
api_key = "Your API Key"
data = {
reference : "dba1fea5-2004-4ea8-a06d-a7c7c5559b8f" ,
network : "BTC" ,
}
headers = {
"Content-Type" : "application/json" ,
"x-api-key" : api_key
}
response = requests . post (url, data = json. dumps (data), headers = headers)
if response . status_code == 200 :
print (response. json ())
else :
print ( "Error:" , response.status_code, response.text)
The expected response:
201: Wallet Created 402: Wallet Exist
Copy "data" : {
"reference" : "-2004-4ea8-a06d-a7c7c5559b8f" ,
"network" : "ETH" ,
"type" : "User" ,
"date" : "2024-07-13T10:05:35.636Z"
},
Copy {
"message" : "Profile has a ETH wallet" ,
"success" : false ,
"status" : 402
}
Get Wallets
This operation to get wallets by organization
GET
https://sandbox.oumla.com/api/v1/wallets/
organization
Sample code of the request:
TypeScript TypeScript (Axios) Python
Copy async function getWallets () {
const apiKey = "Your API Key" ;
const url = "https://sandbox.oumla.com/api/v1/wallets/organizations" ;
const response = await fetch (url , {
method : "GET" ,
headers : {
"Content-Type" : "application/json" ,
"x-api-key" : apiKey ,
} ,
});
const data = await response .json ();
console .log (data);
}
getWallets ();
Copy import axios from "axios" ;
async function getWallets () {
const apiKey = "Your API Key" ;
const url = "https://sandbox.oumla.com/api/v1/wallets/organization" ;
try {
const response = await axios .get (url , {
headers : {
"x-api-key" : apiKey ,
} ,
});
console .log ( response .data);
} catch (error) {
console .error ( "Error:" , error);
}
}
// Example usage
getWallets ();
Copy import requests
response = requests . get ( 'https://sandbox.oumla.com/api/v1/wallets/organization' , headers = {
'x-api-key' : 'Your API Key'
})
if response . status_code == 200 :
print (response. json ())
else :
print (response.text)
The expected response:
200: OK
Copy {
"data" : [
{
"reference" : "89a625b9-4c5f-4130-8b56-afx8010f8103" ,
"organizationId" : "8a9e86b8889e36b8-b175-4371-950e-d0e8a2b56c67" ,
"network" : "ETH" ,
"type" : "User" ,
"date" : "2024-07-13T10:05:35.636Z" ,
"currentDeepIndex" : 0 ,
"index" : 1
} ,
{
"reference" : "89a625b9-4c5f-4130-8b56-afx8010f8103" ,
"organizationId" : "889e36b8-b175-4371-950e-d0e8a2b56c67" ,
"network" : "BTC" ,
"type" : "User" ,
"date" : "2024-06-10T18:36:18.749Z" ,
"currentDeepIndex" : 10 ,
"index" : 0
} ,
// The other walllets
] ,
"pagination" : {
"totalElements" : 5 ,
"totalPages" : 1 ,
"skip" : 0 ,
"take" : 10
} ,
"success" : true ,
"status" : 200
}
This operation to get wallets by reference
GET
https://sandbox.oumla.com/api/v1/wallets/
profile
/
{{reference}}
Query Parameters (required)
Sample code of the request:
TypeScript TypeScript (Axios) Python
Copy async function getWalletByReference (reference : string ) {
const apiKey = "Your API Key" ;
const url = `https://sandbox.oumla.com/api/v1/wallets/profile/ ${ reference } ` ;
const response = await fetch (url , {
method : "GET" ,
headers : {
"Content-Type" : "application/json" ,
"x-api-key" : apiKey ,
} ,
});
const data = await response .json ();
console .log (data);
}
getWalletByReference ( "89a625b9-4c5f-4130-8b56-afx8010f8103" );
Copy import axios from "axios" ;
async function getWalletByReference (reference : string ) {
const apiKey = "Your API Key" ;
const url = `https://sandbox.oumla.com/api/v1/wallets/profile/ ${ reference } ` ;
try {
const response = await axios .get (url , {
headers : {
"x-api-key" : apiKey ,
} ,
});
console .log ( response .data);
} catch (error) {
console .error ( "Error:" , error);
}
}
// Example usage
getWalletByReference ( "89a625b9-4c5f-4130-8b56-afx8010f8103" );
Copy import requests
response = requests . get ( f 'https://sandbox.oumla.com/api/v1/wallets/profile/ { reference } ' , headers = {
'x-api-key' : 'Your API Key'
})
if response . status_code == 200 :
print (response. json ())
else :
print (response.text)
The expected response:
200: OK 404: Not Found
Copy {
"data" : [
{
"reference" : "89a625b9-4c5f-4130-8b56-afx8010f8103" ,
"organizationId" : "8a9e86b8889e36b8-b175-4371-950e-d0e8a2b56c67" ,
"network" : "ETH" ,
"type" : "User" ,
"date" : "2024-07-13T10:05:35.636Z" ,
"currentDeepIndex" : 0 ,
"index" : 1
} ,
{
"reference" : "89a625b9-4c5f-4130-8b56-afx8010f8103" ,
"organizationId" : "889e36b8-b175-4371-950e-d0e8a2b56c67" ,
"network" : "BTC" ,
"type" : "User" ,
"date" : "2024-06-10T18:36:18.749Z" ,
"currentDeepIndex" : 10 ,
"index" : 0
} ,
// The other walllets
] ,
"pagination" : {
"totalElements" : 5 ,
"totalPages" : 1 ,
"skip" : 0 ,
"take" : 10
} ,
"success" : true ,
"status" : 200
}
The reference
is Missing in the parameters.
Copy response: {
status: 404,
statusText: 'Not Found' ,
// ...
},