Deposits & Withdrawals - Private

GET /v3/deposit-addresses

Deposit addresses

chevron-rightCurlhashtag

Request

GET /v3/deposit-addresses?asset={asset}&network={network}

Successful response format

{
    "success": true,
    "data": {
        "address":"0xD25bCD2DBb6114d3BB29CE946a6356B49911358e"
    }
}
chevron-rightPythonhashtag
import os
import requests
import hmac
import hashlib
import base64
from dotenv import load_dotenv
from datetime import datetime
import random
import string

load_dotenv()

def get_deposit_address(asset, network):
    api_key = os.getenv('API_KEY')
    secret_key = os.getenv('API_SECRET').encode('utf-8')
    timestamp = datetime.utcnow().isoformat()
    nonce = ''.join(random.choices(string.ascii_lowercase + string.digits, k=16))
    method = 'GET'
    path = 'api.ox.fun'
    endpoint = '/v3/deposit-addresses'
    query = f'asset={asset}&network={network}'
    msg_string = f'{timestamp}\n{nonce}\n{method}\n{path}\n{endpoint}\n{query}'

    sign = base64.b64encode(hmac.new(secret_key, msg_string.encode('utf-8'), hashlib.sha256).digest()).decode('utf-8')

    try:
        response = requests.get(f'https://{path}{endpoint}?{query}', headers={
            'Content-Type': 'application/json',
            'AccessKey': api_key,
            'Timestamp': timestamp,
            'Signature': sign,
            'Nonce': nonce
        })
        response_data = response.json()
        if response_data.get('success'):
            return response_data['data']['address']
        else:
            print('Failed to fetch deposit address')
    except requests.exceptions.RequestException as error:
        print('Error making API request:', error)

# Example usage

address = get_deposit_address('OX', 'Solana')
print(address)

chevron-rightJavascripthashtag
require('dotenv').config();
const axios = require('axios');
const CryptoJS = require("crypto-js");

async function getDepositAddress(asset, network) {
  const apiKey = process.env.API_KEY;
  const secretKey = process.env.API_SECRET;
  const timestamp = new Date().toISOString();
  const nonce = Math.random().toString(36).substring(2);
  const method = 'GET';
  const path = 'api.ox.fun';
  const endpoint = '/v3/deposit-addresses';
  const query = `asset=${asset}&network=${network}`;
  const msgString = `${timestamp}\n${nonce}\n${method}\n${path}\n${endpoint}\n${query}`;

  const sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256(msgString, secretKey));

  try {
    const response = await axios.get(`https://${path}${endpoint}?${query}`, {
      headers: {
        'Content-Type': 'application/json',
        'AccessKey': apiKey,
        'Timestamp': timestamp,
        'Signature': sign,
        'Nonce': nonce
      }
    });
    //console.log(response.data);
    if (response.data.success) {
      return response.data.data.address;
    } else {
      console.error('Failed to fetch deposit address');
    }
  } catch (error) {
    console.error('Error making API request:', error.response ? error.response.data : error.message);
  }
}

async function main() {
  const address = await getDepositAddress('OX', 'Solana');
  console.log(address);
}

main();

Request Parameter
Type
Required
Description

asset

STRING

YES

network

STRING

YES

Response Field
Type
Description

address

STRING

Deposit address

memo

STRING

Memo (tag) if applicable

GET /v3/deposit

Deposit history

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag

Request Parameter
Type
Required
Description

asset

STRING

NO

Default all assets

limit

LONG

NO

Default 50, max 200

startTime

LONG

NO

Millisecond timestamp. Default 24 hours ago. startTime and endTime must be within 7 days of each other. startTime is INCLUSIVE

endTime

LONG

NO

Millisecond timestamp. Default time now. startTime and endTime must be within 7 days of each other. endTime is INCLUSIVE

Response Field
Type
Description

asset

STRING

network

STRING

address

STRING

Deposit address

memo

STRING

Memo (tag) if applicable

quantity

STRING

id

STRING

status

STRING

txId

STRING

creditedAt

STRING

Millisecond timestamp

GET /v3/withdrawal-addresses

Withdrawal addresses

Provides a list of all saved withdrawal addresses along with their respected labels, network, and whitelist status

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag

Request Parameter
Type
Required
Description

asset

STRING

NO

Default all assets

network

STRING

NO

Default all networks

Response Field

Type

Description

asset

STRING

network

STRING

address

STRING

memo

STRING

Memo (tag) if applicable

label

STRING

Withdrawal address label

whitelisted

BOOL

GET /v3/withdrawal

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag
Request Parameter
Type
Required
Description

id

STRING

NO

asset

STRING

NO

Default all assets

limit

LONG

NO

Default 50, max 200

startTime

LONG

NO

Millisecond timestamp. Default 24 hours ago. startTime and endTime must be within 7 days of each other. This filter applies to "requestedAt". startTime is INCLUSIVE

endTime

LONG

NO

Millisecond timestamp. Default time now. startTime and endTime must be within 7 days of each other. This filter applies to "requestedAt". endTime is INCLUSIVE

Response Field
Type
Description

id

STRING

asset

STRING

network

STRING

address

STRING

memo

STRING

Memo (tag) if applicable

quantity

STRING

fee

STRING

status

STRING

COMPLETED, PROCESSING, IN SWEEPING, PENDING, ON HOLD, CANCELED, or FAILED

txId

STRING

requestedAt

STRING

Millisecond timestamp

completedAt

STRING

Millisecond timestamp

POST /v3/withdrawal

Withdrawal request

Withdrawals may only be initiated by API keys that are linked to the parent account and have withdrawals enabled. If the wrong 2fa code is provided the endpoint will block for 10 seconds.

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag

Request Parameter
Type
Required
Description

asset

STRING

YES

network

STRING

YES

address

STRING

YES

memo

STRING

NO

Memo is required for chains that support memo tags

quantity

STRING

YES

externalFee

BOOL

YES

If false, then the fee is taken from the quantity, also with the burn fee for asset SOLO

tfaType

STRING

NO

GOOGLE, or AUTHY_SECRET, or YUBIKEY

code

STRING

NO

2fa code if required by the account

Response Field
Type
Description

id

STRING

asset

STRING

network

STRING

address

STRING

memo

STRING

quantity

STRING

externalFee

BOOL

If false, then the fee is taken from the quantity

fee

STRING

status

STRING

requestedAt

STRING

Millisecond timestamp

GET /v3/withdrawal-fee

Withdrawal fee estimate

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag
Request Parameter
Type
Required
Description

asset

STRING

YES

network

STRING

YES

address

STRING

YES

memo

STRING

NO

Required only for 2 part addresses (tag or memo)

quantity

STRING

YES

externalFee

BOOL

NO

Default false. If false, then the fee is taken from the quantity

Response Field
Type
Description

asset

STRING

network

STRING

address

STRING

memo

STRING

Memo (tag) if applicable

quantity

STRING

externalFee

BOOL

If false, then the fee is taken from the quantity

estimatedFee

STRING

Last updated