Liquid API
Search…
OAuth
Third party services can access Liquid resources and information, on behalf of Liquid users.

OAuth Application

To use OAuth services, an OAuthApplication must be created. Contact Liquid partner services to apply.

OAuth Request

Create an empty OAuth request.
Request
Response
1
POST /system/oauth_requests
2
3
X-Quoine-Auth: {(OAuth Approved, External App) User Token}
4
{
5
external_ref: "external reference, not used by liquid"
6
}
Copied!
1
200
2
{
3
oauth_request_public_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
4
oauth_request_private_id: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
5
expires: "{oauth_request.expires}",
6
app_challenge_href:
7
"https://app.liquid.com/oauth?ref=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
8
api_challenge_href:
9
"https://api.liquid.com/oauth/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/approve"
10
}
Copied!

User Approval

The response to the OAuthRequest returns app_challenge_href which is a URL that will prompt the user to approve the request.

Create and Sign OAuth JWT

After an OAuthRequest is approved by the user, the associated oauth_request_public_id and oauth_request_private_id can then be used in a JWT to access services on behalf of that user.
1
function createJwt(path, liquid_token_id, liquid_token_secret, oauth_request_public_id, oauth_request_private_id) {
2
return jwt.encode(
3
{
4
token_id: liquid_token_id,
5
path: path,
6
nonce: Date.now(),
7
oauth_request_public_id: oauth_request_public_id,
8
oauth_request_private_id: oauth_request_private_id
9
},
10
liquid_token_secret
11
);
12
}
Copied!

Fetch User Information

Request
Response
1
GET https://api.liquid.com/user/context
2
X-Quoine-Auth: createJwt('/user/context', ...)
Copied!
1
200
2
{
3
"user_id": number;
4
"token_id": string;
5
"trading_account_ids": Array<number>,
6
"app_vendor_id": number;
7
"country": string;
8
"status": LIQUID_USER_KYC_STATUS;
9
"currency": string;
10
"language": string;
11
"user_type": string;
12
"has_proof_address":true,
13
"has_id_document":true,
14
"avatar":null,
15
"affiliate_code": string;
16
"is_fully_verified":true,
17
"email_confirmed_at": number;
18
"declined_reason":null,
19
"modules":{[module: string]: Array<string>},
20
"first_name": string;
21
"last_name": string;
22
"email": string;
23
"permissions": Array<string>;
24
}
Copied!

Fetch User Accounts

Request
Response
1
GET https://api.liquid.com/accounts
2
X-Quoine-Auth: createJwt('/accounts', ...)
Copied!
1
200
2
{
3
"crypto_accounts": [
4
{
5
"id": 1111,
6
"currency": "BTC",
7
"balance": "0.06",
8
"reserved_balance": "0.0",
9
"pusher_channel": "user_1111_account_btc",
10
"lowest_offer_interest_rate": "0.00002",
11
"highest_offer_interest_rate": "0.00200",
12
"address": "1FePLaYMejoo37CjLyzovJGMVTPPGQ3SVM",
13
"currency_symbol": "₿",
14
"minimum_withdraw": "0.02",
15
"currency_type": "crypto"
16
}
17
],
18
"fiat_accounts": [
19
{
20
"id": 979984,
21
"currency": "USD",
22
"balance": "0.00726",
23
"reserved_balance": "0.0",
24
"pusher_channel": "user_1111_account_usd",
25
"lowest_offer_interest_rate": null,
26
"highest_offer_interest_rate": null,
27
"currency_symbol": "quot;,
28
"send_to_btc_address": null,
29
"exchange_rate": "1.0",
30
"currency_type": "fiat"
31
}
32
]
33
}
Copied!
Last modified 11mo ago