HTTP Status Codes

The BitGo API returns the following HTTP status codes:

HTTP StatusMeaningDescription
200SuccessThe operation succeeded
201CreatedA new object was created
202AcceptedThe operation succeeded, but requires approval (e.g., sending funds)
206Partial ContentThe server is delivering only part of the resource.
400Bad RequestThe client request is invalid
401UnauthorizedAuthentication failed (e.g., invalid token specified by the Authorization header)
403ForbiddenAuthentication failed, but the operation is not allowed
404Not FoundRequested resource does not exist
429Too Many RequestsClient request rate exceeded the limit

Error Handling

When the server returns a 4xx status code, the response body contains an error object with the following structure:

1 2 3 4 5 { "error": "invalid wallet id", "name": "InvalidWalletId", "requestId": "cjo7uw7si0buzttlmazmvthay" }

The name value is an error code that does not change. The error value is a human-readable message which may change.

Pagination

Certain routes, such as listing wallets or transactions, may return an array of results and require pagination.

By default, the API returns 25 results per request. The limit parameter can be used to increase the number of results per request, up to a maximum of 500.

To get the next batch of results, call the same route again with a prevId request parameter corresponding to the nextBatchPrevId property received in the last call.

1 2 3 4 5 6 7 8 bitgo .coin('tbtc') .wallets() .list({ limit: 50 }) .then(function (wallets) { // print wallet list console.dir(wallets); });
1 2 3 curl \ -H "Authorization: Bearer $ACCESS_TOKEN" \ https://app.bitgo-test.com/api/v2/tbtc/wallet?limit=50

Example JSON Response:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 { "coin": "tbtc", "wallets": [ { "_wallet": { "id": "585a0860c5a04c696edd2c331ce2f346", "coin": "tbtc", "label": "V2 TBTC Test Wallet", ... } }, ... ], "count": 50, "nextBatchPrevId": "590b73478c8fc40727b0c3d421ec909c" }

Balance Strings

For most digital currencies, the wallet, transaction, and address objects have balance properties that return an integer value. But some currencies have ranges that exceed values that can be stored as a typical number in JavaScript.

In BitGo Platform V2, balance properties with a string data type were added for all digital currencies (and have the suffix, String). BitGo recommends that you use string balances for all currencies (and not number) to ensure values do not exceed the programmable number limit.

IntegerString (recommended)
balancebalanceString
confirmedBalanceconfirmedBalanceString
spendableBalancespendableBalanceString

BitGo UTXO Library

The BitGo UTXO Library (@bitgo/utxo-lib) is an open source library for UTXO transaction building and does not require a BitGo account or the BitGo SDK to be used. The library allows any developer working with UTXO-based blockchains to easily build and sign their own transactions.

For more, see the BitGo UTXO Library.