NAV Navbar
shell

Introduction

API Endpoint

https://secure.digitalsurge.com.au/api/

Welcome to the Digital Surge API documentation.

The Digital Surge API is organized around REST. Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors.

We support cross-origin resource sharing, allowing you to interact securely with our API from a client-side web application (though you should never expose your secret API key in any public website's client-side code). JSON is returned by all API responses, including errors.

Requests

Any tool that is fluent in HTTP can communicate with the API simply by requesting the correct URI. Requests should be made using the HTTPS protocol so that traffic is encrypted. The interface responds to different methods depending on the action required.

Method Usage
GET For simple retrieval of information about your profile and other data, you should use the GET method. The information you request will be returned to you as a JSON object. The attributes defined by the JSON object can be used to form additional requests. Any request using the GET method is read-only and will not affect any of the objects you are querying.
DELETE To destroy a resource and remove it from your account and environment, the DELETE method should be used. This will remove the specified object if it is found. If it is not found, the operation will return a response indicating that the object was not found.
PUT To update the information about a resource in your account, the PUT method is available.
POST To create a new object, your request should specify the POST method.
HEAD Finally, to retrieve metadata information, you should use the HEAD method to get the headers. This returns only the header of what would be returned with an associated GET request.

Errors

The Digital Surge API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your Authorization token is wrong or expired.
403 Forbidden -- The resource requested is not accessible by you.
404 Not Found -- The specified resource could not be found.
405 Method Not Allowed -- You tried to access a resource with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
429 Rate Limit Exceeded -- Rate limit exceeded.
500 Internal Server Error -- We had a problem with our server. Try again later.

Paginated Response

Example Request

curl "https://secure.digitalsurge.com.au/api/private/orders/?page=1&page_size=5" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" 

Example Response

{
  "count": 123,
  "next": "https://secure.digitalsurge.com.au/api/private/orders/?page=2&page_size=5",
  "previous": null,
  "results": [
    {
      "id": 1,
      "field_one": "value_one",
      "field_two": "value_two"
    },
    {
      "id": 2,
      "field_one": "value_one",
      "field_two": "value_two"
    }
  ]
}

When you request for a resource which should return multiple objects, you'll receive a paginated JSON response with the following keys:

Key Meaning
count Total number of objects we have in the database
next URL for the next page of data if exists
previous URL for the previous page of data if exists
results List (array) of objects

Default page size varies but mostly is 5 objects per page.

Maximum page size is 100.

Rate Limiting

The Digital Surge API is rate limited to prevent abuse that would degrade our ability to maintain a consistent API performance for all users. By default, each API key is rate limited to 300 requests per minute, certain endpoints are rate limited even further. The public API endpoints are rate limited to 100 requests per minute. If your requests are being rate limited, HTTP response code 429 will be returned with an Rate Limit Exceeded error.

Authentication

Digital Surge uses OAuth2 protocol to authorize incoming requests.

Digital Surge expects for the Authorization token to be included in all API requests to the server in a header that looks like the following:

Authorization: Bearer YOUR_TOKEN

Log In - Obtain Access Token

Example Request

curl https://secure.digitalsurge.com.au/o/token/ \
  -d client_id=dsinternal \
  -d email=YOUR_ACCOUNT_EMAIL \
  -d grant_type=password \
  -d password=YOUR_ACCOUNT_PASSWORD 

Make sure to replace YOUR_ACCOUNT_EMAIL with your actual email address and YOUR_ACCOUNT_PASSWORD with your actual password.

Status codes

200 - Success

Example Response

{
  "access_token": "YOUR_ACCESS_TOKEN",
  "expires_in": 36000,
  "refresh_token": "YOUR_REFRESH_TOKEN",
  "scope": "read write",
  "token_type": "Bearer"
}

POST https://secure.digitalsurge.com.au/o/token/

This endpoint doesn't require Authorization token in the header.

Refresh Access Token

Example Request

curl https://secure.digitalsurge.com.au/o/token/ \
  -d client_id=dsinternal \
  -d grant_type=refresh_token \
  -d refresh_token=YOUR_REFRESH_TOKEN 

Make sure to replace YOUR_REFRESH_TOKEN with your actual token.

Status codes

200 - Success

Example Response

{
  "access_token": "YOUR_NEW_ACCESS_TOKEN",
  "expires_in": 36000,
  "refresh_token": "YOUR_NEW_REFRESH_TOKEN",
  "scope": "read write",
  "token_type": "Bearer"
}

POST https://secure.digitalsurge.com.au/o/token/

This endpoint doesn't require Authorization token in the header.

Log Out - Revoke Access Token

Example Request

curl https://secure.digitalsurge.com.au/o/revoke-token/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d client_id=dsinternal \
  -d token="Bearer YOUR_ACCESS_TOKEN" 

Status codes

204 - Success

POST https://secure.digitalsurge.com.au/o/revoke-token/

Public Market

Base API URL for public market:

https://secure.digitalsurge.com.au/api/public/market/btc-aud/

BTC-AUD related data. These endpoints don't require Authorization header and are publicly open.

Bids

Example Request

curl https://secure.digitalsurge.com.au/api/public/market/bdc-aud/bids/

Example Response

{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "price": "10010.25",
      "volume": "3.65398366"
    },
    {
      "price": "0.25",
      "volume": "99.00000000"
    }
  ]
}

