Oumla Docs
  • Quick start
  • Introduction
  • Security
  • Networks
  • Authentication
  • Use cases
  • SDK
    • Oumla client
    • Create a Profile
    • Getting Profiles
    • Generate a Wallet
    • Getting Wallets
    • Generate Addresses
    • Getting Addresses
    • Getting Transactions
    • Sending Transactions
    • SDK reference
  • API Reference
    • Organization routes
    • Profiles routes
    • Wallet routes
    • Addresses routes
    • Transactions routes
  • Types
  • FAQs
Powered by GitBook
On this page
  • This operation sends transactions
  • This operation to get transactions by reference or by address
  1. API Reference

Transactions routes

PreviousAddresses routesNextTypes

Last updated 8 months ago

You generated an address for a user, Then that user received transactions and you want to show all of their transactions. For a profile to receive digital assets they need a receiving address. every profile has the ability to get a lot of receiving addresses.

Before you create any transaction, make sure that you create a and make sure you have amount in your wallet, if you don't have please check this

This operation sends transactions

POST https://sandbox.oumla.com/api/v1/withdraw

Request Body (required)

Name
Type
Description

network*

NetworkType

specify which blockchain BTC | tBTC | ETH | tETH

from*

string[]

specify which addresses to withdraw from. This is an array of strings.

amount*

number

the amount to send.

to*

string

the desired address

clientShare*

string

the client share

Headers

Name
Type
Description

x-api-key*

string

Oumla api key

Sample code of the request:

async function sendTransaction(data:any ) {
  const apiKey = "Your API Key";
  const url = "https://sandbox.oumla.com/api/v1/withdraw";
  const clientShare = "YOUR_CLIENT_SHARE";
  
  data["clientShare"] = clientShare;
  
  const response = await fetch(url, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-api-key": apiKey,
    },
    body: JSON.stringify(data),
  });

  const responseData = await response.json();
  console.log(responseData);
}

// Example usage
let sendTransactionData = {
  network: "BTC",
  amount: "0.001",
  form: ["tb1qkpncdv42vgsmlvfsuwagqtexc4wnu82pg5q8q2wlgpgcsdkcy0q8js65e"],
  to: "tb1qkpncdv42vgsmlvfsuwagqtexc4whu82pg58q2wlgpgcsdkcy0q8js65e"
};

sendTransaction(sendTransactionData).catch((error) => console.error("Error:", error));
import axios from "axios";

async function sendTransaction(data: any) {
  const apiKey = "Your API Key";
  const url = "https://sandbox.oumla.com/api/v1/withdraw";

  try {
    const response = await axios.post(url, data, {
      headers: {
        "Content-Type": "application/json",
        "x-api-key": apiKey,
      },
    });

    console.log(response.data);
  } catch (error) {
    console.error("Error:", error);
  }
}

// Example usage
const sendTransactionData = {
  network: "BTC",
  amount: 0.001,
  form: ["tb1qkpncdv42vgsmlvfsuwagqtexc4wnu82pg5q8q2wlgpgcsdkcy0q8js65e"],
  to: "tb1qkpncdv42vgsmlvfsuwagqtexc4whu82pg58q2wlgpgcsdkcy0q8js65e",
};

sendTransaction(sendTransactionData);
import requests
import json

url = "https://sandbox.oumla.com/api/v1/withdraw"
api_key = "Your API Key"

data = {
    network: "BTC",
      amount: 0.001,
      form: ["tb1qkpncdv42vgsmlvfsuwagqtexc4wnu82pg5q8q2wlgpgcsdkcy0q8js65e"],
      to: "tb1qkpncdv42vgsmlvfsuwagqtexc4whu82pg58q2wlgpgcsdkcy0q8js65e",
}

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:

{
    "id": "1436f4bc75adbe862db0421fffaf83e334edf318283d1f30a0160f539050e",
    "status": "Pending"
}

This operation to get transactions by reference or by address

GET https://sandbox.oumla.com/api/v1/transactions/address/{{reference}}

OR

GET https://sandbox.oumla.com/api/v1/transactions/address/{{address}}

Query Parameters (required)

Name
Type
Description

reference*

string

the id for that user.

address*

string

the address of that user.

Headers

Name
Type
Description

x-api-key*

string

Oumla api key

Sample code of the request:

async function getTransactions() {
  const apiKey = "Your API Key";
  const address = "Your address";
  // OR
  const reference = "Your reference"
  const url = `https://sandbox.oumla.com/api/v1/transactions/address/${address}`;
  // OR
  const url = `https://sandbox.oumla.com/api/v1/transactions/address/${reference}`;
  
  const options = {
    method: "GET",
    headers: {
      "x-api-key": apiKey,
    },
  };
  
    const response = await fetch(url, options);
    const data = await response.json();
    console.log(data);
}

// Example usage
getTransactionsByAddress().catch((error) => console.error("Error:", error));;
import axios from "axios";

async function getTransactions() {
  const apiKey = "Your API Key";
  const address = "Your address";
  // OR
  const reference = "Your reference"
  const url = `https://sandbox.oumla.com/api/v1/transactions/address/${address}`;
  // OR
  const url = `https://sandbox.oumla.com/api/v1/transactions/address/${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
getTransactions();
import requests

# To get the transactions with an address

response = requests.get(f'https://sandbox.oumla.com/api/v1/wallets/profile/{address}', headers={
    'x-api-key': 'Your API Key'
})

if response.status_code == 200:
    print(response.json())
else:
    print(response.text)

# To get the transactions with an reference

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:

{
    "transactions": [
        {
            "addressFrom": null,
            "addressTo": "tb1qkpncdv42vgssmlvfsuwagqtexc4wnu82pq8q2wlgpgcsdkcy0q8js65e",
            "amount": 0.00002,
            "date": "2024-03-21T23:46:09.484Z",
            "isMempool": false,
            "isSpent": false,
            "status": "Confirmed",
            "updatedAt": "2024-03-21T23:48:46.251Z",
            "createdAt": "2024-03-21T23:46:09.485Z",
            "type": "Deposit",
            "network": "BTC",
            "txid": "3b176452402f0d1c09c17e55e96c91dbeee609fe130538c45d1cbcd090ffa3"
        },
        {
            "addressFrom": null,
            "addressTo": "tb1qkpncdv42vgssmlvfsuwagqtexc4whu82pg58wlgpgcsdkcy0q8js65e",
            "amount": 0.00001,
            "date": "2024-03-21T23:45:27.890Z",
            "isMempool": false,
            "isSpent": false,
            "status": "Confirmed",
            "updatedAt": "2024-03-21T23:48:45.916Z",
            "createdAt": "2024-03-21T23:45:27.891Z",
            "type": "Deposit",
            "network": "BTC",
            "txid": "6915a5c70cdfe452c6687940c6b4301ecd964e09f5d10798c34bb958a77be6"
        }
        // and the other transactions...
    ],
    "totalElements": 2,
    "totalPages": 1
}
address
How to Obtain Testnet Coins?