Skip to content

Commit d29dc6e

Browse files
authored
Merge pull request #328 from BitGo/update-bitgo-api-docs
Update API reference on BitGo Developer Portal
2 parents 07146ff + adf38b4 commit d29dc6e

1 file changed

Lines changed: 242 additions & 1 deletion

File tree

express-api.yaml

Lines changed: 242 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,12 +1262,188 @@ paths:
12621262
required:
12631263
- error
12641264
- details
1265+
/express/api/v1/wallets/simplecreate:
1266+
post:
1267+
summary: Create Wallet with Keychains
1268+
description: |-
1269+
Creates a new 2-of-3 multisignature wallet along with all three required keychains in a single
1270+
operation. This is a convenience method that handles the entire wallet setup process.
1271+
1272+
**WARNING: BE SURE TO BACKUP! NOT DOING SO CAN RESULT IN LOSS OF FUNDS!**
1273+
1274+
**Workflow:**
1275+
1. Creates the user keychain locally and encrypts it with the provided passphrase
1276+
2. Handles backup keychain based on parameters (see Backup Keychain Strategies below)
1277+
3. Uploads the encrypted user keychain and backup keychain xpub to BitGo
1278+
4. Creates the BitGo-managed keychain on the service
1279+
5. Creates the 2-of-3 multisig wallet on BitGo with all three public keys
1280+
1281+
**Backup Keychain Strategies:**
1282+
- **KRS Provider (Recommended)**: Set backupXpubProvider to use a Key Recovery Service (e.g., "keyternal")
1283+
- Creates instant-capable wallets
1284+
- Professional key management
1285+
- Cannot be combined with backupXpub
1286+
- **External Xpub (Recommended)**: Provide backupXpub generated on a separate, secure machine
1287+
- Maximum security (keys never on same machine)
1288+
- You control the backup key
1289+
- Cannot be combined with backupXpubProvider
1290+
- **Local Generation (NOT RECOMMENDED)**: If neither backupXpub nor backupXpubProvider provided
1291+
- Creates backup key on same machine as user key (security risk)
1292+
- Response includes warning message and unencrypted backup xprv
1293+
- You MUST back up the backup keychain yourself
1294+
1295+
**Response:** Returns wallet object and all three keychains. If backup keychain was created
1296+
locally, response includes warning message and the backup keychain will contain xprv (which
1297+
you must securely back up). Otherwise, backup keychain only contains xpub.
1298+
operationId: express.v1.wallet.simplecreate
1299+
tags:
1300+
- Express
1301+
parameters: []
1302+
requestBody:
1303+
content:
1304+
application/json:
1305+
schema:
1306+
type: object
1307+
description: Wallet creation parameters including passphrase, label, and backup key configuration
1308+
properties:
1309+
passphrase:
1310+
type: string
1311+
description: Wallet passphrase to encrypt user and backup keys with (required)
1312+
label:
1313+
type: string
1314+
description: Wallet label shown in BitGo UI
1315+
backupXpub:
1316+
type: string
1317+
description: Backup keychain xpub generated on a separate machine (HIGHLY RECOMMENDED for security - cannot be used with backupXpubProvider)
1318+
backupXpubProvider:
1319+
type: string
1320+
description: Key Recovery Service provider for backup key, e.g. "keyternal" (creates instant-capable wallet - cannot be used with backupXpub)
1321+
enterprise:
1322+
type: string
1323+
description: Enterprise ID to create wallet under
1324+
passcodeEncryptionCode:
1325+
type: string
1326+
description: Code used to encrypt the wallet passcode for the recovery process
1327+
disableTransactionNotifications:
1328+
type: boolean
1329+
description: Disable transaction notifications for this wallet
1330+
disableKRSEmail:
1331+
type: boolean
1332+
description: Disable KRS email notifications (only applicable when using backupXpubProvider)
1333+
required:
1334+
- passphrase
1335+
responses:
1336+
'200':
1337+
description: OK
1338+
content:
1339+
application/json:
1340+
schema:
1341+
$ref: '#/components/schemas/SimpleCreateResponse'
1342+
'400':
1343+
description: Bad Request
1344+
content:
1345+
application/json:
1346+
schema:
1347+
$ref: '#/components/schemas/BitgoExpressError'
1348+
/express/api/v1/walletshare/{shareId}/acceptShare:
1349+
post:
1350+
summary: Accept a Wallet Share
1351+
description: |-
1352+
Accepts a wallet share invitation from another user, granting access to the shared wallet
1353+
according to the permissions specified by the sharing user.
1354+
1355+
## Wallet Share Permissions
1356+
- **View**: Read-only access to wallet information and transactions
1357+
- **Spend**: Ability to create and sign transactions
1358+
- **Admin**: Full control including user management and settings
1359+
1360+
## Acceptance Workflow
1361+
1362+
The acceptance process varies based on the share type:
1363+
1364+
### 1. View-Only Shares
1365+
No encryption processing needed. The share is accepted immediately without requiring userPassword.
1366+
1367+
### 2. Spend/Admin Shares with Keychain (Standard Path)
1368+
Uses ECDH (Elliptic Curve Diffie-Hellman) key sharing:
1369+
- Requires `userPassword` to decrypt your ECDH keychain
1370+
- Derives a shared secret between you and the sharing user
1371+
- Decrypts the shared wallet keys using this secret
1372+
- Re-encrypts the keys with `newWalletPassphrase` (or `userPassword` if not specified)
1373+
- Stores the encrypted keys for future wallet operations
1374+
1375+
### 3. Override Path (Out-of-Band Key Exchange)
1376+
When `overrideEncryptedXprv` is provided:
1377+
- Bypasses the ECDH key derivation process
1378+
- Uses the pre-encrypted xprv directly
1379+
- No password required (keys are already encrypted)
1380+
1381+
## Security Notes
1382+
- `userPassword` must match your BitGo account password
1383+
- `newWalletPassphrase` should be strong and securely stored
1384+
- The ECDH key exchange ensures only the intended recipient can decrypt the wallet keys
1385+
- `overrideEncryptedXprv` should only be used for keys received through a separate secure channel
1386+
operationId: express.v1.wallet.acceptShare
1387+
tags:
1388+
- Express
1389+
parameters:
1390+
- name: shareId
1391+
description: ID of the wallet share to accept
1392+
in: path
1393+
required: true
1394+
schema:
1395+
type: string
1396+
requestBody:
1397+
content:
1398+
application/json:
1399+
schema:
1400+
type: object
1401+
description: Credentials and configuration for accepting the wallet share
1402+
properties:
1403+
userPassword:
1404+
type: string
1405+
description: |-
1406+
User's password for authentication.
1407+
Required when accepting shares with spend/admin permissions that include encrypted keychains,
1408+
unless overrideEncryptedXprv is provided. Used to decrypt the user's ECDH keychain
1409+
for deriving the shared secret that decrypts the shared wallet keys.
1410+
newWalletPassphrase:
1411+
type: string
1412+
description: |-
1413+
New passphrase to encrypt the shared wallet keys with.
1414+
If not provided, defaults to userPassword. This passphrase will be required
1415+
for future wallet operations that need to decrypt the wallet keys.
1416+
Only applicable when accepting shares with encrypted keychains.
1417+
overrideEncryptedXprv:
1418+
type: string
1419+
description: |-
1420+
Pre-encrypted wallet xprv received through an out-of-band secure channel.
1421+
When provided, bypasses the ECDH key derivation and decryption process.
1422+
Use this only if you received the encrypted key separately from the share invitation.
1423+
The xprv must already be encrypted with your desired passphrase.
1424+
responses:
1425+
'200':
1426+
description: OK
1427+
content:
1428+
application/json:
1429+
schema:
1430+
allOf:
1431+
- $ref: '#/components/schemas/AcceptShareResponse'
1432+
description: Successfully accepted wallet share
1433+
'400':
1434+
description: Bad Request
1435+
content:
1436+
application/json:
1437+
schema:
1438+
allOf:
1439+
- $ref: '#/components/schemas/BitgoExpressError'
1440+
description: Error response
12651441
/api/v2/pingexpress:
12661442
get:
12671443
tags:
12681444
- Express
12691445
summary: Ping BitGo Express
1270-
operationId: express.ping
1446+
operationId: express.ping1
12711447
description: |
12721448
Ping bitgo express to ensure that it is still running. Unlike /ping, this does not try connecting to bitgo.com.
12731449
responses:
@@ -2383,6 +2559,26 @@ components:
23832559
- intentType
23842560
- txid
23852561
- $ref: '#/components/schemas/BaseIntent'
2562+
AcceptShareResponse:
2563+
title: AcceptShareResponse
2564+
type: object
2565+
description: Response from accepting a wallet share
2566+
properties:
2567+
changed:
2568+
type: boolean
2569+
description: |-
2570+
Indicates whether the share state was changed by this operation.
2571+
true: The share was successfully accepted (state changed from pending to accepted).
2572+
false: The share was already in the target state (already accepted).
2573+
state:
2574+
type: string
2575+
description: |-
2576+
Current state of the wallet share after the operation.
2577+
Possible values: 'accepted', 'rejected', 'active', 'pendingapproval', 'canceled'
2578+
Should be 'accepted' after a successful acceptance.
2579+
required:
2580+
- changed
2581+
- state
23862582
AccountBaseBuildOptions:
23872583
title: AccountBaseBuildOptions
23882584
type: object
@@ -2772,6 +2968,23 @@ components:
27722968
- btc
27732969
- tbtc4
27742970
description: This route is only available for Bitcoin.
2971+
BitgoExpressError:
2972+
title: BitgoExpressError
2973+
type: object
2974+
properties:
2975+
message:
2976+
type: string
2977+
name:
2978+
type: string
2979+
bitgoJsVersion:
2980+
type: string
2981+
bitgoExpressVersion:
2982+
type: string
2983+
required:
2984+
- message
2985+
- name
2986+
- bitgoJsVersion
2987+
- bitgoExpressVersion
27752988
BitgoKeychainType:
27762989
title: BitgoKeychainType
27772990
type: object
@@ -6394,6 +6607,34 @@ components:
63946607
- from
63956608
- to
63966609
- share
6610+
SimpleCreateResponse:
6611+
title: SimpleCreateResponse
6612+
type: object
6613+
properties:
6614+
wallet:
6615+
type: object
6616+
additionalProperties: {}
6617+
description: Newly created wallet model object with balance, label, keychains array, and other wallet properties
6618+
userKeychain:
6619+
type: object
6620+
additionalProperties: {}
6621+
description: User keychain with xpub and encryptedXprv (encrypted with passphrase, stored on BitGo)
6622+
backupKeychain:
6623+
type: object
6624+
additionalProperties: {}
6625+
description: Backup keychain with xpub (and xprv if created locally - must be backed up immediately)
6626+
bitgoKeychain:
6627+
type: object
6628+
additionalProperties: {}
6629+
description: BitGo-managed keychain with xpub (BitGo holds this key)
6630+
warning:
6631+
type: string
6632+
description: Warning message present only when backup keychain was created locally (has xprv) - reminds you to back it up
6633+
required:
6634+
- wallet
6635+
- userKeychain
6636+
- backupKeychain
6637+
- bitgoKeychain
63976638
SolBuildOptions:
63986639
title: SolBuildOptions
63996640
allOf:

0 commit comments

Comments
 (0)