GET https://secure.digitalsurge.com.au/api/public/market/btc-aud/bids/

List current BTC-AUD bids.

Asks

Example Request

curl https://secure.digitalsurge.com.au/api/public/market/bdc-aud/asks/

Example Response

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "price": "10214.81",
      "volume": "6.04402146"
    }
  ]
}

GET https://secure.digitalsurge.com.au/api/public/market/btc-aud/asks/

List current BTC-AUD asks.

Depth

Example Request

curl https://secure.digitalsurge.com.au/api/public/market/btc-aud/depth/

Example Response

{
  "bids": [
    [
      "0.25",
      "102.6640348"
    ],
    [
      "9982.79",
      "3.6640348"
    ]
  ],
  "asks": [
    [
      "10214.81",
      "6.04402146"
    ]
  ]
}

GET https://secure.digitalsurge.com.au/api/public/market/btc-aud/depth/

Retrieve current BTC-AUD depth.

Price History

Example Request

curl https://secure.digitalsurge.com.au/api/public/market/btc-aud/price-history/

Example Response

{
  "hourly": [],
  "daily": [
    {
      "min": "7786.56",
      "max": "7807.19",
      "avg": "7796.88",
      "bc_volume": "0.00211368",
      "qc_volume": "16.46",
      "timestamp": "2017-10-22T00:00:00"
    },
    {
      "min": "7439.17",
      "max": "7710.87",
      "avg": "7575.02",
      "bc_volume": "0.00085004",
      "qc_volume": "6.37",
      "timestamp": "2017-10-24T00:00:00"
    },
    {
      "min": "7681.79",
      "max": "7681.79",
      "avg": "7681.79",
      "bc_volume": "0.00633088",
      "qc_volume": "48.63",
      "timestamp": "2017-10-29T00:00:00"
    }
  ]
}

GET https://secure.digitalsurge.com.au/api/public/market/btc-aud/price-history/

Retrieve public hourly and daily BTC-AUD price history.

Ticker

Example Request

curl https://secure.digitalsurge.com.au/api/public/market/btc-aud/ticker/

Example Response

{
  "price": {
    "last": "10187.38",
    "low": "9817.93",
    "high": "10248.47",
    "change": "430.54",
    "best_bid": "10013.66",
    "best_ask": "10246.34"
  },
  "volume": {
    "24h": "3.46565572",
    "30d": "29.42046676",
    "3m": "273.87782112",
    "6m": "368.64989775",
    "1y": "372.61885961"
  }
}

GET https://secure.digitalsurge.com.au/api/public/market/btc-aud/ticker/

Retrieve current BTC-AUD ticker.

Trades History

Example Request

curl "https://secure.digitalsurge.com.au/api/public/market/btc-aud/trades-history/?page=1&page_size=5"

Example Response

{
    "count": 11063,
    "next": "https://secure.digitalsurge.com.au/api/public/market/btc-aud/trades-history/?page=2&page_size=5",
    "previous": null,
    "results": [
        {
            "id": 22891,
            "bc_amount": "0.20000000",
            "qc_amount": "2037.48",
            "price": "10187.38",
            "created": "2018-07-20T05:18:33"
        },
        {
            "id": 22889,
            "bc_amount": "1.00000000",
            "qc_amount": "10247.13",
            "price": "10247.13",
            "created": "2018-07-20T03:54:03"
        },
        {
            "id": 22887,
            "bc_amount": "0.20000000",
            "qc_amount": "2002.33",
            "price": "10011.67",
            "created": "2018-07-20T03:49:38"
        },
        {
            "id": 22885,
            "bc_amount": "0.50000000",
            "qc_amount": "5124.24",
            "price": "10248.47",
            "created": "2018-07-20T03:45:08"
        },
        {
            "id": 22883,
            "bc_amount": "0.05190564",
            "qc_amount": "520.00",
            "price": "10018.18",
            "created": "2018-07-20T03:35:27"
        }
    ]
}

