Account
GET /v1/user/accounts
Get list of user accounts.
- HTTP
- Python
curl -H "Authorization: Bearer {{access_token}}" -X GET "$ETHGAS_API_URL/v1/user/accounts"
import requests
url = f"{ETHGAS_API_URL}/v1/user/accounts"
headers = {
'Authorization': 'Bearer <your-auth-token>'
}
response = requests.get(url, headers=headers)
print(response.text)
Request
No parameters for this endpoint.
Response Body
| Name | Type | Description |
|---|---|---|
| accounts | array of object | List of account objects |
| └ accountId | integer | Unique ID for each of the user's current & trading accounts assigned by ETHGas |
| └ userId | integer | Unique ID for the user, assigned by ETHGas |
| └ type | integer | Account type: 1 for current account, 2 for preconf trading account |
| └ name | string | Account name |
| └ status | integer | Account status: All active accounts have status 1 |
| └ updateDate | integer | Datetime (in UNIX time) last calculated |
| └ tokens | object[] | List of tokens in account |
| └└ accountId | integer | Unique ID for each of the user's current & trading accounts |
| └└ tokenId | integer | ETHGas Token ID (see Token IDs) |
| └└ quantity | string | Amount of token in account in USD |
| └└ lockedQuantity | string | Amount covering pending limit orders |
| └└ code | string | Token code |
| └└ availableQuantity | string | Available quantity for collateral or transfer |
Example Response
{
"success": true,
"data": {
"accounts": [
{
"accountId": 127,
"userId": 31,
"type": 1,
"name": "Current",
"status": 1,
"updateDate": 1672903708000,
"tokens": [
{
"accountId": 127,
"tokenId": 1,
"quantity": "0.01",
"lockedQuantity": "0",
"code": "ETH",
"availableQuantity": "0.01"
}
]
},
{
"accountId": 128,
"userId": 31,
"type": 2,
"name": "Preconf",
"status": 1,
"updateDate": 1697445293000,
"tokens": [
{
"accountId": 128,
"tokenId": 1,
"quantity": "9999993311.53",
"lockedQuantity": "1.5628",
"code": "ETH",
"availableQuantity": "9999993309.97"
}
]
}
]
}
}
GET /v1/user/account/:accountId
Get account details for a given account ID.
- HTTP
- Python
curl -H "Authorization: Bearer {{access_token}}" -X GET "$ETHGAS_API_URL/v1/user/account/128"
import requests
account_id = 128
url = f"{ETHGAS_API_URL}/v1/user/account/" + str(account_id)
headers = {
'Authorization': 'Bearer <your-auth-token>'
}
response = requests.get(url, headers=headers)
print(response.text)
Request
| Parameter | Required | Type | Description |
|---|---|---|---|
| accountId | YES | integer | Account ID |
Response Body
| Name | Type | Description |
|---|---|---|
| account | object | Account object |
| └ accountId | integer | Unique ID for each of the user's current & trading accounts |
| └ userId | integer | Unique ID for the user |
| └ type | integer | Account type: 1 for current account, 2 for trading account |
| └ name | string | Account name |
| └ status | integer | Account status: All active accounts have status 1 |
| └ updateDate | integer | Datetime (in UNIX time) last calculated |
| └ tokens | object[] | List of tokens in account |
| └└ tokenId | integer | ETHGas Token ID |
| └└ quantity | string | Amount of token in account |
| └└ lockedQuantity | string | Amount covering pending limit orders |
| └└ code | string | Token code |
| └└ availableQuantity | string | Available quantity |
GET /v1/user/account/:accountId/txs
Get account transactions for a given account ID.
- HTTP
- Python
curl -H "Authorization: Bearer {{access_token}}" -X GET "$ETHGAS_API_URL/v1/user/account/128/txs"
import requests
account_id = 128
url = f"{ETHGAS_API_URL}/v1/user/account/" + str(account_id) + "/txs"
headers = {
'Authorization': 'Bearer <your-auth-token>'
}
response = requests.get(url, headers=headers)
print(response.text)
Request
| Parameter | Required | Type | Description |
|---|---|---|---|
| accountId | YES | integer | Account ID |
| type | NO | string | Transaction type (comma-separated for multiple types) |
| startId | NO | integer | Start of transaction ID |
| limit | NO | integer | Max number of transactions to return |
Response Body
| Name | Type | Description |
|---|---|---|
| txs | object[] | List of transaction objects |
| └ trxId | integer | Unique ID for the transaction |
| └ accountId | integer | Account ID |
| └ tokenId | integer | ETHGas Token ID |
| └ type | integer | Transaction type (see Transaction Types) |
| └ quantity | string | Transaction quantity |
| └ balance | string | Balance of account after transaction |
| └ createDate | integer | Transaction datetime stamp (in UNIX time) |
GET /v1/user/account/txs
Get account transactions for the current user.
- HTTP
- Python
curl -H "Authorization: Bearer {{access_token}}" -X GET "$ETHGAS_API_URL/v1/user/account/txs"
import requests
url = f"{ETHGAS_API_URL}/v1/user/account/txs"
headers = {
'Authorization': 'Bearer <your-auth-token>'
}
response = requests.get(url, headers=headers)
print(response.text)
Request
| Parameter | Required | Type | Description |
|---|---|---|---|
| type | NO | string | Transaction type (comma-separated for multiple types) |
| startId | NO | integer | Start of transaction ID |
| limit | NO | integer | Max number of transactions to return (default: 20, max: 100) |
Response Body
| Name | Type | Description |
|---|---|---|
| txs | object[] | List of transaction objects |
| └ trxId | integer | Unique ID for the transaction |
| └ accountId | integer | Account ID |
| └ tokenId | integer | ETHGas Token ID |
| └ type | integer | Transaction type |
| └ quantity | string | Transaction quantity |
| └ balance | string | Balance of account after transaction |
| └ createDate | integer | Transaction datetime stamp (in UNIX time) |
POST /v1/user/account/transfer/token
Transfer token between accounts.
- HTTP
- Python
curl -H "Authorization: Bearer {{access_token}}" -X POST "$ETHGAS_API_URL/v1/user/account/transfer/token?fromAccountId=128&toAccountId=127&tokenId=1&quantity=0.01"
import requests
url = f"{ETHGAS_API_URL}/v1/user/account/transfer/token"
params = {
"fromAccountId": 128,
"toAccountId": 127,
"tokenId": 1,
"quantity": 0.01
}
headers = {
'Authorization': 'Bearer <your-auth-token>'
}
response = requests.post(url, headers=headers, params=params)
print(response.text)
Request
| Parameter | Required | Type | Description |
|---|---|---|---|
| fromAccountId | YES | integer | Source account ID |
| toAccountId | YES | integer | Destination account ID |
| tokenId | YES | integer | Token ID |
| quantity | YES | number | Quantity |
Response Body
| Name | Type | Description |
|---|---|---|
| data | object | Empty on success |