GET https://secure.digitalsurge.com.au/api/public/market/btc-aud/trades-history/

List public BTC-AUD trades history. Default page size here is 100.

Account Data

Profile

Example Request

curl https://secure.digitalsurge.com.au/api/private/profile/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"   

Example Response

{
  "identification": {
    "uuid": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "first_name": "First Name",
    "last_name": "Last Name",
    "email": "email@example.com",
    "phone": null
  },
  "monthly_trading_volume": "40204.58",
  "aud_commision_rate": "0.6",
  "aud_static_deposit_identifier": "11111111111",
  "verified_account": false,
  "account_verification": "Pending verification",
  "limits": {
    "daily_withdrawal": {
      "AUD": {
        "used": "0",
        "threshold": null,
        "remaining": null
      },
      "BTC": {
        "used": "0",
        "threshold": null,
        "remaining": null
      }
    },
    "daily_deposit": {
      "AUD": {
        "used": "5097.27",
        "threshold": null,
        "remaining": null
      },
      "BTC": {
        "used": "0",
        "threshold": null,
        "remaining": null
      },
      "POLi": {
        "used": "0",
        "threshold": null,
        "remaining": null
      }
    }
  },
  "affiliate_code": "XXXXX",
  "affiliate_registration_enabled": false
}

GET https://secure.digitalsurge.com.au/api/private/profile/

Retrieve current user profile information along with account limits and affiliate code.

Trades

curl https://secure.digitalsurge.com.au/api/private/trades/?page=1&page_size=5 \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" 

Example Response

{
    "count": 37,
    "next": "https://secure.digitalsurge.com.au/api/private/trades/?page=2&page_size=5",
    "previous": null,
    "results": [
        {
            "id": 22891,
            "bc_amount": "0.20000000",
            "qc_amount": "2037.48",
            "price": "10187.38",
            "created": "2018-07-20T05:18:33",
            "direction": "buy",
            "qc_fee": "12.22"
        },
        {
            "id": 22889,
            "bc_amount": "1.00000000",
            "qc_amount": "10247.13",
            "price": "10247.13",
            "created": "2018-07-20T03:54:03",
            "direction": "buy",
            "qc_fee": "61.48"
        },
        {
            "id": 22887,
            "bc_amount": "0.20000000",
            "qc_amount": "2002.33",
            "price": "10011.67",
            "created": "2018-07-20T03:49:38",
            "direction": "sell",
            "qc_fee": "12.01"
        },
        {
            "id": 22886,
            "bc_amount": "0.50000000",
            "qc_amount": "5124.24",
            "price": "10248.47",
            "created": "2018-07-20T03:45:08",
            "direction": "buy",
            "qc_fee": "30.74"
        },
        {
            "id": 22879,
            "bc_amount": "0.50000000",
            "qc_amount": "4915.03",
            "price": "9830.05",
            "created": "2018-07-19T07:13:17",
            "direction": "sell",
            "qc_fee": "34.40"
        }
    ]
}

GET https://secure.digitalsurge.com.au/api/private/trades/

List your trades history. Default page size here is 100.

Balances

Example Request

curl https://secure.digitalsurge.com.au/api/private/balances/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" 

Example Response

{
  "total": {
    "AUD": "2136.37",
    "BTC": "1.50011643"
  },
  "available": {
    "AUD": "2123.62",
    "BTC": "1.50011643"
  },
  "withdrawable": {
    "AUD": "2136.37",
    "BTC": "1.50011643"
  }
}

GET https://secure.digitalsurge.com.au/api/private/balances/

Retrieve current state of account balances.

Business Info

Example Request

curl https://secure.digitalsurge.com.au/api/private/business-info/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" 

Example Response

{
    "site_bank_account": {
        "account_name": "Digital Surge",
        "account_number": "XXXXXXXX",
        "account_BSB": "XXXXXX"
    },
    "trading_fee_schedule": [
        [
            10000,
            "0.75"
        ],
        [
            40000,
            "0.7"
        ],
        [
            70000,
            "0.6"
        ],
        [
            100000,
            "0.5"
        ],
        [
            200000,
            "0.4"
        ],
        [
            400000,
            "0.3"
        ],
        [
            800000,
            "0.2"
        ],
        [
            1500000,
            "0.15"
        ],
        [
            "Infinity",
            "0.1"
        ]
    ]
}

GET https://secure.digitalsurge.com.au/api/private/business-info/

Retrieve your site bank account data and trading fee schedule.

Orders

Base Orders API URL

https://secure.digitalsurge.com.au/api/private/orders/ 

Allowed methods: POST, GET

With Orders you can trade Bitcoin and other (soon!) cryptocurrencies in a REST way.

Create Order

Example Request

curl https://secure.digitalsurge.com.au/api/private/orders/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ 
  -d direction=10 \
  -d price="10248.47" \
  -d amount="0.50000000" \
  -d ephemeral=false

Example Response

{
  "id": 187584,
  "amount": "0.50000000",
  "closed": null,
  "created": "2018-07-20T03:40:18",
  "currency_pair_id": 1,
  "direction": "bid",
  "ephemeral": false,
  "pending_amount": "0.00000000",
  "price": "10248.47000000",
  "remaining_amount": "0.50000000",
  "status": "pending"
}

POST https://secure.digitalsurge.com.au/api/private/orders/

direction constant choices:

Operation Value
Buy Bid 10
Sell Ask 20

ephemeral means Instant-only Order. Never saved to the Order Book.

List Orders

Example Request

curl "https://secure.digitalsurge.com.au/api/private/orders/?page=1&page_size=5&status=20" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" 

Example Response

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
        "id": 187584,
        "amount": "0.50000000",
        "closed": null,
        "created": "2018-07-20T03:40:18",
        "currency_pair_id": 1,
        "direction": "bid",
        "ephemeral": false,
        "pending_amount": "0.00000000",
        "price": "10248.47000000",
        "remaining_amount": "0.50000000",
        "status": "pending"
      }
  ]
}

GET https://secure.digitalsurge.com.au/api/private/orders/

List your Trade Orders.

You can filter orders by status:

Status Value
Unknown 10
PENDING 20
TODO OTHER_STATUSES

Retrieve Order

Example Request

curl https://secure.digitalsurge.com.au/api/private/orders/187584/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" 

Example Response

{
  "id": 187584,
  "amount": "0.50000000",
  "closed": null,
  "created": "2018-07-20T03:40:18",
  "currency_pair_id": 1,
  "direction": "bid",
  "ephemeral": false,
  "pending_amount": "0.00000000",
  "price": "10248.47000000",
  "remaining_amount": "0.50000000",
  "status": "pending"
}

GET https://secure.digitalsurge.com.au/api/private/orders/:order_id/

Retrieve your Trade Order by its ID.

AUD Deposits

Base AUD Deposits API URL

https://secure.digitalsurge.com.au/api/private/wallet/AUD/deposits/

Allowed methods: POST, GET, DELETE

Deposit AUD to your account.

Maximum number of deposits with PENDING status is 5.

Create AUD Deposit

Example Request

curl https://secure.digitalsurge.com.au/api/private/wallet/AUD/deposits/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d amount=200 

Status codes

201 - Success

Example Response

{
  "id": 186,
  "identifier": "526877035",
  "static_identifier": "118269262",
  "amount": "200.00",
  "created": "2018-07-20T06:04:14",
  "closed": null,
  "status": "Pending",
  "auto_spend_price": null
}

POST https://secure.digitalsurge.com.au/api/private/wallet/AUD/deposits/

Cancel pending AUD Deposit

Example Request

curl -X DELETE https://secure.digitalsurge.com.au/api/private/wallet/AUD/deposits/186/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Status codes

200 - Success

Example Response

{
  "id": 186,
  "identifier": "526877035",
  "static_identifier": "118269262",
  "amount": "200.00",
  "created": "2018-07-20T06:04:14",
  "closed": "2018-07-20T06:07:18",
  "status": "Canceled (by user)",
  "auto_spend_price": null
}

DELETE https://secure.digitalsurge.com.au/api/private/wallet/AUD/deposits/:deposit_id/

Cancel pending deposit to your AUD wallet.

AUD POLi Deposits

Base AUD POLi Deposits API URL

https://secure.digitalsurge.com.au/api/private/wallet/AUD/poli-deposits/

Allowed methods: POST, GET

Deposit AUD to your account with POLi internet bank payments.

You can also convert AUD to BTC when making a deposit.

Maximum number of deposits with PROCESSING status is 5.

All POLi deposits auto-expire in 10 minutes if Digital Surge doesn't receive a transaction confirmation from POLi.

Create AUD POLi Deposit

Example Request

curl https://secure.digitalsurge.com.au/api/private/wallet/AUD/poli-deposits/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d requested_amount=200 

Status codes

201 - Success

Example Response

{
  "id": 92,
  "poli_id": 996148103422,
  "requested_amount": "200.00",
  "amount": "197.50",
  "created": "2018-07-23T01:27:48",
  "closed": null,
  "status": "Processing...",
  "auto_spend_price": null,
  "navigate_URL": "https://txn.apac.paywithpoli.com/?Token=fR2DLOGafrq0dqUCe1T9wqkdODdhq347",
  "poli_error_message": null
}

POST https://secure.digitalsurge.com.au/api/private/wallet/AUD/poli-deposits/

Simply specify AUD amount to be deposited with a request_amount data parameter. You will receive a response object containing a generated navigate_URL to POLi processing website.

If you would like to convert your deposit to BTC right after successful transaction, please specify auto_spend_price which should a BTC price at the moment of request.

List AUD POLi deposits

Example Request

curl "https://secure.digitalsurge.com.au/api/private/wallet/AUD/poli-deposits/?page=1&page_size=3&status=50" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" 

Example Response

{
  "count": 10,
  "next": "https://secure.digitalsurge.com.au/api/private/wallet/AUD/poli-deposits/?page=2&page_size=3&status=50",
  "previous": null,
  "results": [
    {
      "id": 92,
      "poli_id": 996148103422,
      "requested_amount": "200.00",
      "amount": "197.50",
      "created": "2018-07-23T01:27:48",
      "closed": "2018-07-23T01:54:24",
      "status": "Expired (by system)",
      "auto_spend_price": null,
      "navigate_URL": "https://txn.apac.paywithpoli.com/?Token=fR2DLOGafrq0dqUCe1T9wqkdODdhq347",
      "poli_error_message": ""
    },
    {
      "id": 91,
      "poli_id": 996148103151,
      "requested_amount": "500.00",
      "amount": "496.70",
      "created": "2018-07-23T00:37:46",
      "closed": "2018-07-23T01:04:21",
      "status": "Expired (by system)",
      "auto_spend_price": null,
      "navigate_URL": "https://txn.apac.paywithpoli.com/?Token=0jlDv3Tm78C%2f1gJyh2cj8zcCFfSSF21%2b",
      "poli_error_message": ""
    },
    {
      "id": 90,
      "poli_id": 996148103142,
      "requested_amount": "777.00",
      "amount": "773.70",
      "created": "2018-07-23T00:36:18",
      "closed": "2018-07-23T01:04:22",
      "status": "Expired (by system)",
      "auto_spend_price": null,
      "navigate_URL": "https://txn.apac.paywithpoli.com/?Token=D4ii8jvKTVuoHrdt0w1u%2bsoWuVG5DMWb",
      "poli_error_message": ""
    }
  ]
}

GET https://secure.digitalsurge.com.au/api/private/wallet/AUD/poli-deposits/

List your AUD POLi deposits.

You can filter deposits by status:

Status Value
Unknown 10
Unknown 20
Canceled by user 30
Unknown 40
Expired by system 50
TODO OTHER_STATUSES

Retrieve AUD POLi deposit

Example Request

curl https://secure.digitalsurge.com.au/api/private/wallet/AUD/poli-deposits/96/ \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" 

Example Response

{
  "id": 96,
  "poli_id": 996148103452,
  "requested_amount": "300.00",
  "amount": "296.70",
  "created": "2018-07-23T01:33:20",
  "closed": null,
  "status": "Processing...",
  "auto_spend_price": "1000.00",
  "navigate_URL": "https://txn.apac.paywithpoli.com/?Token=WbVzdM0hCVhuQzweVO%2bd1y40GSsaI0W7",
  "poli_error_message": null
}

GET https://secure.digitalsurge.com.au/api/private/wallet/AUD/poli-deposits/:deposit_id/

Retrieve your AUD POLi deposit by its ID.

AUD Wallet

Withdrawals

GET https://secure.digitalsurge.com.au/api/private/wallet/AUD/withdrawals/

Wallet Transactions

GET https://secure.digitalsurge.com.au/api/private/wallet/AUD/wallet-transactions/

Bank Accounts

GET https://secure.digitalsurge.com.au/api/private/wallet/AUD/bank-accounts/

BTC Wallet

Deposits

GET https://secure.digitalsurge.com.au/api/private/wallet/BTC/deposits/

Withdrawals

GET https://secure.digitalsurge.com.au/api/private/wallet/BTC/withdrawals/

Wallet Transactions

GET https://secure.digitalsurge.com.au/api/private/wallet/BTC/wallet-transactions/

Withdrawal Address Book

GET https://secure.digitalsurge.com.au/api/private/wallet/BTC/withdrawal-address-book/

Deposit Addresses

GET https://secure.digitalsurge.com.au/api/private/wallet/BTC/deposit-addresses/

BPAY Payments

GET https://secure.digitalsurge.com.au/api/private/wallet/BTC/bpay-payments/