Overview
REST API is a core building block of the TokenD platform. You can use it to retrieve information about your own TokenD account or to integrate TokenD into your own product. It's completely up to you and your custom use case.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119
Legend | Description |
---|---|
🔒 | Request requires signature (See signing requests) |
📄 | Request has pagination (See Pagination) |
Key components
Different APIs are exposed through single endpoint and might have different response and error formats, due to reasons ¯\_(ツ)_/¯
Key Server (KS)
It's primary goal is to provide means for wallet management like storing encrypted client keys, email verification and 2FA. It also could be used for auxilary tasks like document storage, backend for storing client settings and third-party integrations.
KS tries its best to follow JSONAPI. Most important parts of protocol will be included here, but to get better feel of what's going on it's advised to get yourself familiar with JSONAPI before continuing.
Resource | Endpoint | Description |
---|---|---|
Wallets | /wallets |
|
Users | /users |
|
2FA | /wallets/:wallet-id/factors |
|
Documents | /users/:address/documents |
|
Blobs | /users/:address/blobs |
|
Settings | /users/:address/settings |
Horizon
Horizon's RESTful API provides straightforward way to submit transactions and access indexed blockchain history.
Resource | Endpoint | Description |
---|---|---|
Accounts | /accounts |
|
Limits | /accounts/:id/limits |
|
Signers | /accounts/:id/signers |
|
KYC | /accounts/:id/account_kyc |
|
References | /account/:id/references |
|
Pending offers | /account/:id/offers |
|
Key-value | /key_value |
|
Transactions | /transactions |
|
Operations | /operations |
|
Payments | /payments |
|
Fees | /fees |
|
Assets | /assets |
|
Asset pairs | /asset_pairs |
|
Reviewable requests | /requests |
|
Sales | /sales |
Making requests
Each request must include correct content negotiation headers.
Signing requests
For the following request:
GET /users?type=2 HTTP/1.1
Host: api.tokend.io
Date: Sun, 05 Jan 2014 21:31:40 GMT
Signing string would be:
date: Sun, 05 Jan 2018 21:31:40 GMT
(request-target): get /users?type=2
For
SCDMOOXVNMO6SA22AYUMZDIGLDJMBUTVEGB73FFNTLFJILBJWIU4NQ3D
private key gives following signature string:
keyId="GBLTOG6EJS5OWDNQNSCEAVDNMPBY6F73XZHHKR27YE5AKE23ZZEXOLBK",algorithm="ed25519-sha256",signature="0cvTqLDn+5i8pInkeSR833HrNSMI4xB9m1eN7rofiDVnoutKQJvpwB9hl2GhsMPcMbVXo4beUR96Stf/qU+iAg==",headers="date (request-target)"
Request signature implementation is based on IETF HTTP Signatures draft RFC
except of implicit headers
parameter is not supported, clients must explicitly specify headers used for signing.
Only signature algorithm supported is ed25519-sha256
which uses public signer key as keyId
.
Both Signature
and Authorization
HTTP authentication schemas are supported.
The minimum recommended data to sign is the (request-header)
and date
.
Errors
API uses conventional HTTP response codes to indicate the success or failure of a request.
In general, codes in the 2xx
range indicate success, codes in the 4xx
range indicate an error that
failed given the information provided and codes in 5xx
range indicate an problem with TokenD servers.
General HTTP response status codes
If not stated otherwise client should expect one of the following status codes:
Status code | Description |
---|---|
200 OK | |
201 Created | |
204 No Content | The server successfully processed the request and is not returning any content |
400 Bad Request | Request was invalid in some way, response should contain details |
401 Unauthorized | Request signature was invalid or you are not authorized to access resource |
Application-specific error codes
Error code | Description |
---|---|
tfa_required |
See docs section for details |
verification_required |
Wallet with verified email is required before proceeding |
User flows
Sign up
const { mainWallet } = await sdk.api.wallets.create('alice@mail.com', 'p@ssw0rd')
sdk.useWallet(mainWallet)
await sdk.api.wallets.verifyEmail('eyAic3RhdHVzIjoyMDAsImF...')
await sdk.api.users.create(wallet.accountId)
To have full access to the platform client should create own account entity. To achieve that following steps must be completed:
- create wallet
- depending on platform settings additional verification may be required, see email verification for details.
- create user in KS which will also create account resource with same identifier
Email verification
In some TokenD systems email verification is required. If so then attempt to get user's wallet will be failed with 403 Forbidden
error.
To verify email user have to follow the link in the verification message. Verification link contains client router payload with meta fields token
and wallet_id
. Use this values for the wallet verification request.
Sign in
const wallet = await sdk.api.wallets.get('alice@mail.com', 'p@ssw0rd')
sdk.useWallet(wallet)
Sign in process is basically acquiring client's signing key from encrypted keychain data.
- get KDF parameters for existing wallet
- derive wallet ID using email and password
- get wallet with encrypted keychain data
- decrypt keychain data
Javascript SDK makes this flow easier by encapsulating this actions.
Client redirects
link format
http://client.com/r/eyAic3RhdHVzIjoyMDAsImF...G4zbmZqbWZ4OXA1OGdlbzVzdHQ5In19
decoded value
{
"status": 200,
"type": 1,
"meta": {
"token": "JOqIgfCNSjnGWDrTPWbW",
"wallet_id": "388108095960430b80554ac3efb6807a9f286854033aca47f6f466094ab50876"
}
}
const encodedAction = window.location.href.split(/r/)[1]
const action = atob(encodedAction)
switch (action.type) {
case 1:
// handle action here
break
default:
throw new Error('Unknown action')
}
Field | Description |
---|---|
status |
Action result code following HTTP status code semantics, might be omitted if 200 |
type |
Redirect type |
meta |
Types specific meta-information, might be omitted if empty |
Redirect types
Type | Description |
---|---|
1 |
Email confirmation token, meta will include verification token and wallet_id |
Pagination
Pagination is a dividing request result into pages. It is used for requests with a lot of data to return.
Every paged response is wrapped in the page structure. In the _links
object it has http links to next, previous and current pages. In the _embedded
object it has the actual response data, the set of items stored in is's records
property.
GET /paged_request HTTP/1.1
Content-Type: application/json
{
"_links": {
"self": {
"href": "http://api.com/paged_request?order=asc\u0026limit=10\u0026cursor="
},
"next": {
"href": "http://api.com/paged_request?order=asc\u0026limit=10\u0026cursor=877582077661184"
},
"prev": {
"href": "http://api.com/paged_request?order=desc\u0026limit=10\u0026cursor=869906971103232"
}
},
"_embedded": {
"records": [
...
]
}
}
Every paged request accepts the following query params:
Parameter | Type | Default | Description |
---|---|---|---|
order | string | asc | asc or desc . Used to specify items order which is usually based on the item creation time |
limit | integer | 10 | Used to specify number of items in the page. Maximum value is 200 |
cursor | integer | Used to specify the start of the page. For example, if the last item of the current page has paging_token=10 then you have to use cursor=10 to request the new one |
To load all the data just follow next
links or modify cursor
param manually as long as records
size is equals to the limit
. Lower size means that there is no more data and the current page is the last one.
Ledger index
🔒 📄 Get operations
GET /operations/ HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"_links": {
...
},
"id": "6850472841217",
"paging_token": "6850472841217",
"transaction_id": "6850472841216",
"source_account": "GDA3SCPLGNMXAARU5XXHNIUCHG554TESWZOKQZL4EOY2HPJRPLMW7VEB",
"type": "set_options",
"type_i": 2,
"state_i": 2,
"state": "success",
"identifier": "0",
"ledger_close_time": "2018-01-28T18:30:02Z",
"participants": [
{
"account_id": "GDA3SCPLGNMXAARU5XXHNIUCHG554TESWZOKQZL4EOY2HPJRPLMW7VEB"
}
],
"operation_fee": "0.000000",
"signer_key": "GDSX33LI6O2LJABPTH2QBXJCZJNTLHZ4KA7LS2N5VMCOTYNS6W3CWQ6Y",
"signer_weight": 255,
"signer_type": 2147483647,
"signer_identity": 1
},
...
]
}
}
Returns list of operations
Query params
Parameter | Type | Default | Description |
---|---|---|---|
reference | string | If present, the result will contain only operation with specific reference or empty page if it was not found | |
account_id | string | If present, the result will contain only operations related to this account | |
since | string | Should be valid ISO 8601 string. If present, the result will contain only operations that was submitted after specific date |
|
to | string | Should be valid ISO 8601 string. If present, the result will contain only operations that was submitted before specific date |
|
completed_only | boolean | true | If present, the result will contain only operation with success/failed state (deposits/withdrawals/offers can have different states) |
skip_canceled | boolean | If present, the result will include operations with canceled state (offers can be canceled) | |
pending_only | boolean | false | If present, the result will contain only operation with success/failed state (deposits/withdrawals/offers can have different states) |
account_type | integer | If present, the result will contain only operations related to accounts with current type equals to the specified |
The request returns data in multiple pages, for more information, see Pagination
📄 Get public operations
GET public/operations HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"_links": {
...
},
"id": "6850472841217",
"paging_token": "6850472841217",
"transaction_id": "6850472841216",
"type": "set_options",
"type_i": 2,
"state_i": 2,
"state": "success",
"identifier": "0",
"ledger_close_time": "2018-01-28T18:30:02Z",
"operation_fee": "0.000000",
"signer_weight": 255,
"signer_type": 2147483647,
"signer_identity": 1
}
...
]
}
}
Returns list of operations without sensitive data
🔒 Get operation info by ID
GET /operations/68719480833 HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"id": "68719480833",
"paging_token": "68719480833",
"transaction_id": "68719480832",
"source_account": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"type": "manage_asset",
"type_i": 11,
"state_i": 2,
"state": "success",
"identifier": "0",
"ledger_close_time": "2018-04-07T17:40:11Z",
"participants": [
{
"account_id": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636"
}
],
"operation_fee": "0.000000",
"request_id": 0,
"action": 0,
"action_string": ""
}
Returns information about specific operation
Path params
Parameter | Description |
---|---|
id | The ID of the operation |
Get operation public info by ID
GET /public/operations/6850472841217 HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"id": "6850472841217",
"paging_token": "6850472841217",
"transaction_id": "6850472841216",
"type": "set_options",
"type_i": 2,
"state_i": 2,
"state": "success",
"identifier": "0",
"ledger_close_time": "2018-01-28T18:30:02Z",
"operation_fee": "0.000000",
"signer_weight": 255,
"signer_type": 2147483647,
"signer_identity": 1
}
Returns information about specific operation without sensitive info
🔒 📄 Get payments
GET /payments HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "681911957590017",
"paging_token": "681911957590017",
"transaction_id": "681911957590016",
"source_account": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"type": "create_issuance_request",
"type_i": 3,
"state_i": 2,
"state": "success",
"identifier": "13",
"ledger_close_time": "2018-05-19T19:07:09Z",
"participants": [
{
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
},
{
"account_id": "GCW3Y4ZOS3RN3VG62PF3YDSGJ7VC2HPZ5FCMFYIWBSOAIN6VOOKFDOEK",
"balance_id": "BDWCWE3YC6J4QKS5W5X3OQC47CGPH4JLU5IDY5QCHTX6GT3T54UWE3XA"
}
],
"reference": "some reference",
"amount": "123.000000",
"asset": "lazycat",
"fee_fixed": "0.000000",
"fee_percent": "0.000000",
"external_details": {}
},
{
"id": "735629113561089",
"paging_token": "735629113561089",
"transaction_id": "735629113561088",
"source_account": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"type": "payment_v2",
"type_i": 23,
"state_i": 2,
"state": "success",
"identifier": "0",
"ledger_close_time": "2018-05-20T12:29:36Z",
"participants": [
{
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"balance_id": "BBG5QP3T6BQJP7FWD6OMSONEZSIMAQJI44DJH6LSSRJUGVWJITNBNA4R"
},
{
"account_id": "GDRQSTLORA2KOPBELTTM2J4LQKZQQ7OIL6LE2DEMLUOLP572E2YTPROT",
"balance_id": "BA4VSN4C33YEC2RIEMVQJYPG4BWYJKJB3CS4UYC2BFQ44TW2FUTT5KYR"
}
],
"payment_id": 2,
"from": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"to": "GDRQSTLORA2KOPBELTTM2J4LQKZQQ7OIL6LE2DEMLUOLP572E2YTPROT",
"from_balance": "BBG5QP3T6BQJP7FWD6OMSONEZSIMAQJI44DJH6LSSRJUGVWJITNBNA4R",
"to_balance": "BA4VSN4C33YEC2RIEMVQJYPG4BWYJKJB3CS4UYC2BFQ44TW2FUTT5KYR",
"amount": "0.001000",
"asset": "USD4",
"source_fee_data": {
"actual_payment_fee": "0.000000",
"actual_payment_fee_asset_code": "USD4",
"fixed_fee": "0.000000"
},
"destination_fee_data": {
"actual_payment_fee": "0.000000",
"actual_payment_fee_asset_code": "USD4",
"fixed_fee": "0.000000"
},
"source_pays_for_dest": true,
"subject": "wqeqweq",
"reference": "",
"source_sent_universal": "0.000000"
}
]
}
}
Returns list of payments
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Default | Description |
---|---|---|---|
reference | string | If present, the result will contain only operation with specific reference or empty page if it was not foundaccount_id | |
balance_id | string | If present, the result will contain only operations for specific balance | |
asset | string | If present, the result will contain only operations for specific asset | |
tx_id | string | If present, the result will contain only operations from specific transaction with corresponding ID | |
reference | string | If present, the result will contain only operations with specific reference | |
since | string | Should be valid ISO 8601 string. If present, the result will contain only operations that was submitted after specific date |
|
to | string | Should be valid ISO 8601 string. If present, the result will contain only operations that was submitted before specific date |
|
completed_only | boolean | true | If present, the result will contain only operation with success/failed state (deposits/withdrawals/offers can have different states) |
skip_canceled | boolean | If present, the result will include operations with canceled state (offers can be canceled) | |
pending_only | boolean | false | If present, the result will contain only operation with success/failed state (deposits/withdrawals/offers can have different states) |
account_type | integer | If present, the result will contain only operations related to accounts with current type equals to the specified |
Wallets
Wallet exists purely on key server and it's purpose is to hold encrypted user data and provide additional authentication means like 2FA and email confirmations.
Wallets are identified by wallet ID derived from email and password.
Attributes
Field | Description |
---|---|
account_id |
unique identifier of user account generated during wallet creation |
email |
email address provided during wallet creation |
keychain_data |
arbitrary client-provided string, for details see keychain derivation |
Wallet ID derivation
digest = sha256(1 || salt || email) # where || is concatenation
key = scrypt(password, digest, kdfparams)
id = hmacsha256('WALLET_ID', key)
let kdf = await sdk.api.wallets.getKdfParams()
let salt = "aHR0cHM6Ly9iaXQubHkvMkl2ZDdGYw=="
let walletId = sdk.Wallet.deriveId('fo@ob.ar', 'p@ssw0rd', kdf.data, salt);
/* =>
5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6
*/
val email = "ole@mailinator.com"
val password = "123456".toCharArray()
val kdfAttributes = api
.wallets
.getLoginParams()
.execute()
.get()
.kdfAttributes
kdfAttributes.salt = WalletKeyDerivation.generateKdfSalt()
val walletId = WalletKeyDerivation.deriveAndEncodeWalletId(email, password, kdfAttributes)
Wallet ID is a SHA256 HMAC of scrypt key derived from wallet email and client generated salt.
Default KDF parameters provided by key server should be used for every new wallet ID and keychain derivations.
Wallet ID should be hex encoded.
Keychain derivation
digest = sha256(1 || salt || email) # where || is concatenation
key = scrypt(password, digest, kdfparams)
passphrase = hmacsha256('WALLET_KEY', key)
data = { accountId, seed }
IV, cipherText = encrypt("aes", "gcm", data, hmac)
keychain = {IV, cipherText, "aes", "gcm}
TODO
Keychain may be used to store wallet keys and any arbitrary, client-specific data.
Client should store at least accountId
and seed
to be able to login with email/password.
Get KDF params
let {data} = await sdk.api.wallets.getKdfParams()
/* =>
{
"id": "2",
"resourceType": "kdf",
"algorithm": "scrypt",
"bits": 256,
"n": 4096,
"r": 8,
"p": 1
}
*/
GET /kdf HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"data": {
"type": "kdf",
"id": "2",
"attributes": {
"algorithm": "scrypt",
"bits": 256,
"n": 4096,
"r": 8,
"p": 1
}
}
}
val defaultLoginParams = api
.wallets
.getLoginParams(
email = null,
isRecovery = false
)
.execute()
.get()
val userLoginParams = api
.wallets
.getLoginParams(
email = "ole@mailinator.com",
isRecovery = false
)
.execute()
.get()
let email = "ole@mailinator.com"
keyserverApi.requestWalletKDF(
email: email,
isRecovery: false,
completion: { (result) in
switch result {
case .failure(let error):
print(error)
case .success(let walletKDF):
let fetchedWalletKDF = walletKDF
}
})
Returns current default derivation parameters or parameters used to derive specific wallet.
request
Parameter | Required | Description |
---|---|---|
email |
f | will return KDF parameters for wallet keychain, 404 Not Found if email is unknown |
is_recovery |
f | boolean denoting if client wants to get KDF for recovery keychain |
response
Field | Description |
---|---|
id |
version of KDF parameters used to derive wallet data |
1 - means that wallet id should be calculated as is, without any formatting | |
2 - means that wallet id should be calculated with lowercased email | |
attributes |
KDF parameters which should be used for derivation |
Create wallet
let {wallet, recoverySeed} = await sdk.api.wallets.create('vasil@tokend.io', 'p@ssw0rd')
POST /wallets HTTP/1.1
Content-Type: application/json
{
"data": {
"id": "4fdf134f5d33982c117a20bf1e9866ffaab826d2f3eeed6c65b14998442a0526",
"attributes": {
"account_id": "GCBLMZGOAM5ZMYOSQVHW57NISOCHFE3ISXKOHZ43UBP3K6EMDEXLVCY2",
"email": "vasil@tokend.io",
"salt": "qonp0sJgd30NQ916fzpO2A==",
"keychain_data": "eyJJViI6IldsSkFUdEFydmljZTJjdWkiLCJjaXBoZXJUZXh0IjoiaGtFa2UzZlFSdVNFdTIzdVhhK0JFa2ZCQzFDL1ZqVXFydE9TUXMrU3hsOUkzSVRHWXNRTXVhRkI2eDVjaG1HZnM1U28zc0UwNDRWYXkrOFY1RWU2Nk5tNWlnemVIbjh5UENiNXFrYmd0V0E2SFNobmo2VUdMUVNlODN2MjJ6TnhGZ3R6VWtsMDFiS25RTmJIS3preEF6d1g2MVJxTlc0dS9iTmJWV1d1YU43TTZJYWZkaVBEV3B6MzFUdFJDT3grNFQzNHV6VUZ4QTloMUE9PSIsImNpcGhlck5hbWUiOiJhZXMiLCJtb2RlTmFtZSI6ImdjbSJ9"
},
"type": "wallet",
"relationships": {
"kdf": {
"data": {
"type": "kdf",
"id": "2"
}
},
"factor": {
"data": {
"type": "password",
"attributes": {
"account_id": "GBOZ32WRZENUCOHPVSCDUMGMPJRZV7WEOEZ4BIC4ITWPICIPGEYQMKEB",
"keychain_data": "eyJJViI6IndYeHJ4aHlLOFprV1JuZXYiLCJjaXBoZXJUZXh0IjoiaTM2dDRyZ1lOUUZ5VGNpSHNSOWRoVU5McUU3dGxqZVRpTVJORWFQTzloc3VxbDUreXBwc3g0Q0RZSlI2d0lEQVdsQVpJcEpNNGtlaitzMTRtZ0NuVTVRZTAwUlBXSm5INVlibWlWMnRjSWVKT1RXNy9sSmFpSHlsRWpKckpMa2VXN0lBaHR4SU5DbnhNZldIZjZGcUZvQktxRUtnNXNBTk9oOFVUdldxekk0T3hVNy9DM29wbkZpQ0Z4TElrY2RpQ0tGcGxhYXRqbWgxZXc9PSIsImNpcGhlck5hbWUiOiJhZXMiLCJtb2RlTmFtZSI6ImdjbSJ9",
"salt": "AmsucaCaXzVeeGaNU1emew=="
}
}
},
"recovery": {
"data": {
"type": "password",
"id": "b0a55d16f6bd6d92e0b891bba35b98b97271247f5f443d8a176c6e601a534b5e",
"attributes": {
"account_id": "GCR645KV4GLENGKH3QUB2OOZZRHZA6PIQGM24TSHN2BG2HIVZERJMDJX",
"keychain_data": "eyJJViI6IjlFN0ovQkwxRXNrZFVrQ0giLCJjaXBoZXJUZXh0IjoiVUlTZ3Z1bXIyOUZic1U1cElZb2ZBdWdoRTBydm9VdVF2aVRqMVpxTTZsZG5ERDdNaTI5dFplUlV3UUdiemFUOUpKQ2I5cFpLWnljOTVBMHFzb3JNS21rOE1LMG1ETU5KZG52SjFtbUE1SjJIUG9wM2lZVDJvQVRnRXczcmhHdE1jOXRTRWRqL1o5NjZGUEJEQUtpQWhla1dkMEtzb2M0V1I4MFdlbWh1b08rb2h4c2J0ajRzZ1QvRzVZM0EwWHJkNTZaT1lienV3Y2pMSXc9PSIsImNpcGhlck5hbWUiOiJhZXMiLCJtb2RlTmFtZSI6ImdjbSJ9",
"salt": "7gyTQ4paDohhWdLDP5FiRg=="
}
}
}
}
}
}
HTTP/1.1 201
Content-Type: application/json
{
"data": {
"type": "wallet",
"id": "4fdf134f5d33982c117a20bf1e9866ffaab826d2f3eeed6c65b14998442a0526",
"attributes": {
"account_id": "GCBLMZGOAM5ZMYOSQVHW57NISOCHFE3ISXKOHZ43UBP3K6EMDEXLVCY2",
"email": "vasil@tokend.io",
"keychain_data": "eyJJViI6IldsSkFUdEFydmljZTJjdWkiLCJjaXBoZXJUZXh0IjoiaGtFa2UzZlFSdVNFdTIzdVhhK0JFa2ZCQzFDL1ZqVXFydE9TUXMrU3hsOUkzSVRHWXNRTXVhRkI2eDVjaG1HZnM1U28zc0UwNDRWYXkrOFY1RWU2Nk5tNWlnemVIbjh5UENiNXFrYmd0V0E2SFNobmo2VUdMUVNlODN2MjJ6TnhGZ3R6VWtsMDFiS25RTmJIS3preEF6d1g2MVJxTlc0dS9iTmJWV1d1YU43TTZJYWZkaVBEV3B6MzFUdFJDT3grNFQzNHV6VUZ4QTloMUE9PSIsImNpcGhlck5hbWUiOiJhZXMiLCJtb2RlTmFtZSI6ImdjbSJ9",
"verified": false
},
"relationships": {}
}
}
val email = "ole@mailinator.com"
val password = "123456".toCharArray()
val keyServer = KeyServer(api.wallets)
try {
val (wallet, rootAccount, recoveryAccount) =
keyServer.createAndSaveWallet(email, password)
} catch (e: EmailAlreadyTakenException) {
// Email is already taken
}
Create wallet requests should contain following resources:
Wallet
Field | Description |
---|---|
id |
wallet ID |
account_id |
client-generated account address |
salt |
client-generated salt |
keychain_data |
encoded keychain data |
email |
wallet email address |
KDF
Field | Description |
---|---|
id |
version of KDF parameters used to derive wallet data |
Factor
Keychain derived using same email/password but with different account and salt. Used as second factor to confirm password possession.
Recovery
Keychain derived using email and recovery seed as password. Used to recover access to account if password were lost.
Response
Succeeded request will have response with current wallet state.
Wallet verification
PUT /wallets/4fdf134f5d33982c117a20bf1e9866ffaab826d2f3eeed6c65b14998442a0526/verification HTTP/1.1
Content-Type: application/json
{
"data": {
"attributes": {
"token": "JOqIgfCNSjnGWDrTPWbW"
}
}
}
HTTP/1.1 204
const actions = Object.freeze({
walletConfirmation: 1
})
const href = 'https://client.tokend.io/r/eyAic3RhdHVzIjoyMDAsImF...G4zbmZqbWZ4OXA1OGdlbzVzdHQ5In19'
const encodedAction = href.split('/r')[1]
const decodedAction = atob(encodedAction)
if (decodedAction.type === actions.walletConfirmation) {
await sdk.api.wallets.verifyEmail(encodedAction)
}
val walletId= "4fdf134f5d33982c117a20bf1e9866ffaab826d2f3eeed6c65b14998442a0526"
val token = "JOqIgfCNSjnGWDrTPWbW"
api
.wallets
.verify(walletId, token)
.execute()
PUT /wallets/:id/verification
Once wallet is created and verified
is false user should receive email with verification link with client router payload.
Field | Description |
---|---|
:id |
Related wallet id |
token |
Email verification token |
Requesting verification resend
POST /wallets/4fdf134f5d33982c117a20bf1e9866ffaab826d2f3eeed6c65b14998442a0526/verification HTTP/1.1
HTTP/1.1 204
const walletId = '4fdf134f5d33982c117a20bf1e9866ffaab826d2f3eeed6c65b14998442a0526'
await sdk.api.wallets.resendEmal(walletId)
val walletId= "4fdf134f5d33982c117a20bf1e9866ffaab826d2f3eeed6c65b14998442a0526"
api
.wallets
.requestVerification(walletId)
.execute()
POST /wallet/:id/verification
Field | Description |
---|---|
:id |
Related wallet id |
Rate limits may apply, instant delivery is not guaranteed.
Get Wallet
GET /wallets/8ba282a0ca7c096c702507b6ec6e0a4dd0d1b26d6c543469eb51e68e72bf4fba HTTP/1.1
HTTP/1.1 200
Content-Type: application/json
{
"data": {
"type": "wallet",
"id": "8ba282a0ca7c096c702507b6ec6e0a4dd0d1b26d6c543469eb51e68e72bf4fba",
"attributes": {
"account_id": "GBKPHVR3Q4ZSHHZJT4GZYGHIMVMJBJLC44TE37BJK276URNUPF5XVJ4V",
"email": "vasil@tokend.io",
"keychain_data": "eyJJViI6IlRaRHppWWRTNEdKMjBYbisiLCJjaXBoZXJUZXh0Ijoib1MwTjVpaE1qcEozNUlsTDJWd1FsTzFvODJpb0JwOVFHdkY1eVBqcWREQk5XR29FTmM4eUEzeGhVcSs2UW1IeVMwNysxVXlLd0lzSThxYzZFRk04TEtSNTBNZ0xSZVE1eFpjdFdKUlk4dGhhMFJtWHdteC9iWlBwQVBwekM5Y09LNUE1V3B2YitsSENhQU1VOEU2aDlxK0U2WjdWbTI3aDRJYkdRUlovQkk3MHNWRWVDOHVVN09DMXBHcExQMHh3aTUzQWtsZ1puclVoK3c9PSIsImNpcGhlck5hbWUiOiJhZXMiLCJtb2RlTmFtZSI6ImdjbSJ9",
"verified": true,
"last_sent_at": "2018-05-14T13:18:19.41825Z"
},
"relationships": {}
}
}
let wallet = await sdk.api.wallets.get('i.haz.teh.codez@gmail.com', 'i.haz.teh.codez@gmail.com')
console.log(wallet.secretSeed);
/* =>
SDHW3EV5FJ3OXGU533ADODLT4J2QV5U6NASTBX4A5ZHVAPRUHTZ2DQBO
*/
val email = "ole@mailinator.com"
val password = "123456".toCharArray()
val keyServer = KeyServer(api.wallets)
val walletInfo = keyServer.getWalletInfo(email, password)
GET /wallets/:id
Request params
Param | Description |
---|---|
:id |
wallet ID |
🔒 Update wallet
PUT /wallets/8ba282a0ca7c096c702507b6ec6e0a4dd0d1b26d6c543469eb51e68e72bf4fba HTTP/1.1
Content-Type: application/json
{
"data":{
"id":"47adbefa00e955d4c34772e0d6b0a97ff0ce4ddd47bce9d8bd97e63e4840938b",
"attributes":{
"account_id":"GBMXNDLN3KLPWOP2SMNVCWVU2FEJRLRFPDLRTES7WLISH4VRBB22GLPW",
"email":"vasil@tokend.io",
"salt":"r4oSHAtRALF8wdYdjNr1ZQ==",
"keychain_data":"eyJJViI6Ikh5NnhHdStTa3pSaCt6VE4iLCJjaXBoZXJUZXh0IjoiaUQ0V3kwN0Nob3ZMOUpaU1R5V2VtSkFvcGpWWDRISk1rOC84MjluUTFaeGljY0tMNUFIck9wbnBQSkZya3JNLytoeFBuSVZTNWw3UUxrRU55eEdKL0U0c2ZhUENRekt1MHh3NU5Zd2hmUHNmNkc3bSs4SSt0UXNwSFZjVlA4WlNicG9pWE9VT20ySEk5QTRDejdZMmZCbllzNGNibHpRbldQTStGbU1mcUwwblcyVWhMR1loSGVlbXEwU1dYRVBndjB4WWVsVHA1QUQ2eHc9PSIsImNpcGhlck5hbWUiOiJhZXMiLCJtb2RlTmFtZSI6ImdjbSJ9"
},
"type":"wallet",
"relationships":{
"transaction":{
"data":{
"attributes":{
"envelope":"AAAAAPS5PT9kSdTrENi5O28W3Xoepw1GSO0TgBcUmAo2SYfAAAAAAAAAAAAAAAAAAAAAAAAAAABbvcAaAAAAAAAAAAIAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAFl2jW3alvs5+pMbUVq00UiYriV41xmSX7LRI/KxCHWjAAAAAT////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABNkmHwAAAAEDTI5y0Hzj5AlypetThaUEa3dsm74xWh26RfAlE0e5CLZfiiUzz54i4ozFig1rfWrHc7CxOHs596FLgnvU1IcwD"
}
}
},
"kdf":{
"data":{
"type":"kdf",
"id":"2"
}
},
"factor":{
"data":{
"type":"password",
"attributes":{
"account_id":"GANIEAF4HDC5MMFKTW6JTKSEV3SIKUTK2JKNAG3VQIXXHREQ4OVODVDF",
"keychain_data":"eyJJViI6IjM3K0NESHhJTVpZM00rU1EiLCJjaXBoZXJUZXh0IjoiaGJmWFgzT3h0ODFSS0NxK1dBN2JzTmlYb3JMbzRSejNSSENRMFVsOGhOYUlnV1NJR1lhcXpsKzhoaml5R3plWWN0eUdCYXJzTHlXQkcrRlVucTZrSFdKRkY1WkF6cVBpZk9VOEN0VWdWaEVXUmxPdGV5M3FoWHFIajRMbFNBWUVUY21FTU9lK2E5Wkt3N1llb1laTlJjR1dTUEVDQ3prMTl0YVcweWZ0Z1dKSDE2STY4b2w1VmRlK3U2WWhCWlpVbE9samRVMEhueDlPSmc9PSIsImNpcGhlck5hbWUiOiJhZXMiLCJtb2RlTmFtZSI6ImdjbSJ9",
"salt":"0JObhkz7H5SfbhohOjIUpw=="
}
}
}
}
}
}
HTTP/1.1 204
// Recovery case
val email = "ole@mailinator.com"
val recoverySeed = "SDPRAYTCZ4BI4DQZQB3XJ6KROL5GVMRLICEXFNW7VCYUHMLAEAYVS3AC".toCharArray()
val newPassword = "123456".toCharArray()
// Create account from recovery seed
val currentAccount = Account.fromSecretSeed(recoverySeed)
// Get API instance signed with this account
val signedApi = getSignedApi(currentAccount)
val keyServer = KeyServer(signedApi.wallets)
// Get recovery wallet info
val walletInfo = keyServer.getWalletInfo(
login = email,
password = recoverySeed,
isRecovery = true
)
// Get signers
val signers = signedApi
.accounts
.getSigners(walletInfo.accountId)
.execute()
.get()
// Get network params
val netParams = signedApi
.general
.getSystemInfo()
.execute()
.get()
.toNetworkParams()
val loginParams = walletInfo.loginParams
// Create new wallet
val (newWallet, newAccount) = KeyServer.createWallet(email, newPassword,
loginParams)
// Create transaction for signers update
val transaction = KeyServer.createSignersUpdateTransaction(
networkParams = netParams,
originalAccountId = walletInfo.accountId,
currentAccount = currentAccount,
signers = signers,
newAccount = newAccount
// Add transaction as a wallet relation
wallet.addTransactionRelation(transaction)
// Update wallet by recovery wallet ID
keyServer.updateWallet(walletInfo.walletIdHex, newWallet)
PUT /wallets/:id
Request is similar to wallet create but also contains additional transaction
resource used to update account signers.
Transaction
Param | Description |
---|---|
envelope |
base64 encoded transaction envelope to update account signers |
To get more information about wallet update check out password change / recovery guide
Wallet changes will be commited only if blockchain transaction submission is successful.
Successful request might update wallet ID if new password were used during derivation
Users
Attributes
Field | Description |
---|---|
email |
email address provided during wallet creation |
state |
current user state, see below |
reject_reason |
current KYC request reject reason, if applicable |
recovery_address |
wallet recovery seed public key |
Types
Value | Filter |
---|---|
not_verified |
1 |
syndicate |
2 |
general |
4 |
States
Value | Filter | Description |
---|---|---|
nil |
1 | Initial user state |
waiting_for_approval |
2 | User is waiting for KYC approval |
approved |
4 | User has approved KYC |
rejected |
8 | User has rejected KYC |
🔒 Create user
PUT /users/GBT3XFWQUHUTKZMI22TVTWRA7UHV2LIO2BIFNRCH3CXWPYVYPTMXMDGC HTTP/1.1
HTTP/1.1 204
const id = 'GBT3XFWQUHUTKZMI22TVTWRA7UHV2LIO2BIFNRCH3CXWPYVYPTMXMDGC'
await sdk.api.users.create(id)
val id = "GBT3XFWQUHUTKZMI22TVTWRA7UHV2LIO2BIFNRCH3CXWPYVYPTMXMDGC"
signedApi
.users
.create(id, "not_verified")
.execute()
let accountId = "GBT3XFWQUHUTKZMI22TVTWRA7UHV2LIO2BIFNRCH3CXWPYVYPTMXMDGC"
usersApi.createUser(
accountId: accountId,
completion: { result in
switch result {
case .failure(let error):
print(error)
case .success:
print("User is successfully created")
}
})
PUT /users/:address
Parameters | Description |
---|---|
:address |
Account ID generated during wallet creation, it will be also used as ledger account identifier |
Only verified wallets are allowed to create user entity.
Request, if successful, will generate ledger account entity with the same address that will be used to perform transaction on blockchain.
🔒 Get user
GET /users/GBT3XFWQUHUTKZMI22TVTWRA7UHV2LIO2BIFNRCH3CXWPYVYPTMXMDGC HTTP/1.1
HTTP/1.1 200
Content-Type: application/vnd.api+json
{
"data": {
"type": "not_verified",
"id": "GD2LSPJ7MRE5J2YQ3C4TW3YW3V5B5JYNIZEO2E4AC4KJQCRWJGD4BQFE",
"attributes": {
"email": "vasil@tokend.io",
"state": "nil",
"recovery_address": "GCEAV6CDK2ASOB3CSMZMGSJ7KOFUQLV72DTULSFEPC5WKLD7YNFK5633",
"created_at": "2018-04-07T17:43:52.868157Z",
"updated_at": "2018-04-07T17:43:56Z",
"airdrop_state": "eligible"
},
"relationships": {}
}
}
const id = 'GBT3XFWQUHUTKZMI22TVTWRA7UHV2LIO2BIFNRCH3CXWPYVYPTMXMDGC'
const user = await sdk.api.users.get(id)
console.log(user.data)
/*
=> {
type: ...,
email: ...,
....
}
*/
val id = "GBT3XFWQUHUTKZMI22TVTWRA7UHV2LIO2BIFNRCH3CXWPYVYPTMXMDGC"
val user = signedApi
.users
.get(id)
.execute()
.get()
let accountId = "GBT3XFWQUHUTKZMI22TVTWRA7UHV2LIO2BIFNRCH3CXWPYVYPTMXMDGC"
usersApi.getUser(
accountId: accountId,
completion: { result in
switch result {
case .failure(let errors):
print(errors)
case .success(let userId):
let fetchedUserId = userId
}
})
GET /users/:address
Parameters | Description |
---|---|
:address |
Account ID generated during wallet creation, it will be also used as ledger account identifier |
Accounts
🔒 Get account by ID
GET /accounts/GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3 HTTP/1.1
Content-Type: application/json
{
"id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"is_blocked": false,
"block_reasons_i": 0,
"block_reasons": [],
"account_type_i": 6,
"account_type": "AccountTypeSyndicate",
"referrer": "",
"thresholds": {
"low_threshold": 0,
"med_threshold": 0,
"high_threshold": 0
},
"balances": [
{
"balance_id": "BC4KJXXXGWLOZPKOMFNV33XS3WWPD2STKMFWE5YBSL5P6AVWTJ4OLAZZ",
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"asset": "USD",
"balance": "0.000000",
"locked": "0.000000",
"require_review": false
},
{
"balance_id": "BDA5XOKOHG2IRYSDCU442GQKEPATIZP62QXFVCYR4J37O56WBJVV4OCH",
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"asset": "BTC",
"balance": "0.000000",
"locked": "0.000000",
"require_review": false
},
{
"balance_id": "BDHTFOKCCWSJKQV3M7YPISAXOSEU34VPN64WJ3FUJJXZDMFYLDDVJKRZ",
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"asset": "ETH",
"balance": "0.000000",
"locked": "0.000000",
"require_review": false
}
],
"signers": [
...
],
"policies": {
"account_policies_type_i": 0,
"account_policies_types": null
},
"account_kyc": {
"KYCData": {
"blob_id": "BQJYZCADPKJRNUBN33MFMOUTKSASBANFHYBGZSF25KRP372NLU4Q"
}
},
"external_system_accounts": [
{
"type": {
"name": "Bitcoin",
"value": 1
},
"data": "mqsJMEat8sJuEcYrxPfcheW47vTozMTV6D",
"asset_code": "BTC"
},
{
"type": {
"name": "Ethereum",
"value": 2
},
"data": "0xcA240552772229b5566a8A772F92158142f4f7aC",
"asset_code": "ETH"
},
{
"type": {
"value": 4
},
"data": "0x0C0f09adE81f1671a6a73755D504c7595b8dDc89",
"expires_at": "2018-08-18T17:30:37Z"
}
],
"referrals": []
}
const id = 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3'
const { data } = await sdk.horizon.accounts.get(id)
val id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
val account = signedApi
.accounts
.getById(id)
.execute()
.get()
let id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
tokenDApi.accountsApi.requestAccount(
accountId: id,
completion: { (result) in
switch result {
case .success(let account):
let fethedAccount = account
case .failure(let error):
print(error)
}
})
Return specific account by ID.
URL params
Parameter | Description |
---|---|
id | The ID of the account |
Get account ID by email
GET /user_id?email=ole21@mailinator.com HTTP/1.1
Content-Type: application/json
{"account_id":"GDPRXQXJSPVBVY4XHJORHPJFPEOTQUTF3AYHME2FH7CVQV5GO2BLIEO4"}
val email = ole21@mailinator.com
val accountId = api
.accounts
.getAccountIdByEmail(email)
.execute()
.get()
let email = "ole21@mailinator.com"
tokenDApi.generalApi.requestAccountId(
email: email,
completion: { (result) in
switch result {
case .succeeded(let accountId):
let fetchedAccountId = accountId
case .failed(let error):
print(error)
}
})
Returns ID of the account related to the given email.
Query params
Parameter | Type | Default | Description |
---|---|---|---|
string | The email of the account |
Get account limits
GET /account/GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3/limits HTTP/1.1
Content-Type: application/json
{
"limits": {
"daily_out": "100.000000",
"weekly_out": "200.000000",
"monthly_out": "300.000000",
"annual_out": "400.000000"
}
}
const id = 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3'
const { data } = await sdk.horizon.accounts.getLimits(id)
Returns limits imposed on specific account
URL params
Parameter | Description |
---|---|
id | The ID of the account |
Get account signers
GET /account/GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3/signers HTTP/1.1
Content-Type: application/json
{
"signers": [
{
"public_key": "GDTPGOO2N4PDZKR2BBHKEV6TE3BPGFRD4W5RVDRVXY7BGDCAPPOKGYCW",
"weight": 255,
"signer_type_i": 268435455,
"signer_types": [
{
"name": "SignerTypeReader",
"value": 1
},
{
"name": "SignerTypeNotVerifiedAccManager",
"value": 2
},
...
{
"name": "SignerTypeKeyValueManager",
"value": 134217728
}
],
"signer_identity": 0,
"signer_name": ""
},
{
"public_key": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"weight": 255,
"signer_type_i": 268435455,
"signer_types": [...],
"signer_identity": 0,
"signer_name": ""
}
]
}
const id = 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3
const { data } = await sdk.horizon.getSigners(id)
val id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
val signers = api
.accounts
.getSigners(id)
.execute()
.get()
let id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
tokenDApi.accountsApi.requestSigners(
accountId: id,
completion: { (result) in
switch result {
case .success(let response):
let signers = response.signers
case .failure(let error):
print(error)
}
})
Returns information about all account signers.
URL params
Parameter | Description |
---|---|
id | The ID of the account |
Get account signer by id
GET /account/GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3/signer/GDTPGOO2N4PDZKR2BBHKEV6TE3BPGFRD4W5RVDRVXY7BGDCAPPOKGYCW HTTP/1.1
Content-Type: application/json
{
"public_key": "GDTPGOO2N4PDZKR2BBHKEV6TE3BPGFRD4W5RVDRVXY7BGDCAPPOKGYCW",
"weight": 255,
"signer_type_i": 268435455,
"signer_types": [
{
"name": "SignerTypeReader",
"value": 1
},
{
"name": "SignerTypeNotVerifiedAccManager",
"value": 2
},
...
{
"name": "SignerTypeKeyValueManager",
"value": 134217728
}
],
"signer_identity": 0,
"signer_name": ""
}
const accountId = 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3'
const signerId = 'GDTPGOO2N4PDZKR2BBHKEV6TE3BPGFRD4W5RVDRVXY7BGDCAPPOKGYCW'
const { data } = await sdk.horizon.getSigner(signerId, accountId)
Returns information about specific account signer.
URL params
Parameter | Description |
---|---|
id | The ID of the account |
signer_id | The ID of the signer |
Get account KYC
GET /account/GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3/account_kyc HTTP/1.1
Content-Type: application/json
{
"KYCData": {
"blob_id": "CLHFZSU4WIQIVBVVT7QFDNWIH4LKF6NQOXUCDW5NJUH7MWWDRFIQ"
}
}
const accountId = 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3'
const { data } = await sdk.horizon.getAccountKyc(accountId)
Return KYC information for specific account. This request returns only blob_id
, which is actually a JSON sting, so to
get full KYC data, you'll need to perform one more request, see how to get blob from API
URL params
Parameter | Description |
---|---|
id | The ID of the account |
Get account balances
GET /account/GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3/balances HTTP/1.1
Content-Type: application/json
[
{
"balance_id": "BC4KJXXXGWLOZPKOMFNV33XS3WWPD2STKMFWE5YBSL5P6AVWTJ4OLAZZ",
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"asset": "USD",
"balance": "0.000000",
"locked": "0.000000",
"require_review": false
},
{
"balance_id": "BDA5XOKOHG2IRYSDCU442GQKEPATIZP62QXFVCYR4J37O56WBJVV4OCH",
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"asset": "BTC",
"balance": "0.000000",
"locked": "0.000000",
"require_review": false
},
{
"balance_id": "BDHTFOKCCWSJKQV3M7YPISAXOSEU34VPN64WJ3FUJJXZDMFYLDDVJKRZ",
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"asset": "ETH",
"balance": "0.000000",
"locked": "0.000000",
"require_review": false
}
]
const id = 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3'
const { data } = await sdk.horizon.accounts.getBalances(id)
val id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
val balances = api
.accounts
.getBalances(id)
.execute()
.get()
Returns account balances.
URL params
Parameter | Description |
---|---|
id | The ID of the account |
🔒 Get account balances details
GET /account/GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3/balances/details HTTP/1.1
Content-Type: application/json
[
{
"balance_id": "BBHGNOTSAF5Y6K7C3YDBV2SKGBTKDWQVJ2ATPRTOU764RRY3N5E2K3LK",
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"asset": "QTK",
"balance": "0.000000",
"locked": "0.000000",
"require_review": false,
"asset_details": {
"code": "QTK",
"owner": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"available_for_issuance": "0.000000",
"preissued_asset_signer": "GAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHV4",
"max_issuance_amount": "149680.000000",
"issued": "149680.000000",
"pending_issuance": "0.000000",
"policy": 1,
"policies": [
...
],
"details": {
"logo": {
"key": "dpurgh4infpebjhcost7fvn4glq422soy26drbdtzrif3llgki2pptpn",
"mime_type": "image/jpeg",
"name": "flat,800x800,070,f.jpg",
"type": ""
},
"name": "Q-Token",
"terms": {
"key": "dpurehuinfpebjhcost7fvjllw3uvis7fep7lgmm37fulzeefm7da2hg",
"mime_type": "image/jpeg",
"name": "flat,800x800,070,f.jpg",
"type": ""
}
},
"sales": [
...
]
},
"converted_balance": "0.000000",
"converted_locked": "0.000000",
"converted_to_asset": "USD"
}
]
const id = 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3'
const { data } = await sdk.horizon.accounts.getBalancesDetails(id)
val id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
val balances = api
.accounts
.getBalancesDetails(id)
.execute()
.get()
let id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
tokenDApi.balancesApi.requestDetails(
accountId: id,
completion: { (result) in
switch result {
case .success(let balances):
let fetchedBalances = balances
case.failure(let error):
print(error)
}
})
Returns extended account balances details. Includes asset details for every balance and sales created for this asset, if present.
URL params
Parameter | Description |
---|---|
id | The ID of the account |
🔒 📄 Get account operations
GET /account/GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3/operations HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "667072845582337",
"paging_token": "667072845582337",
"transaction_id": "667072845582336",
"source_account": "GA4CZMOLWKO6RBKT77V2W4JGKVKYHSUAATVDJYPUYVGTYQ7BLTVH5CBP",
"type": "create_account",
"type_i": 0,
"state_i": 2,
"state": "success",
"identifier": "0",
"ledger_close_time": "2018-05-19T14:19:11Z",
"participants": [
{
"account_id": "GA4CZMOLWKO6RBKT77V2W4JGKVKYHSUAATVDJYPUYVGTYQ7BLTVH5CBP"
},
{
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
}
],
"funder": "GA4CZMOLWKO6RBKT77V2W4JGKVKYHSUAATVDJYPUYVGTYQ7BLTVH5CBP",
"account": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"account_type": 5
},
{
"id": "668022033354753",
"paging_token": "668022033354753",
"transaction_id": "668022033354752",
"source_account": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"type": "manage_balance",
"type_i": 9,
"state_i": 2,
"state": "success",
"identifier": "0",
"ledger_close_time": "2018-05-19T14:37:36Z",
"participants": [
{
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
}
]
}
]
}
}
const id = 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3'
const query = {
order: 'desc',
limit: 10
}
const response = await sdk.horizon.accounts.getOperations(query, id)
const data = response.data
const nextPageResponse = await response.next()
Returns all operations that somehow refer the specific account. For more details, see Operations
The request returns data in multiple pages, for more information, see Pagination
URL params
Parameter | Description |
---|---|
id | The ID of the account |
Query params
Parameter | Type | Default | Description |
---|---|---|---|
balance_id | string | If present, the result will return only operations for specific balance | |
asset | string | If present, the result will return only operations for specific asset | |
tx_id | string | If present, the result will return only operations from specific transaction with corresponding ID | |
reference | string | If present, the result will return only operations with specific reference | |
since | string | Should be valid ISO 8601 If present, the result will return only operations that was submitted after specific date |
|
to | string | Should be valid ISO 8601 If present, the result will return only operations that was submitted before specific date |
|
completed_only | true | If present, the result will return only operation with success/failed state (deposits/withdrawals/offers can have different states) | |
skip_canceled | If present, the result will include operations with canceled state (offers can be canceled) | ||
pending_only | false | If present, the result will return only operation with success/failed state (deposits/withdrawals/offers can have different states) |
🔒 📄 Get account payments
GET /account/GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3/payments HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "681911957590017",
"paging_token": "681911957590017",
"transaction_id": "681911957590016",
"source_account": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"type": "create_issuance_request",
"type_i": 3,
"state_i": 2,
"state": "success",
"identifier": "13",
"ledger_close_time": "2018-05-19T19:07:09Z",
"participants": [
{
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
},
{
"account_id": "GCW3Y4ZOS3RN3VG62PF3YDSGJ7VC2HPZ5FCMFYIWBSOAIN6VOOKFDOEK",
"balance_id": "BDWCWE3YC6J4QKS5W5X3OQC47CGPH4JLU5IDY5QCHTX6GT3T54UWE3XA"
}
],
"reference": "some reference",
"amount": "123.000000",
"asset": "lazycat",
"fee_fixed": "0.000000",
"fee_percent": "0.000000",
"external_details": {}
},
{
"id": "735629113561089",
"paging_token": "735629113561089",
"transaction_id": "735629113561088",
"source_account": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"type": "payment_v2",
"type_i": 23,
"state_i": 2,
"state": "success",
"identifier": "0",
"ledger_close_time": "2018-05-20T12:29:36Z",
"participants": [
{
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"balance_id": "BBG5QP3T6BQJP7FWD6OMSONEZSIMAQJI44DJH6LSSRJUGVWJITNBNA4R"
},
{
"account_id": "GDRQSTLORA2KOPBELTTM2J4LQKZQQ7OIL6LE2DEMLUOLP572E2YTPROT",
"balance_id": "BA4VSN4C33YEC2RIEMVQJYPG4BWYJKJB3CS4UYC2BFQ44TW2FUTT5KYR"
}
],
"payment_id": 2,
"from": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"to": "GDRQSTLORA2KOPBELTTM2J4LQKZQQ7OIL6LE2DEMLUOLP572E2YTPROT",
"from_balance": "BBG5QP3T6BQJP7FWD6OMSONEZSIMAQJI44DJH6LSSRJUGVWJITNBNA4R",
"to_balance": "BA4VSN4C33YEC2RIEMVQJYPG4BWYJKJB3CS4UYC2BFQ44TW2FUTT5KYR",
"amount": "0.001000",
"asset": "USD4",
"source_fee_data": {
"actual_payment_fee": "0.000000",
"actual_payment_fee_asset_code": "USD4",
"fixed_fee": "0.000000"
},
"destination_fee_data": {
"actual_payment_fee": "0.000000",
"actual_payment_fee_asset_code": "USD4",
"fixed_fee": "0.000000"
},
"source_pays_for_dest": true,
"subject": "wqeqweq",
"reference": "",
"source_sent_universal": "0.000000"
}
]
}
}
const id = 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3'
const query = {
order: 'desc',
limit: 10
}
const response = await sdk.horizon.accounts.getPayments(query, id)
const data = response.data
const nextPageResponse = await response.next()
val id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
val params = PaymentsParams(
asset = "BTC",
pagingParams = PagingParams(
order = PagingOrder.DESC
),
operationsParams = OperationsParams(
completedOnly = false
)
)
val paymentsPage = signedApi
.accounts
.getPayments(id, params)
.execute()
.get()
let id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
let parameters = TransactionsPaymentsRequestParameters(
asset: "BTC",
cursor: nil,
order: "desc",
limit: 100,
completedOnly: false
)
tokenDApi.transactionsApi.requestPayments(
accountId: id,
parameters: parameters,
completion: { result in
switch result {
case .success(let operations):
let fetchedPayments = operations
case .failure(let error):
print(error)
}
})
Returns list of account payments.
The same as /payments
request with account_id
filter
🔒 📄 Get account transactions
GET /accounts/GDQNYWBSE3YIJOXVTB5YD6BLRATXYWKGFBSDTXVDQTUQHGSHRLK7EPAB/transactions HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"meta": {
"latest_ledger": {
"sequence": 204328,
"closed_at": "2018-04-19T13:29:06Z"
}
},
"records": [
{
"id": "e7e82176fccc6f2783e9034bdcdffbc32bafb131b40603b7aa4ac36d18b97fc1",
"paging_token": "869906971103232",
"hash": "e7e82176fccc6f2783e9034bdcdffbc32bafb131b40603b7aa4ac36d18b97fc1",
"ledger": 202541,
"created_at": "2018-04-19T11:00:10Z",
"source_account": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"fee_paid": 0,
"operation_count": 1,
"envelope_xdr": "AAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gDn5G9ZZi67sAAAAAAAAAAAAAAABa4aMlAAAAAAAAAAEAAAAAAAAAAAAAAADg3FgyJvCEuvWYe4H4K4gnfFlGKGQ53qOE6QOaR4rV8gAAAACeeatUD6nle2qsvoEwZ4kNe1/0pbn56JMKphQ6GFF99wAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAATLIXMAAAABAW4DsZ7xheEcAcslCGMMLja1FD0WYd9CR+7LCmH66Nqh5eUfnB7gpe/5WplafBkymDRxXxKGiR46c7pPllmrGBQ==",
"result_xdr": "AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAIAAAAA4NxYMibwhLr1mHuB+CuIJ3xZRihkOd6jhOkDmkeK1fIAAAABAAAAIm1xbXRWTFdScml4Q3ZBZmtiQXV4a2V0YTRheDJVbkdmZFMAAAAAAAAAAAAA4NxYMibwhLr1mHuB+CuIJ3xZRihkOd6jhOkDmkeK1fIAAAACAAAAKjB4QTcyMTFlQTBFMTIzQTY1QWE2RWJGQjViYTkwNTFGOWJCNTM0QTVkNAAAAAAAAAAAAAAAAAAA",
"result_meta_xdr": "AAAAAAAAAAEAAAAHAAAAAAADFy0AAAAQAAAAAODcWDIm8IS69Zh7gfgriCd8WUYoZDneo4TpA5pHitXyAAAAAQAAACJtcW10VkxXUnJpeEN2QWZrYkF1eGtldGE0YXgyVW5HZmRTAAAAAAAAAAAAAAAAAAAAAxctAAAAEAAAAADg3FgyJvCEuvWYe4H4K4gnfFlGKGQ53qOE6QOaR4rV8gAAAAIAAAAqMHhBNzIxMWVBMEUxMjNBNjVBYTZFYkZCNWJhOTA1MUY5YkI1MzRBNWQ0AAAAAAAAAAAAAAAAAAAAAxctAAAAAAAAAADg3FgyJvCEuvWYe4H4K4gnfFlGKGQ53qOE6QOaR4rV8gAAAACeeatUD6nle2qsvoEwZ4kNe1/0pbn56JMKphQ6GFF99wEAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxctAAAACQAAAADg3FgyJvCEuvWYe4H4K4gnfFlGKGQ53qOE6QOaR4rV8gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxctAAAABAAAAADcS6h6yQRirxtpxOMwHXTR9HnD+f67kJWfOr1FYSt6LwAAAANCVEMAAAAAAODcWDIm8IS69Zh7gfgriCd8WUYoZDneo4TpA5pHitXyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADFy0AAAAEAAAAADeik7tFuaDIbyJsGImhj05MbqcQGIEEEhRTOUFj/575AAAAA0VUSAAAAAAA4NxYMibwhLr1mHuB+CuIJ3xZRihkOd6jhOkDmkeK1fIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMXLQAAAAQAAAAAeU79IQvquCbbTecfJe2ZZ2YdWAXl8TepldqyXTjyXEQAAAADU1dNAAAAAADg3FgyJvCEuvWYe4H4K4gnfFlGKGQ53qOE6QOaR4rV8gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"fee_meta_xdr": "AAAAAA==",
"memo_type": "none",
"signatures": [
"W4DsZ7xheEcAcslCGMMLja1FD0WYd9CR+7LCmH66Nqh5eUfnB7gpe/5WplafBkymDRxXxKGiR46c7pPllmrGBQ=="
],
"valid_after": "1970-01-01T00:00:00Z",
"valid_before": "2018-04-26T10:00:06Z"
},
...
]
}
}
Returns list of account transactions.
The same as /transactions
request with account_id
filter
Parameter | Description |
---|---|
id | The ID of the account |
🔒 📄 Get account pending offers
GET /accounts/GAULFBQKQTFHHHZEIRMYVCGTY47FKWEW7P2BY2YT45HAEODAIJUJH23T/offers?is_buy=true&order_book_id=0 HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"paging_token": "333",
"owner_id": "GAULFBQKQTFHHHZEIRMYVCGTY47FKWEW7P2BY2YT45HAEODAIJUJH23T",
"offer_id": 333,
"order_book_id": 0,
"base_balance_id": "BDAS3BZ3CWUB56I2IVCEK3MUWGMLRSXPAEM634YHZWGKSGD7RNSZDIJT",
"quote_balance_id": "BCGYBQEWG3MTWFBHVPHOYTXXKWK6PW6IF3QACB7QW2KIUBU3UIJMAYXI",
"fee": "0.000000",
"base_asset_code": "RTOKEN",
"quote_asset_code": "BTC",
"is_buy": true,
"base_amount": "1.000000",
"quote_amount": "9.000000",
"price": "9.000000",
"created_at": "2018-09-04T16:10:42Z"
},
...
]
}
}
val id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
val params = OffersParams(
onlyPrimary = false,
orderBookId = 4L
)
val offers = signedApi
.accounts
.getPendingOffers(id, params)
.execute()
.get()
let id = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
let parameters = OffersOffersRequestParameters(
isBuy: true,
order: nil,
baseAsset: nil,
quoteAsset: nil,
orderBookId: "0",
offerId: nil,
other: nil
)
tokenDApi.offersApi.requestOffers(
accountId: id,
parameters: parameters,
completion: { (result) in
switch result {
case .success(let offers):
let fetchedOffers = offers
case .failure(let error):
self?.showError(error)
}
})
Returns list of pending offers for specified account
Path params
Parameter | Description |
---|---|
id | The ID of the account |
Query params
Parameter | Type | Default | Description |
---|---|---|---|
base_asset | string | Base asset of the pair | |
quote_asset | string | Quote asset of the pair | |
is_buy | boolean | false | Filters the result items by is_buy property |
order_book_id | integer | If present, the result will contain only items from certain order book. For secondary market use 0 |
🔒 📄 Get account offers history
GET /accounts/GAULFBQKQTFHHHZEIRMYVCGTY47FKWEW7P2BY2YT45HAEODAIJUJH23T/offers_history HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"_links": {
...
},
"id": "3116763277430785",
"paging_token": "3116763277430785",
"transaction_id": "3116763277430784",
"source_account": "GALHS6JXCSMAGXIOCGQYYEJ7AKI3AXWXLRNNFN3EWAIQBHAN6YNRYUTK",
"type": "manage_offer",
"type_i": 16,
"state_i": 7,
"state": "fully matched",
"identifier": "0",
"ledger_close_time": "2018-05-22T12:24:08Z",
"participants": [
{
"account_id": "GAULFBQKQTFHHHZEIRMYVCGTY47FKWEW7P2BY2YT45HAEODAIJUJH23T",
"balance_id": "BCWMW6KFXS5QGGKQUO4TRUEITHT53HKU76Z56KSVOMNXD4NHS2H3QQNG",
"effects": [
{
"base_asset": "CTOKEN",
"is_buy": true,
"matches": [
{
"base_amount": "0.250000",
"fee_paid": "0.000000",
"price": "5.000000",
"quote_amount": "1.250000"
}
],
"quote_asset": "BTC"
}
]
},
...
],
"operation_fee": "0.000000",
"is_buy": false,
"base_asset": "",
"amount": "0.250000",
"price": "5.000000",
"fee": "0.000000",
"offer_id": 0,
"order_book_id": 0,
"is_deleted": true
},
...
]
}
}
Returns offer history for specified account
The same as /operations
request with account_id
filter but only manage_offer
operations are returned
Path params
Parameter | Description |
---|---|
id | The ID of the account |
🔒 Get account references
GET /accounts/GAULFBQKQTFHHHZEIRMYVCGTY47FKWEW7P2BY2YT45HAEODAIJUJH23T/references HTTP/1.1
Content-Type: application/json
{
"data": [
{
"reference": "024f3f36b9a7e8f0cd2ce587269626cce436bb13a60628276312b8cd0e41a40d"
}
]
}
Returns list of account withdrawal references
Path params
Parameter | Description |
---|---|
id | The ID of the account |
Transactions
🔒 📄 Get transactions
GET /transactions HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"meta": {
"latest_ledger": {
"sequence": 19,
"closed_at": "2018-04-07T17:40:26Z"
}
},
"records": [
{
"id": "d3275938107d7dd585ef44b717e67597e0c736591b2901708c90162ea94e4e0c",
"paging_token": "68719480832",
"hash": "d3275938107d7dd585ef44b717e67597e0c736591b2901708c90162ea94e4e0c",
"ledger": 16,
"created_at": "2018-04-07T17:40:11Z",
"source_account": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"fee_paid": 0,
"operation_count": 1,
"envelope_xdr": "AAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gAAAAAAAAAAAAAAAAAAAAAAAAAABa0i7mAAAAAAAAAAEAAAAAAAAACwAAAAAAAAAAAAAAAAAAAANCVEMAAAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gf/////////8AAAAAAAAAAAAAABoAAABweyJuYW1lIjoiQlRDIG5hbWUiLCJsb2dvIjp7InVybCI6ImxvZ29fdXJsIiwidHlwZSI6ImxvZ29fdHlwZSIsImtleSI6IiJ9LCJ0ZXJtcyI6eyJrZXkiOiIiLCJ0eXBlIjoiIiwibmFtZSI6IiJ9fQAAAAAAAAAAAAAAAAAAAAHcMR1gAAAAQD5Nvta+ablzOTlRpEaGJHukvu/MUxVU9GFlZZJx1haStSKqWAb2h8yUFoi37SVoB/yeYS38h6GBY2jSq5encgg=",
"result_xdr": "AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAALAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAA",
"result_meta_xdr": "AAAAAAAAAAEAAAAGAAAAAAAAABAAAAAPAAAAAAAAAAErlz1RoQZGUFdFqn8chgo4Pqc2HawbQXecwHncOFhw3AAAAAD+A6TiHKCPLqwiSE0WbRA0tMM8j7hqI2+wGyqR3DEdYAAAAAAAAAAA/gOk4hygjy6sIkhNFm0QNLTDPI+4aiNvsBsqkdwxHWAAAAABAAAAA0JUQwAAAAAAWskCewAAAAAAAAADQlRDAAAAAAD+A6TiHKCPLqwiSE0WbRA0tMM8j7hqI2+wGyqR3DEdYH//////////AAAAAAAAAAAAAAAaAAAAcHsibmFtZSI6IkJUQyBuYW1lIiwibG9nbyI6eyJ1cmwiOiJsb2dvX3VybCIsInR5cGUiOiJsb2dvX3R5cGUiLCJrZXkiOiIifSwidGVybXMiOnsia2V5IjoiIiwidHlwZSI6IiIsIm5hbWUiOiIifX0AAAAAAAAAAAAAAAAAAAACAAAADwAAAAAAAAABAAAAAAAAAAAAAAAQAAAABAAAAABHpRUSjLeMcIkCxDSDaMsUhga+5qbpX/JFqj2BAo80FwAAAANCVEMAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAAAG5vr7InpHCbVCOpQTA7srr1w00rB0qJaWyvRuyqqxSRAAAAA0JUQwAAAAAA/gOk4hygjy6sIkhNFm0QNLTDPI+4aiNvsBsqkdwxHWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAQAAAAAfvxfnJJ6wluOQrvUpNV1aKa0Ngah+n3ZiELlYDnZzo8AAAADQlRDAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAABgAAAANCVEMAAAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gAAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gAAAAcHsibmFtZSI6IkJUQyBuYW1lIiwibG9nbyI6eyJ1cmwiOiJsb2dvX3VybCIsInR5cGUiOiJsb2dvX3R5cGUiLCJrZXkiOiIifSwidGVybXMiOnsia2V5IjoiIiwidHlwZSI6IiIsIm5hbWUiOiIifX1//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoAAAAAAAAAAA==",
"fee_meta_xdr": "AAAAAA==",
"memo_type": "none",
"signatures": [
"Pk2+1r5puXM5OVGkRoYke6S+78xTFVT0YWVlknHWFpK1IqpYBvaHzJQWiLftJWgH/J5hLfyHoYFjaNKrl6dyCA=="
],
"valid_after": "1970-01-01T00:00:00Z",
"valid_before": "2018-04-14T16:40:07Z"
},
...
]
}
}
Returns list of transactions.
Query params
Parameter | Type | Default | Description |
---|---|---|---|
account_id | string | If present, the result will contain only transactions related to the specified account |
The request returns data in multiple pages, for more information, see Pagination
🔒 📄 Get transactions with ledger changes history
GET /v2/transactions HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"meta": {
"latest_ledger": {
"sequence": 16,
"closed_at": "2018-04-07T17:40:11Z"
}
},
"records": [
{
"id": "d3275938107d7dd585ef44b717e67597e0c736591b2901708c90162ea94e4e0c",
"paging_token": "68719480832",
"hash": "d3275938107d7dd585ef44b717e67597e0c736591b2901708c90162ea94e4e0c",
"ledger": 16,
"created_at": "2018-04-07T17:40:11Z",
"source_account": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"fee_paid": 0,
"operation_count": 1,
"envelope_xdr": "AAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gAAAAAAAAAAAAAAAAAAAAAAAAAABa0i7mAAAAAAAAAAEAAAAAAAAACwAAAAAAAAAAAAAAAAAAAANCVEMAAAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gf/////////8AAAAAAAAAAAAAABoAAABweyJuYW1lIjoiQlRDIG5hbWUiLCJsb2dvIjp7InVybCI6ImxvZ29fdXJsIiwidHlwZSI6ImxvZ29fdHlwZSIsImtleSI6IiJ9LCJ0ZXJtcyI6eyJrZXkiOiIiLCJ0eXBlIjoiIiwibmFtZSI6IiJ9fQAAAAAAAAAAAAAAAAAAAAHcMR1gAAAAQD5Nvta+ablzOTlRpEaGJHukvu/MUxVU9GFlZZJx1haStSKqWAb2h8yUFoi37SVoB/yeYS38h6GBY2jSq5encgg=",
"result_xdr": "AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAALAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAA",
"result_meta_xdr": "AAAAAAAAAAEAAAAGAAAAAAAAABAAAAAPAAAAAAAAAAErlz1RoQZGUFdFqn8chgo4Pqc2HawbQXecwHncOFhw3AAAAAD+A6TiHKCPLqwiSE0WbRA0tMM8j7hqI2+wGyqR3DEdYAAAAAAAAAAA/gOk4hygjy6sIkhNFm0QNLTDPI+4aiNvsBsqkdwxHWAAAAABAAAAA0JUQwAAAAAAWskCewAAAAAAAAADQlRDAAAAAAD+A6TiHKCPLqwiSE0WbRA0tMM8j7hqI2+wGyqR3DEdYH//////////AAAAAAAAAAAAAAAaAAAAcHsibmFtZSI6IkJUQyBuYW1lIiwibG9nbyI6eyJ1cmwiOiJsb2dvX3VybCIsInR5cGUiOiJsb2dvX3R5cGUiLCJrZXkiOiIifSwidGVybXMiOnsia2V5IjoiIiwidHlwZSI6IiIsIm5hbWUiOiIifX0AAAAAAAAAAAAAAAAAAAACAAAADwAAAAAAAAABAAAAAAAAAAAAAAAQAAAABAAAAABHpRUSjLeMcIkCxDSDaMsUhga+5qbpX/JFqj2BAo80FwAAAANCVEMAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAEAAAAAG5vr7InpHCbVCOpQTA7srr1w00rB0qJaWyvRuyqqxSRAAAAA0JUQwAAAAAA/gOk4hygjy6sIkhNFm0QNLTDPI+4aiNvsBsqkdwxHWAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAQAAAAAfvxfnJJ6wluOQrvUpNV1aKa0Ngah+n3ZiELlYDnZzo8AAAADQlRDAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAABgAAAANCVEMAAAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gAAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gAAAAcHsibmFtZSI6IkJUQyBuYW1lIiwibG9nbyI6eyJ1cmwiOiJsb2dvX3VybCIsInR5cGUiOiJsb2dvX3R5cGUiLCJrZXkiOiIifSwidGVybXMiOnsia2V5IjoiIiwidHlwZSI6IiIsIm5hbWUiOiIifX1//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoAAAAAAAAAAA==",
"fee_meta_xdr": "AAAAAA==",
"memo_type": "none",
"signatures": [
"Pk2+1r5puXM5OVGkRoYke6S+78xTFVT0YWVlknHWFpK1IqpYBvaHzJQWiLftJWgH/J5hLfyHoYFjaNKrl6dyCA=="
],
"valid_after": "1970-01-01T00:00:00Z",
"valid_before": "2018-04-14T16:40:07Z",
"changes": [
{
"effect": 0,
"entry_type": 15,
"payload": "AAAAEAAAAA8AAAAAAAAAASuXPVGhBkZQV0WqfxyGCjg+pzYdrBtBd5zAedw4WHDcAAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gAAAAAAAAAAD+A6TiHKCPLqwiSE0WbRA0tMM8j7hqI2+wGyqR3DEdYAAAAAEAAAADQlRDAAAAAABayQJ7AAAAAAAAAANCVEMAAAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gf/////////8AAAAAAAAAAAAAABoAAABweyJuYW1lIjoiQlRDIG5hbWUiLCJsb2dvIjp7InVybCI6ImxvZ29fdXJsIiwidHlwZSI6ImxvZ29fdHlwZSIsImtleSI6IiJ9LCJ0ZXJtcyI6eyJrZXkiOiIiLCJ0eXBlIjoiIiwibmFtZSI6IiJ9fQAAAAAAAAAAAAAAAA=="
},
{
"effect": 2,
"entry_type": 15,
"payload": "AAAADwAAAAAAAAABAAAAAA=="
},
{
"effect": 0,
"entry_type": 4,
"payload": "AAAAEAAAAAQAAAAAR6UVEoy3jHCJAsQ0g2jLFIYGvuam6V/yRao9gQKPNBcAAAADQlRDAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
},
{
"effect": 0,
"entry_type": 4,
"payload": "AAAAEAAAAAQAAAAAbm+vsiekcJtUI6lBMDuyuvXDTSsHSolpbK9G7KqrFJEAAAADQlRDAAAAAAD+A6TiHKCPLqwiSE0WbRA0tMM8j7hqI2+wGyqR3DEdYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
},
{
"effect": 0,
"entry_type": 4,
"payload": "AAAAEAAAAAQAAAAAfvxfnJJ6wluOQrvUpNV1aKa0Ngah+n3ZiELlYDnZzo8AAAADQlRDAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="
},
{
"effect": 0,
"entry_type": 6,
"payload": "AAAAEAAAAAYAAAADQlRDAAAAAAD+A6TiHKCPLqwiSE0WbRA0tMM8j7hqI2+wGyqR3DEdYAAAAAD+A6TiHKCPLqwiSE0WbRA0tMM8j7hqI2+wGyqR3DEdYAAAAHB7Im5hbWUiOiJCVEMgbmFtZSIsImxvZ28iOnsidXJsIjoibG9nb191cmwiLCJ0eXBlIjoibG9nb190eXBlIiwia2V5IjoiIn0sInRlcm1zIjp7ImtleSI6IiIsInR5cGUiOiIiLCJuYW1lIjoiIn19f/////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaAAAAAAAAAAA="
}
]
},
...
]
}
}
Returns list of transactions with ledger changes history included.
Query params
Parameter | Type | Default | Description |
---|---|---|---|
account_id | string | If present, the result will contain only transactions related to the specified account |
The request returns data in multiple pages, for more information, see Pagination
🔒 Get transaction by ID
GET /transactions/b21064dfcc521fe7f7e56d00630aa2675c9b3f5b1a8dd92f74b3c52062d5adb4 HTTP/1.1
Content-Type: application/json
{
"id": "b21064dfcc521fe7f7e56d00630aa2675c9b3f5b1a8dd92f74b3c52062d5adb4",
"paging_token": "73014452224",
"hash": "b21064dfcc521fe7f7e56d00630aa2675c9b3f5b1a8dd92f74b3c52062d5adb4",
"ledger": 17,
"created_at": "2018-04-07T17:40:16Z",
"source_account": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"fee_paid": 0,
"operation_count": 1,
"envelope_xdr": "AAAAAP4DpOIcoI8urCJITRZtEDS0wzyPuGojb7AbKpHcMR1gAAAAAAAAAAAAAAAAAAAAAAAAAABa0i7rAAAAAAAAAAEAAAAAAAAADwAAAAAAAAADRVRIAAAAAANTVU4AAAAAAEk9itAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdwxHWAAAABAM8AA5OEsbzgc7MVXxI4eaGw6oL275/R2ZSvJQkxQbbxrcbB2TeXPaUDRZmaCK9QcAUVAIaHRajY+9htJwPM3Bg==",
"result_xdr": "AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAPAAAAAAAAAABJPYrQAAAAAAAAAAA=",
"result_meta_xdr": "AAAAAAAAAAEAAAABAAAAAAAAABEAAAAMAAAAA0VUSAAAAAADU1VOAAAAAABJPYrQAAAAAEk9itAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"fee_meta_xdr": "AAAAAA==",
"memo_type": "none",
"signatures": [
"M8AA5OEsbzgc7MVXxI4eaGw6oL275/R2ZSvJQkxQbbxrcbB2TeXPaUDRZmaCK9QcAUVAIaHRajY+9htJwPM3Bg=="
],
"valid_after": "1970-01-01T00:00:00Z",
"valid_before": "2018-04-14T16:40:12Z"
}
Returns information about a transaction with given identifier.
Path params
Parameter | Description |
---|---|
id | The ID, hash or paging token of the transaction |
🔒 📄 Get transaction operations
GET /transactions/b21064dfcc521fe7f7e56d00630aa2675c9b3f5b1a8dd92f74b3c52062d5adb4/operations HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"_links": {
...
},
"id": "73014452225",
"paging_token": "73014452225",
"transaction_id": "73014452224",
"source_account": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"type": "manage_asset_pair",
"type_i": 15,
"state_i": 2,
"state": "success",
"identifier": "0",
"ledger_close_time": "2018-04-07T17:40:16Z",
"participants": [
{
"account_id": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636"
}
],
"operation_fee": "0.000000",
"base_asset": "ETH",
"quote_asset": "SUN",
"physical_price": "1228.770000",
"physical_price_correction": "0.000000",
"max_price_step": "0.000000"
}
]
}
}
Returns list of operations performed in the given transaction.
The request returns data in multiple pages, for more information, see Pagination
Path params
Parameter | Description |
---|---|
id | The ID or hash of the transaction |
🔒 📄 Get transaction payments
GET /transactions/66e4bce38b9788b818d74e68a90762b664c18df69b58c939aae7d14e1ac73b63/payments HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"_links": {
...
},
"id": "13383805289107457",
"paging_token": "13383805289107457",
"transaction_id": "13383805289107456",
"source_account": "GAULFBQKQTFHHHZEIRMYVCGTY47FKWEW7P2BY2YT45HAEODAIJUJH23T",
"type": "payment_v2",
"type_i": 23,
"state_i": 2,
"state": "success",
"identifier": "0",
"ledger_close_time": "2018-10-09T12:36:58Z",
"participants": [
{
"account_id": "GAULFBQKQTFHHHZEIRMYVCGTY47FKWEW7P2BY2YT45HAEODAIJUJH23T",
"balance_id": "BDE6PK62OEHVDBI4ABOH3F4HQNQQDKFWMVXDYQJ63FYAH72CPA65FJVW"
},
{
"account_id": "GDQNYWBSE3YIJOXVTB5YD6BLRATXYWKGFBSDTXVDQTUQHGSHRLK7EPAB",
"balance_id": "BB4U57JBBPVLQJW3JXTR6JPNTFTWMHKYAXS7CN5JSXNLEXJY6JOEJXQW"
}
],
"operation_fee": "0.000000",
"operation_fee_asset": "SWM",
"payment_id": 93,
"from": "GAULFBQKQTFHHHZEIRMYVCGTY47FKWEW7P2BY2YT45HAEODAIJUJH23T",
"to": "GDQNYWBSE3YIJOXVTB5YD6BLRATXYWKGFBSDTXVDQTUQHGSHRLK7EPAB",
"from_balance": "BDE6PK62OEHVDBI4ABOH3F4HQNQQDKFWMVXDYQJ63FYAH72CPA65FJVW",
"to_balance": "BB4U57JBBPVLQJW3JXTR6JPNTFTWMHKYAXS7CN5JSXNLEXJY6JOEJXQW",
"amount": "0.900000",
"asset": "SWM",
"source_fee_data": {
"fixed_fee": "0.000000",
"actual_payment_fee": "0.000000",
"actual_payment_fee_asset_code": "SWM"
},
"destination_fee_data": {
"fixed_fee": "0.000000",
"actual_payment_fee": "0.000000",
"actual_payment_fee_asset_code": "SWM"
},
"source_pays_for_dest": false,
"subject": "Test",
"reference": "",
"source_sent_universal": "0.000000"
}
]
}
}
Returns list of payments performed in the given transaction.
The request returns data in multiple pages, for more information, see Pagination
Path params
Parameter | Description |
---|---|
id | The ID or hash of the transaction |
Submit a transaction
POST /transactions HTTP/1.1
Content-Type: application/x-www-form-urlencoded
tx=HEX_ENCODED_TX_ENVELOPE
200 OK
{
"_links":{
...
},
"hash":"46595fca1a55158df47cdf00bbfb35bfe888fca8fd62a056a2d9fe1d2c4659b3",
"ledger":4894559,
"envelope_xdr":"AAAAAN8bwumT6hrjlzpdE70leR04UmXYMHYTRT/FWFemdoK0AAAAAHvH03cAAAAAAAAAAAAAAABbxdTpAAAAAAAAAAEAAAAAAAAAGQAAAAQAAAAAAAAAMQAAAAAAAAAAAAAAAW2DLNcAAABAWXH3WkdfXnKxhboqkwViZln2G+V8hCdjy+h+FJpnNnFYcQ57AzJ6Tn05nHaAChypnLL9jftnNYqqEo1pCg+nAg==",
"result_xdr":"AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAZAAAAAAAAACoweDE0MmM4NjNCQmM0ODJCQzNmNmRlMTYxNGZiODFEYzg4MDE4MDBhNDcAAAAAAAAAAAAxAAAAA1NXTQAAAAABAAAAGQAAAAAAAAAAAAAAAAAAAAA=",
"result_meta_xdr":"AAAAAAAAAAEAAAADAAAAAgAAABAAAAAAyJ78c80nfekO2lyvYmsp/GIWbGYJhPJngV0eXXDH4tIAAAAEAAAAAAAAAAEASq9fAAAAEwAAAAAAAABnAAAABAAAACoweDE0MmM4NjNCQmM0ODJCQzNmNmRlMTYxNGZiODFEYzg4MDE4MDBhNDcAAAAAAAEAAAAA3xvC6ZPqGuOXOl0TvSV5HThSZdgwdhNFP8VYV6Z2grQAAAAAW79LfgAAAABbvKh+xLFUBahsJrkAAAAAAAAAAAAAAAAAAAAAAEqvXwAAABAAAAAA3xvC6ZPqGuOXOl0TvSV5HThSZdgwdhNFP8VYV6Z2grQAAAAEAAAAKjB4MTQyYzg2M0JCYzQ4MkJDM2Y2ZGUxNjE0ZmI4MURjODgwMTgwMGE0NwAAAAAAAAAAAAA="
"extras":{ }
}
val tx = TransactionBuilder(networkParams, PublicKeyFactory.fromAccountId(accountId))
.addOperation(...)
.build()
tx.addSignature(account)
val result = api
.transactions
.submit(tx.getEnvelope().toBase64())
.execute()
.get()
let sendDate = Date()
let transactionBuilder: TransactionBuilder = TransactionBuilder(
networkParams: networkInfo.networkParams,
sourceAccountId: sourceAccountID,
params: networkInfo.getTxBuilderParams(sendDate: sendDate)
)
transactionBuilder.add(
operationBody: .paymentV2(operation),
operationSourceAccount: sourceAccountID
)
do {
let transaction = try transactionBuilder.buildTransaction()
try! transaction.addSignature(signer: key)
transactionsApi.sendTransaction(
envelope: transaction.getEnvelope().toXdrBase64String(),
sendDate: sendDate,
completion: { (result) in
switch result {
case .failure(let error):
print("failure: \(error)")
case .success:
print("Transaction has been successfully sent")
}
})
} catch let error {
print("failure: \(error)")
}
Submits given transaction. The transaction is being posted as an URL-encoded form paramether.
If transaction has been failed, the cause can be found in result_codes
of the result extras.
Form params
Parameter | Description |
---|---|
tx | HEX-encoded envelope of the transaction. |
Balances
📄 Get balances
GET /balances HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"balance_id": "BBD2KFISRS3YY4EJALCDJA3IZMKIMBV642TOSX7SIWVD3AICR42BOHAK",
"account_id": "GAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHV4",
"asset": "BTC"
},
{
"balance_id": "BBXG7L5SE6SHBG2UEOUUCMB3WK5PLQ2NFMDUVCLJNSXUN3FKVMKJCXRU",
"account_id": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"asset": "ETH"
},
...
]
}
}
Returns list of all balances.
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Default | Description |
---|---|---|---|
asset | string | If present, the result will contain only balances of specified asset | |
account | string | Account ID. If present, the result will contain only balances owned by specified account |
Get asset of the balance
GET /balances/BAKLAUXHAEZXK3ODHAABNPZHRRADH24FZO4F3364VI5CFWXFWEYDW4SY/asset HTTP/1.1
Content-Type: application/json
{
"code": "ETH",
"owner": "",
"available_for_issuance": "",
"preissued_asset_signer": "",
"max_issuance_amount": "",
"issued": "",
"pending_issuance": "",
"policy": 0,
"policies": null,
"details": null
}
Returns asset info for specified balance.
Path params
Parameter | Description |
---|---|
id | Balance ID |
Get account ID of the balance
GET /balances/BAKLAUXHAEZXK3ODHAABNPZHRRADH24FZO4F3364VI5CFWXFWEYDW4SY/account HTTP/1.1
Content-Type: application/json
{
"account_id": "GABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVCX"
}
Returns account ID for specified balance.
Path params
Parameter | Description |
---|---|
id | Balance ID |
2FA
Get factors
GET /wallets/5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6/factors HTTP/1.1
Content-Type: application/json
{
"data":[
{
"type":"password",
"id":790,
"attributes":{
"priority":1
}
},
...
]
}
val walletId = "5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6"
val factors = api
.tfa
.getFactors(walletId)
.execute()
.get()
let walletId = "5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6"
tokenDApi.tfaApi.getFactors(
walletId: walletId,
completion: { (result) in
switch result {
case .failure(let errors):
print("failure: \(errors)")
case .success(let factors):
let fetchedFactors = factors
}
})
Returns list of factors used for 2Factor Auth
Path params
Parameter | Description |
---|---|
id | ID of the wallet |
🔒 Create factor
POST /wallets/5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6/factors HTTP/1.1
Content-Type: application/json
{
"data": {
"type": "totp"
}
}
Response:
{
"data":{
"id":915,
"type":"totp",
"attributes":{
"secret":"ZFNM6UTSS4JMEIIG",
"seed":"otpauth://totp/TokenD:ole21@mailinator.com?algorithm=SHA1\u0026digits=6\u0026issuer=Swarm\u0026period=30\u0026secret=ZFNM6UTSS4JMEIIG"
}
}
}
val type = TfaFactor.Type.TOTP
val walletId = "5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6"
val newFactor = api
.tfa
.createFactor(walletId, type)
.execute()
.get()
let walletId = "5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6"
tokenDApi.tfaApi.createFactor(
walletId: walletId,
type: TFAFactorType.totp.rawValue,
completion: { (result) in
switch result {
case .failure(let error):
print("createFactor failure: \(error)")
case .success(let response):
print("createFactor success: \(response)")
}
})
Creates non-active TFA factor of given type
Path params
Parameter | Description |
---|---|
id | ID of the wallet |
Available factor types
Name | Description |
---|---|
totp | One-time password from the Google Authenticator |
🔒 Update factor
PATCH /wallets/5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6/factors/4 HTTP/1.1
Content-Type: application/json
{
"data": {
"attributes": {
"priority": 100
}
}
}
val factorId = 4
val walletId = "5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6"
val attributes = TfaFactor.Attributes(
priority = 100
)
api.tfa
.updateFactor(walletId, factorId, attributes)
.execute()
let walletId = "5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6"
tokenDApi.tfaApi.updateFactor(
walletId: walletId,
factorId: 4,
priority: 100,
completion: { result in
switch result {
case .failure(let error):
print("updateFactor failure: \(error)")
case .success:
print("updateFactor success")
}
})
Updates given TFA factor
Path params
Parameter | Description |
---|---|
walletId | ID of the wallet |
factorId | ID of the factor |
🔒 Delete factor
DELETE /wallets/5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6/factors/4 HTTP/1.1
val factorId = 4
val walletId = "5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6"
api.tfa
.deleteFactor(walletId, factorId)
.execute()
let walletId = "5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6"
tokenDApi.tfaApi.deleteFactor(
walletId: walletId,
factorId: 4,
completion: { (result) in
switch result {
case .failure(let error):
print("delete failure: \(error)")
case .success:
print("Factor has been successfully deleted")
}
})
Deletes given factor
Path params
Parameter | Description |
---|---|
walletId | ID of the wallet |
factorId | ID of the factor |
Factor verification
PUT /wallets/5bda0356e3493325ff40334089f37abd2afbb4fa14270a07ed88b7533a3016d6/factors/4/verification HTTP/1.1
Content-Type: application/json
{
"data":{
"attributes":{
"otp":"123456",
"token":"4402502ad8d4c80d06d28e988071aabe082afea1"
}
}
}
// Inside of the TfaCallback
override fun onTfaRequired(exception: NeedTfaException,
verifierInterface: TfaVerifier.Interface) {
val otp = requestAuthenticatorCode()
verifierInterface.verify(otp)
}
Verifies factor value
Path params
Parameter | Description |
---|---|
walletId | ID of the wallet |
factorId | ID of the factor |
Blobs
Blobs allow users to store arbitrary text. Any blob has privacy settings and client-provided tags for filtering
Blob types
Type | Is Public | Filter |
---|---|---|
asset_description |
t | 1 |
fund_overview |
t | 2 |
fund_update |
t | 4 |
nav_update |
t | 8 |
fund_document |
t | 16 |
alpha |
t | 32 |
bravo |
t | 64 |
charlie |
t | 128 |
delta |
t | 256 |
token_terms |
t | 512 |
token_metrics |
t | 1024 |
kyc_form |
f | 2048 |
kyc_id_document |
f | 4096 |
kyc_poa |
f | 8192 |
identity_mind_reject |
f | 16384 |
🔒 Create user-owned blob
POST /users/GCCJPB7QQLNEMCJ72CQJ4ODAZFFGXHET5UPOGSDWT222GXQPMTO6ZQW3/blobs HTTP/1.1
Content-Type: application/json
{
"data": {
"type": "asset_description",
"attributes": {
"value": "foobar"
}
"relationships": {
"some-tag": {
"data": {
"id": "tag-id"
}
}
}
}
}
HTTP/1.1 201
{
"data": {
"id": "CMKFL7K43ZG6E4S3QFEYFYM2F7GS2QJHQPLI25PIWFYMT5V4ZOKQ",
"type": "asset_description",
"attributes": {
"value": "foobar"
},
"relationships": {
"some-tag": {
"data": {
"id": "tag-id"
}
}
}
}
}
const types = sdk.api.blobs.types
const data = JSON.stringify({
foo: 'bar'
})
const accountId = 'GCCJPB7QQLNEMCJ72CQJ4ODAZFFGXHET5UPOGSDWT222GXQPMTO6ZQW3'
const { data } = await sdk.api.blobs.create(types.assetDescription, data, accountId)
console.log(data.id) // => 'GCCJPB7QQLNEMCJ72CQJ4ODAZFFGXHET5UPOGSDWT222GXQPMTO6ZQW3'
POST /users/:address/blobs
Parameter | Description |
---|---|
:address |
owner account address |
type |
blob type |
value |
arbitrary text |
relationships |
Resource key value to provide tags for filtering |
Get
GET /users/GCCJPB7QQLNEMCJ72CQJ4ODAZFFGXHET5UPOGSDWT222GXQPMTO6ZQW3/blobs/CMKFL7K43ZG6E4S3QFEYFYM2F7GS2QJHQPLI25PIWFYMT5V4ZOKQ HTTP/1.1
HTTP/1.1 200
Content-Type: application/json
{
"data": {
"id": "CMKFL7K43ZG6E4S3QFEYFYM2F7GS2QJHQPLI25PIWFYMT5V4ZOKQ",
"type": "asset_description",
"attributes": {
"value": "foobar"
}
}
}
const accountId = 'GCCJPB7QQLNEMCJ72CQJ4ODAZFFGXHET5UPOGSDWT222GXQPMTO6ZQW3'
const blobId = 'CMKFL7K43ZG6E4S3QFEYFYM2F7GS2QJHQPLI25PIWFYMT5V4ZOKQ'
const blob = await sdk.api.blobs.get(blobId, accountId)
console.log(blob.data.value) // => "{ "foo": "bar" }"
val accountId = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
val blobId = "CMKFL7K43ZG6E4S3QFEYFYM2F7GS2QJHQPLI25PIWFYMT5V4ZOKQ"
val blob = api
.blobs
.getById(accountId, blobId)
.execute()
.get()
GET /users/:addres/blobs/:id
Parameter | Description |
---|---|
:address |
Owner account address |
:id |
Blob identifier |
Request signature is required for private blobs.
Filter blobs
GET /users/GCCJPB7QQLNEMCJ72CQJ4ODAZFFGXHET5UPOGSDWT222GXQPMTO6ZQW3/blobs HTTP/1.1
HTTP/1.1 200
Content-Type: application/json
{
"data": [
{
"id": "ZCPGS6E3MH7I7WNWAHHYW3C6PZI2R4ONUMCEERN35J33MQBAGJ3Q",
"type": "fund_overview",
"attributes": {
"value": "aaaa"
}
},
{
"id": "57UOND563OVFKI6BDZU7DBPDZFJJORIGFPEMHZQ44IQLWO4RYUOQ",
"type": "nav_update",
"attributes": {
"value": "bbbb"
}
}
]
}
const accountId = 'GCCJPB7QQLNEMCJ72CQJ4ODAZFFGXHET5UPOGSDWT222GXQPMTO6ZQW3'
const types = sdk.api.blobs.types
// Get all with 'asset_description' and 'fund_overview' types:
const type = types.assetDescription | types.fundOverview
await sdk.api.blobs.getAll({ type }, accountId)
val accountId = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
val type = Blob.TYPE_ALPHA or Blob.TYPE_BRAVO
val params = BlobsParams(
typeMask = type
)
val blobs = api
.blobs
.get(accountId, params)
.execute()
.get()
let accountId = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
let type = 2 // fund_overview
usersApi.getBlob(
BlobResponse.self,
accountId: accountId,
blobId: ,
fundId: nil,
tokenCode: nil,
fundOwner: nil,
type: type,
completion: { (result) in
switch result {
case .failure(let error):
print("blob download failure: \(error)")
case .success(let blob):
print("blob content: \(blob.getBlobContent())")
}
})
GET /users/:address/blobs
Parameter | Description |
---|---|
:address |
Owner account address |
type |
Filter by type bitmask |
Blobs index also supports filtering by user-provided relationships tags values.
To access private blobs request signature is required, otherwise only public ones will be returned.
Documents
Document types
Type | Visibility |
---|---|
asset_logo |
public |
fund_logo |
public |
fund_document |
public |
nav_report |
public |
Allowed content types
application/pdf
image/jpeg
image/tiff
image/png
image/gif
🔒 Upload
POST /users/GBT3XFWQUHUTKZMI22TVTWRA7UHV2LIO2BIFNRCH3CXWPYVYPTMXMDGC/documents HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
{
"data": {
"type": "asset_logo",
"attributes": {
"content_type": "image/png"
}
}
}
HTTP/1.1 200
Content-Type: application/vnd.api+json
{
"data": {
"type": "upload_policy",
"attributes": {
"bucket": "api",
"key": "dpurgh4infjubjhcost7fvmaij6y2s3as33sueqfjdmnyrxig3qwm3uc",
"policy": "eyJleHBpcmF0aW9...ZXF1ZXN0Il1dfQ==",
"url": "http://localhost:9000/api/",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"x-amz-credential": "2SRMRAST49JEIMUUKWKH/20171225/us-east-1/s3/aws4_request",
"x-amz-date": "20171225T001154Z",
"x-amz-signature": "4881f2cada23e19df7f5a92fd1d82fe4c8e4b33ea69e61f05ca2a8860d9a5f3b"
}
}
}
Reviewable requests
🔒 📄 Get requests history
GET /requests HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "1",
"paging_token": "1",
"requestor": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"reviewer": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"reference": "BTC",
"reject_reason": "",
"hash": "2b973d51a10646505745aa7f1c860a383ea7361dac1b41779cc079dc385870dc",
"details": {
"request_type_i": 0,
"request_type": "asset_create",
"asset_create": {
"code": "BTC",
"policies": [
{
"name": "AssetPolicyBaseAsset",
"value": 2
},
{
"name": "AssetPolicyWithdrawable",
"value": 8
},
{
"name": "AssetPolicyTwoStepWithdrawal",
"value": 16
}
],
"pre_issued_asset_signer": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"max_issuance_amount": "9223372036854.775807",
"initial_preissued_amount": "0.000000",
"details": {
"logo": {
"key": "",
"type": "logo_type",
"url": "logo_url"
},
"name": "BTC name",
"terms": {
"key": "",
"name": "",
"type": ""
}
}
}
},
"created_at": "2018-04-07T17:40:11Z",
"updated_at": "2018-04-07T17:40:11Z",
"request_state_i": 3,
"request_state": "approved"
},
...
]
}
}
val requestsPage = api
.requests
.getAll(
RequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
)
)
)
.execute()
.get()
Returns list of all reviewable requests.
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
🔒 Get request by ID
GET /requests/1 HTTP/1.1
Content-Type: application/json
{
"id": "1",
"paging_token": "1",
"requestor": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"reviewer": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"reference": "BTC",
"reject_reason": "",
"hash": "2b973d51a10646505745aa7f1c860a383ea7361dac1b41779cc079dc385870dc",
"details": {
"request_type_i": 0,
"request_type": "asset_create",
"asset_create": {
"code": "BTC",
"policies": [
{
"name": "AssetPolicyBaseAsset",
"value": 2
},
{
"name": "AssetPolicyWithdrawable",
"value": 8
},
{
"name": "AssetPolicyTwoStepWithdrawal",
"value": 16
}
],
"pre_issued_asset_signer": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"max_issuance_amount": "9223372036854.775807",
"initial_preissued_amount": "0.000000",
"details": {
"logo": {
"key": "",
"type": "logo_type",
"url": "logo_url"
},
"name": "BTC name",
"terms": {
"key": "",
"name": "",
"type": ""
}
}
}
},
"created_at": "2018-04-07T17:40:11Z",
"updated_at": "2018-04-07T17:40:11Z",
"request_state_i": 3,
"request_state": "approved"
}
Returns specified request.
Path params
Parameter | Description |
---|---|
id | ID of the request |
🔒 📄 Get assets requests
GET /request/assets HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "11",
"paging_token": "11",
"requestor": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"reviewer": "GA4CZMOLWKO6RBKT77V2W4JGKVKYHSUAATVDJYPUYVGTYQ7BLTVH5CBP",
"reference": "CAT",
"reject_reason": "",
"hash": "e3ef53ae1b817e1870f3bc99d5c83cc1a2bccdddcb0d57919538893af3a2d36d",
"details": {
"request_type_i": 0,
"request_type": "asset_create",
"asset_create": {
"code": "CAT",
"policies": [],
"pre_issued_asset_signer": "GAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHV4",
"max_issuance_amount": "213123.000000",
"initial_preissued_amount": "213123.000000",
"details": {
"logo": {
"key": "dpurgh4infpebjhcost7fvijeh5zh732at53ry4mkuwkvkyx6xxffusl",
"mime_type": "image/jpeg",
"name": "A-gray-kitten-meowing.jpg",
"type": ""
},
"name": "CAT",
"terms": {
"key": "",
"name": "",
"type": ""
}
}
},
"two_step_withdrawal": null,
"limits_update": null,
"aml_alert": null,
"update_sale_details": null
},
"created_at": "2018-05-19T16:58:47Z",
"updated_at": "2018-05-19T16:58:47Z",
"request_state_i": 2,
"request_state": "canceled"
}
]
}
}
const { data } = await sdk.horizon.request.getAllForAssets({
requestor: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3',
asset: 'QTK',
state: 3 // approved
})
val requestsPage = api
.requests
.getAssets(
AssetRequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
),
asset = "QTK",
state = RequestState.APPROVED
)
)
.execute()
.get()
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
asset | string | If present, the result will return only requests for specific asset |
🔒 📄 Get sale creation requests
GET /request/sales HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "49",
"paging_token": "49",
"requestor": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"reviewer": "GA4CZMOLWKO6RBKT77V2W4JGKVKYHSUAATVDJYPUYVGTYQ7BLTVH5CBP",
"reference": null,
"reject_reason": "",
"hash": "a654a51fa96981dc70aaab89ae7e6cb8af33bf4d662b669227ef68434854d22c",
"details": {
"request_type_i": 5,
"request_type": "sale",
"two_step_withdrawal": null,
"sale": {
"base_asset": "ETH2",
"default_quote_asset": "USD",
"start_time": "2018-06-19T21:00:00Z",
"end_time": "2018-06-29T21:00:00Z",
"soft_cap": "10000.000000",
"hard_cap": "20000.000000",
"sale_type": {
"name": "crowd_funding",
"value": 2
},
"base_asset_for_hard_cap": "150000.000000",
"details": {
"description": "BUDXEPAFDOG4EQA2C5ZGWFM2BIOS5BFEDE3U465RWLFG6XMSE7OQ",
"logo": {
"key": "dpurah4infpebjhcost7fvo3l3qinkqqg73q7gakvchkiuvbjsje4osa",
"mime_type": "image/jpeg",
"name": "flat,800x800,070,f.jpg"
},
"name": "Eth 2.0 sale",
"short_description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris vulputate tristique diam ut efficitur. Fusce dapibus ex vel eros egestas cursus",
"youtube_video_id": ""
},
"quote_assets": [
{
"quote_asset": "BTC",
"price": "1.000000"
}
],
"state": {
"name": "none",
"value": 0
}
},
"limits_update": null,
"aml_alert": null,
"update_sale_details": null
},
"created_at": "2018-06-20T18:19:35Z",
"updated_at": "2018-06-20T18:19:35Z",
"request_state_i": 3,
"request_state": "approved"
}
]
}
}
const { data } = await sdk.horizon.request.getAllForSales({
requestor: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3',
base_asset: 'QTK',
state: 3 // approved
})
val requestsPage = api
.requests
.getSales(
SaleRequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
),
baseAsset = "QTK",
state = RequestState.APPROVED
)
)
.execute()
.get()
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
base_asset | string | If present, the result will return only requests for specific asset |
🔒 📄 Get pre-issuance requests
GET /request/preissuances HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "77",
"paging_token": "77",
"requestor": "GDJIZ3VZP3UWNYHU57XEZXD2BQKY4PGHRODTQHPI3LI4NHUVN3J4F4SV",
"reviewer": "GA4CZMOLWKO6RBKT77V2W4JGKVKYHSUAATVDJYPUYVGTYQ7BLTVH5CBP",
"reference": "ZEAkv2HjgFjruhQkmcKwcGCPjL1xG5pyRXt1V1bDib7Sy",
"reject_reason": "",
"hash": "505288bcfb97b3e1886d9572f1e859fdaeba539ddb7207f410913457dc33863b",
"details": {
"request_type_i": 2,
"request_type": "pre_issuance_create",
"pre_issuance_create": {
"asset": "TST",
"amount": "100.000000",
"signature": "9EBQVAAAAEA2wuDDagEuHO2H8+N8PbCzcFt6cj/Yi0oXJKbO5F/EkDLdeFDI+UnJCpkXZGxwW3w1MHHvf52IbVx0Cm7ufEwH",
"reference": "ZEAkv2HjgFjruhQkmcKwcGCPjL1xG5pyRXt1V1bDib7Sy"
},
"two_step_withdrawal": null,
"limits_update": null,
"aml_alert": null,
"update_sale_details": null
},
"created_at": "2018-06-30T19:11:11Z",
"updated_at": "2018-06-30T19:11:11Z",
"request_state_i": 3,
"request_state": "approved"
}
]
}
}
const { data } = await sdk.horizon.request.getAllForPreissuances({
requestor: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3',
state: 3 // approved
})
val requestsPage = api
.requests
.getPreIssuances(
PreIssuanceRequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
),
requestor = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
asset = "QTK"
)
)
.execute()
.get()
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
asset | string | If present, the result will return only requests for specific asset |
🔒 📄 Get issuance requests
GET /request/issuances HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "13",
"paging_token": "13",
"requestor": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"reviewer": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"reference": "some reference",
"reject_reason": "",
"hash": "6b4f15c459b0e75fffb2b194716b9ac84a9ee165676486b61c48964ae097b73a",
"details": {
"request_type_i": 3,
"request_type": "issuance_create",
"issuance_create": {
"asset": "lazycat",
"amount": "123.000000",
"receiver": "BDWCWE3YC6J4QKS5W5X3OQC47CGPH4JLU5IDY5QCHTX6GT3T54UWE3XA",
"external_details": {}
},
"two_step_withdrawal": null,
"limits_update": null,
"aml_alert": null,
"update_sale_details": null
},
"created_at": "2018-05-19T19:07:09Z",
"updated_at": "2018-05-19T19:07:09Z",
"request_state_i": 3,
"request_state": "approved"
}
]
}
}
const { data } = await sdk.horizon.request.getAllForIssuances({
requestor: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3',
state: 3 // approved
})
val requestsPage = api
.requests
.getIssuances(
IssuanceRequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
),
requestor = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
asset = "QTK"
)
)
.execute()
.get()
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor. |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
asset | string | If present, the result will return only requests for specific asset |
🔒 📄 Get withdrawals requests
GET /request/withdrawals HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "58",
"paging_token": "58",
"requestor": "GBWQ6ZWRLYPEF3XJUR4VFTDUL4D554XDZSOXED2K7SEXKACTGDKAJNRD",
"reviewer": "GA4CZMOLWKO6RBKT77V2W4JGKVKYHSUAATVDJYPUYVGTYQ7BLTVH5CBP",
"reference": null,
"reject_reason": "",
"hash": "37218112d1f9b1336850288007aaab6a275d8b97c309d55be1a7ad3dc64f8716",
"details": {
"request_type_i": 4,
"request_type": "withdraw",
"withdraw": {
"balance_id": "BCQD4KVHA3XIPHTQWQV4GPGMI5VYNEH7S2H2V4B5DUYNBOI6TZRYPS7H",
"amount": "0.100000",
"fixed_fee": "0.000000",
"percent_fee": "0.000000",
"pre_confirmation_details": {
"eth_tx_1_hash": "c91f9ea5949001d994d9dd76ce4b7216d10145322e3d9cd2317a8fca552a83c5",
"raw_eth_tx_1": "f8aa808504a817c80083061a8094b7142b49a257b0e09d001adb054941fff34fb4ff80b844413d3cf1000000000000000000000000811ee7668ac7d418c9e95198567f41e3df4d3b9d000000000000000000000000000000000000000000000000016345785d8a00001ba0500c26ed228d0659ee92479cc86808e4afad4ef4d8586c5eebd86ce9d7c52f1fa03db0eb72171ec948b1ec9ae4d0785d7fb28597a7409d725f765bea5641b14eb1"
},
"external_details": {
"address": "0x811ee7668ac7d418c9e95198567f41e3df4d3b9d"
},
"dest_asset_code": "ETH",
"dest_asset_amount": "0.100000",
"reviewer_details": {
"eth_tx_2_hash": "f31300b30faa0fca5221224c021a941c32dbbbc1c5597c3d49706376954fe780",
"raw_eth_tx_2": "f889808504a817c80083061a8094b7142b49a257b0e09d001adb054941fff34fb4ff80a42c48e7db9e77d9a92b89adb32d60644a848199c6d7d660554e12ac31437e4d786a2ab7c51ba02f0fadcc79a50fecf4f70b42adfe2b490bd6e3884e7e7c2146d524dc1d301ec2a02d6175bb72c66815c598f4224dfb71f501ca1960966bc15cc8439ceec03e41b2"
}
},
"two_step_withdrawal": null,
"limits_update": null,
"aml_alert": null,
"update_sale_details": null
},
"created_at": "2018-06-28T13:57:58Z",
"updated_at": "2018-06-28T15:18:29Z",
"request_state_i": 3,
"request_state": "approved"
}
]
}
}
const { data } = await sdk.horizon.request.getAllForWithdrawals({
requestor: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3',
dest_asset_code: 'BTC',
state: 3 // approved
})
val requestsPage = api
.requests
.getWithdrawals(
WithdrawalRequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
),
requestor = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
destAsset = "BTC"
)
)
.execute()
.get()
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
dest_asset_code | string | If present, the result will return only requests for specific destination asset |
🔒 📄 Get AML alerts requests
GET /request/aml_alerts HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "13927",
"paging_token": "13927",
"requestor": "GA5C3JAIJDIYPRRTZ5STBUHQXKUHR7RBGVD3T2E2N6HDOH7VDU6AYJOR",
"reviewer": "GA5C3JAIJDIYPRRTZ5STBUHQXKUHR7RBGVD3T2E2N6HDOH7VDU6AYJOR",
"reference": "-1525748521",
"reject_reason": "",
"hash": "517889a2460986d470aa7bcbf6959a0146f62bcf4884d68532fe15dbc76f39ff",
"details": {
"request_type_i": 8,
"request_type": "aml_alert",
"aml_alert": {
"balance_id": "BCZDGA2OJNNQ6ZRDHLDSZHHGYTVK7OWHK4DZ2JUUSFFURZXHJ4LYIQC5",
"amount": "1.000000",
"reason": "abc"
}
},
"created_at": "2018-08-20T13:55:17Z",
"updated_at": "2018-08-20T13:55:17Z",
"request_state_i": 1,
"request_state": "pending"
}
]
}
}
const { data } = await sdk.horizon.request.getAllForAmlAlerts({
requestor: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3',
state: 3 // approved
})
val requestsPage = api
.requests
.getAmlAlerts(
AmlAlertRequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
)
)
)
.execute()
.get()
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
🔒 📄 Get limits updates requests
GET /request/limits_updates HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "14045",
"paging_token": "14045",
"requestor": "GAQOUCVYJE76Z7R25GJOULIBDHW272P56F2KSVWSNOXSBVGD5BRKRTQJ",
"reviewer": "GA5C3JAIJDIYPRRTZ5STBUHQXKUHR7RBGVD3T2E2N6HDOH7VDU6AYJOR",
"reference": "d3168faf7ee0e3972e425f37d7a60bb53ed94d8406a92ba889346e4134cac657",
"reject_reason": "",
"hash": "978b264aa50d47ecdf617e0e3c88918a6dc4f88e05fc946417e5d68c9b272c68",
"details": {
"request_type_i": 6,
"request_type": "limits_update",
"limits_update": {
"document_hash": "0000000000000000000000000000000000000000000000000000000000000000",
"details": {
"asset": "100500",
"limits": {
"annualOut": "9223372036854.775807",
"dailyOut": "1000",
"monthlyOut": "15000",
"weeklyOut": "9223372036854.775807"
},
"note": "",
"operationType": "paymentOut",
"requestType": "initial",
"statsOpType": 1
}
}
},
"created_at": "2018-09-17T23:27:30Z",
"updated_at": "2018-09-17T23:27:30Z",
"request_state_i": 1,
"request_state": "pending"
}
]
}
}
const { data } = await sdk.horizon.request.getAllForLimitsUpdates({
requestor: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3',
state: 3 // approved
})
val requestsPage = api
.requests
.getLimitsUpdates(
LimitsUpdateRequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
)
)
)
.execute()
.get()
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
document_hash | string | If present, the result will return only requests with given document hash |
🔒 📄 Get update kyc requests
GET /request/update_kyc HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "7",
"paging_token": "7",
"requestor": "GCW3Y4ZOS3RN3VG62PF3YDSGJ7VC2HPZ5FCMFYIWBSOAIN6VOOKFDOEK",
"reviewer": "GA4CZMOLWKO6RBKT77V2W4JGKVKYHSUAATVDJYPUYVGTYQ7BLTVH5CBP",
"reference": "3b28a6c3766c6295adad976d349705ef49393fbfdebe4facb5862d2cdfa285d3",
"reject_reason": "",
"hash": "425450cffca2893a8f0b20fa8f002bae323352f5d08ccd4b82b6ed811bb82866",
"details": {
"request_type_i": 9,
"request_type": "update_kyc",
"two_step_withdrawal": null,
"limits_update": null,
"aml_alert": null,
"update_kyc": {
"account_to_update_kyc": "GCW3Y4ZOS3RN3VG62PF3YDSGJ7VC2HPZ5FCMFYIWBSOAIN6VOOKFDOEK",
"account_type_to_set": {
"int": 2,
"string": "general"
},
"kyc_level": 0,
"kyc_data": {
"blob_id": "JFGEF52BWPJ42D7D43NPJ5CKWL34Q2Q3TA4PGOEM4S5G6OEJ7J4A"
},
"all_tasks": 30,
"pending_tasks": 0,
"sequence_number": 0,
"external_details": [
{}
]
},
"update_sale_details": null
},
"created_at": "2018-05-19T16:29:58Z",
"updated_at": "2018-05-19T16:35:53Z",
"request_state_i": 3,
"request_state": "approved",
}
]
}
}
const { data } = await sdk.horizon.request.getAllForUpdateKyc({
requestor: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3',
state: 3, // approved
mask_set: 3,
account_to_update_kyc: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3'
})
val requestsPage = api
.requests
.getKycUpdates(
KycUpdateRequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
),
maskSet = 3,
accountToUpdateKyc = "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3"
)
)
.execute()
.get()
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
account_to_update_kyc | string | Should be a valid account ID . If present, the result will return only requests for specific account id. It may differ from requestor , if the request was raised by master signer |
account_type_to_set | number | Should be a valid account Type . If present, the result will return only requests for specific account type |
mask_set | number | Bit mask that defines what review tasks are still incomplete for the request. If present, the result will return only requests that has such incomplete tasks. |
mask_set_part_eq | number | If present, the result will return only requests that has such incomplete tasks and no others. |
mask_not_set | number | Bit mask that defines what review tasks are already complete for the request. If present, the result will return only requests that has such complete tasks. |
🔒 📄 Get update sale details requests
GET /request/update_sale_details HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "182",
"paging_token": "182",
"requestor": "GAIEBMXUPSGW2J5ELJFOY6PR5IWXXJNHIJSDKTDHK76HHRNYRL2QYU4O",
"reviewer": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"reference": "5b9cb779336c4e25a382b6785779a7313e388fa8944c6e267aeb0d5e9f475d3f",
"reject_reason": "",
"hash": "71e802e46a8a05deebf94c0859ffa746d4c07f6349d24e80bcf60e1701d60abc",
"details": {
"request_type_i": 10,
"request_type": "update_sale_details",
"two_step_withdrawal": null,
"limits_update": null,
"aml_alert": null,
"update_sale_details": {
"sale_id": 10,
"new_details": {
"description": "XZUXFXNYKU3DYN46RZITWRNDP6FAW2BDCY4JZEOMOKNZFBOYKJMA",
"logo": {
"key": "dpurah4inf7edjhcost7fvlmu3oygszwf7lho4e3h6rqujdxnpwfrkn3",
"type": "fund_logo"
},
"name": "2312321",
"short_description": "EVERYBODY LOVES KITTENS"
}
},
"update_sale_end_time": null,
"promotion_update_request": null
},
"created_at": "2018-05-15T20:31:28Z",
"updated_at": "2018-05-15T21:52:04Z",
"request_state_i": 3,
"request_state": "approved"
}
]
}
}
const { data } = await sdk.horizon.request.getAllForUpdateSaleDetails({
requestor: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3',
state: 3 // approved
})
val requestsPage = api
.requests
.getSaleDetailsUpdates(
SaleDetailsUpdateRequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
)
)
)
.execute()
.get()
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
🔒 📄 Get update sale end time requests
GET /request/update_sale_end_time HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "541",
"paging_token": "541",
"requestor": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"reviewer": "GD7AHJHCDSQI6LVMEJEE2FTNCA2LJQZ4R64GUI3PWANSVEO4GEOWB636",
"reference": "0f7863b0133107d29c816cc773ec59e748b97ce26895f40b01be8502c3e40383",
"reject_reason": "",
"hash": "f432f8383b26cc20f0bc4992da4b3139efd713d264ef0b62c9cff944082d064a",
"details": {
"request_type_i": 12,
"request_type": "update_sale_end_time",
"update_sale_end_time": {
"sale_id": 25,
"new_end_time": "2018-09-28T22:00:00Z"
}
},
"created_at": "2018-07-28T09:42:39Z",
"updated_at": "2018-07-28T09:42:39Z",
"request_state_i": 3,
"request_state": "approved"
}
]
}
}
const { data } = await sdk.horizon.request.getAllForUpdateSaleEndTime({
requestor: 'GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3',
state: 3 // approved
})
val requestsPage = api
.requests
.getSaleEndTimeUpdates(
SaleEndTimeUpdateRequestsParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
)
)
)
.execute()
.get()
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
reviewer | string | Should be a valid account ID . If present, the result will return only requests for specific reviewer (The documentation for possible reviewers is coming) |
requestor | string | Should be a valid account ID . If present, the result will return only requests for specific requestor |
state | number | If present, the result will return only requests for specific state. Pending - 1, Canceled - 2, Approved - 3, Rejected - 4, PermanentlyRejected - 5 |
updated_after | number | Should be a timestamp. If present, the result will return only requests, last updated after specific timestamp |
Assets
Get asset list
GET /assets HTTP/1.1
Content-Type: application/json
```json
[
{
"code": "ETH",
"owner": "GDGQI3SSB7N7YDBGWCZB3DT7SA23KJWDTYQB5HCYR5VP3EBD6CXQXXG4",
"available_for_issuance": "0.000000",
"preissued_asset_signer": "GAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHV4",
"max_issuance_amount": "1000000000.000000",
"issued": "1000000000.000000",
"pending_issuance": "0.000000",
"policy": 1,
"policies": [
{
"name": "AssetPolicyTransferable",
"value": 1
},
{
"name": "AssetPolicyWithdrawable",
"value": 8
}
],
"details": {
"logo": {
"key": "dpurgh4infnubjhcost7fvjkdwnvkcedflpqdxlxsc5nlsib4diraweq",
"name": "ethereum_logo.png",
"type": "image/png"
},
"name": "Ethereum",
"terms": {
"key": "",
"name": "",
"type": ""
}
}
},
{
"code": "BTC",
"owner": "GA4CZMOLWKO6RBKT77V2W4JGKVKYHSUAATVDJYPUYVGTYQ7BLTVH5CBP",
"available_for_issuance": "1000000000.000000",
"preissued_asset_signer": "GBZHP5662QGSAQITTND2VRMMEH5LCTUMGKQWZGG2BJ54IKWXVVTBT2HD",
"max_issuance_amount": "1000000000.000000",
"issued": "0.000000",
"pending_issuance": "0.000000",
"policy": 12,
"policies": [
{
"name": "AssetPolicyTransferable",
"value": 1
},
{
"name": "AssetPolicyWithdrawable",
"value": 8
}
],
"details": {
"logo": {
"key": "dpurgh4infnubjhcost7fvjkdwnvkcedflpqdxlxsc5nlsib4diraweq",
"name": "bitcoin_logo.png",
"type": "image/png"
},
"name": "Bitcoin",
"terms": {
"key": "",
"name": "",
"type": ""
}
}
}
]
const { data } = await sdk.horizon.assets.getAll()
val assets = api
.assets
.get()
.execute()
.get()
tokenDApi.assetsApi.requestAssets(
completion: { (result) in
switch result {
case .success(let assets):
let fetchedAssets = assets
case .failure(let error):
print(error)
}
})
Return all existing assets in the system. For more information, see Tokens management
Get asset by code
GET /assets/ETH HTTP/1.1
Content-Type: application/json
```json
{
"code": "ETH",
"owner": "GDGQI3SSB7N7YDBGWCZB3DT7SA23KJWDTYQB5HCYR5VP3EBD6CXQXXG4",
"available_for_issuance": "0.000000",
"preissued_asset_signer": "GAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHV4",
"max_issuance_amount": "1000000000.000000",
"issued": "1000000000.000000",
"pending_issuance": "0.000000",
"policy": 1,
"policies": [
{
"name": "AssetPolicyTransferable",
"value": 1
},
{
"name": "AssetPolicyWithdrawable",
"value": 8
}
],
"details": {
"logo": {
"key": "dpurgh4infnubjhcost7fvjkdwnvkcedflpqdxlxsc5nlsib4diraweq",
"name": "ethereum_logo.png",
"type": "image/png"
},
"name": "Ethereum",
"terms": {
"key": "",
"name": "",
"type": ""
}
}
}
const code = 'ETH'
const { data } = await sdk.horizon.assets.get(code)
val code = "CTOKEN"
val asset = api
.assets
.getByCode(code)
.execute()
.get()
Returns specific asset by it's code. For more information, see Tokens management
URL params
Parameter | Description |
---|---|
code | The code of the requested asset |
🔒 Get asset holders
GET /assets/ETH/holders HTTP/1.1
Content-Type: application/json
[
{
"balance_id": "BDZJQYMTKEHA3GDTJJSR5XPY22WHIOIRXWJMPZORZCDFD2EPDOJCROMJ",
"account_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"asset": "ETH",
"balance": "67.599908",
"locked": "17.300000",
"require_review": false
},
{
"balance_id": "BDFRWWJKEOEZJTQWWSKU3S7HG3WYC5T52RWS7AMA32YNYDI7SBV7RACZ",
"account_id": "GCUILXOKGUOZICOUA2XHOM43TXSFXHGCIM3PNYQ6UENNQW43NVA6V2SN",
"asset": "ETH",
"balance": "12.298382",
"locked": "0.000170",
"require_review": false
},
{
"balance_id": "BARU3EEP4GQFWOV3NHXWXEGY7BV7JPLZDS5KWBZWSZ5YMSDTTCAMOKEP",
"account_id": "GDGQI3SSB7N7YDBGWCZB3DT7SA23KJWDTYQB5HCYR5VP3EBD6CXQXXG4",
"asset": "ETH",
"balance": "108.760239",
"locked": "12.050000",
"require_review": false
},
{
"balance_id": "BCRW7JGPOC7R4CE2O3NTNYER6NB3G4UY4DIBSLX5AYLITXU3XTBPFUHC",
"account_id": "GDL3W5Z2B2JSET7CKKWRV3ICZL64Y3ZIPX2MMNJFXBCJOCMOSXCC7X4Y",
"asset": "ETH",
"balance": "65.500000",
"locked": "19.000000",
"require_review": false
}
]
const code = 'ETH'
const { data } = await sdk.horizon.assets.getHolders(code)
Return all created balances for this asset.
URL params
Parameter | Description |
---|---|
code | The code of the requested asset |
Asset pairs
Get asset pairs list
GET /assets_pairs HTTP/1.1
Content-Type: application/json
{
"base": "HHCT",
"quote": "BTC",
"current_price": "1.000000",
"physical_price": "1.000000",
"physical_price_correction": "0.000000",
"max_price_step": "0.000000",
"policy": 0,
"policies": null
},
{
"base": "ETH",
"quote": "USD",
"current_price": "294.470000",
"physical_price": "294.470000",
"physical_price_correction": "0.000000",
"max_price_step": "0.000000",
"policy": 0,
"policies": null
},
const { data } = await sdk.horizon.assetPairs.getAll()
val pairs = api
.assets
.getPairs()
.execute()
.get()
tokenDApi.assetPairsApi.requestAssetPairs(
completion: { (result) in
switch result {
case .success(let assetPairs):
let fetchedAssetPairs = assetPairs
case .failure(let error):
print(error)
}
})
Returns all existing asset pairs in the system
Get converted amount
GET /assets_pairs/convert HTTP/1.1
Content-Type: application/json
{
"amount": "44.000000"
}
const destAsset = 'ETH'
const sourceAsset = 'BTC'
const amount = '10'
const { data } = await sdk.horizon.assetPairs.convert({
source_asset: sourceAsset,
dest_asset: destAsset,
amount: amount
})
val amount = BigDecimal.TEN
val source = "BTC"
val dest = "ETH"
val convertedAmount = api
.assets
.convert(source, dest, amount)
.execute()
.get()
Converts amount from one asset to another.
Query params
Parameter | Description |
---|---|
dest_asset | The asset to convert to |
source_asset | The asset to convert from |
amount | The amount to convert |
Fees
Get fees
GET /fees HTTP/1.1
Content-Type: application/json
{
"fees": {
"BTC": [
{
"asset": "BTC",
"fixed": "0.000000",
"percent": "1.000000",
"fee_type": 4,
"subtype": 0,
"account_id": "",
"account_type": -1,
"lower_bound": "0.000000",
"upper_bound": "9223372036854.775807",
"fee_asset": "BTC",
"exists": true
},
...
],
"DASH": [
{
"asset": "DASH",
"fixed": "0.000000",
"percent": "1.000000",
"fee_type": 4,
"subtype": 0,
"account_id": "",
"account_type": -1,
"lower_bound": "0.000000",
"upper_bound": "9223372036854.775807",
"fee_asset": "DASH",
"exists": true
},
...
]
}
}
Returns list of all possible fees for all assets.
Get existing fees
GET /fees_overview HTTP/1.1
Content-Type: application/json
{
"fees": {
"BTC": [
{
"asset": "BTC",
"fixed": "0.000000",
"percent": "1.000000",
"fee_type": 4,
"subtype": 0,
"account_id": "",
"account_type": -1,
"lower_bound": "0.000000",
"upper_bound": "9223372036854.775807",
"fee_asset": "BTC",
"exists": true
}
],
"DAI": [
{
"asset": "DAI",
"fixed": "0.000000",
"percent": "1.000000",
"fee_type": 4,
"subtype": 0,
"account_id": "",
"account_type": -1,
"lower_bound": "0.000000",
"upper_bound": "9223372036854.775807",
"fee_asset": "DAI",
"exists": true
}
],
"DASH": [
{
"asset": "DASH",
"fixed": "0.000000",
"percent": "1.000000",
"fee_type": 4,
"subtype": 0,
"account_id": "",
"account_type": -1,
"lower_bound": "0.000000",
"upper_bound": "9223372036854.775807",
"fee_asset": "DASH",
"exists": true
}
],
"ETH": [
{
"asset": "ETH",
"fixed": "0.000000",
"percent": "1.000000",
"fee_type": 4,
"subtype": 0,
"account_id": "",
"account_type": -1,
"lower_bound": "0.000000",
"upper_bound": "9223372036854.775807",
"fee_asset": "ETH",
"exists": true
}
]
}
}
Returns list of existing fees for all assets.
Get fee by type
GET /fees/0?account=GDQNYWBSE3YIJOXVTB5YD6BLRATXYWKGFBSDTXVDQTUQHGSHRLK7EPAB&asset=SWM&amount=45&subtype=2 HTTP/1.1
Content-Type: application/json
{
"asset": "BTC",
"fixed": "0.000000",
"percent": "0.000000",
"fee_type": 0,
"subtype": 0,
"account_id": "",
"account_type": 0,
"lower_bound": "0.000000",
"upper_bound": "0.000000",
"fee_asset": "SWM",
"exists": true
}
val type = FeeType.PAYMENT_FEE
val params = FeeParams(
asset = "ETH",
amount = BigDecimal.TEN,
subtype = PaymentFeeType.OUTGOING,
accountId = "GDQNYWBSE3YIJOXVTB5YD6BLRATXYWKGFBSDTXVDQTUQHGSHRLK7EPAB"
)
val fee = api
.fees
.getByType(type, params)
.execute()
.get()
let feeType = FeeType(.paymentFee)
let accountId = "GDQNYWBSE3YIJOXVTB5YD6BLRATXYWKGFBSDTXVDQTUQHGSHRLK7EPAB"
let asset = "ETH"
let amount = 10
tokenDApi.generalApi.requestFee(
accountId: accountId,
asset: asset,
feeType: feeType,
amount: amount,
completion: { (result) in
switch result {
case failed(let error):
print(error)
case succeeded(let fee):
let fetchedFee = fee
}
})
Returns specific fee information.
URL params
Parameter | Description |
---|---|
type | Type of the fee |
Query params
Parameter | Type | Default | Description |
---|---|---|---|
account | string | ID of the account related to a payment operation | |
asset | string | Asset about to be spent | |
amount | double | Amount about to be spent | |
subtype | integer | Fee subtype, i.e. payment direction (send or receive) |
Sales
📄 Get sales
GET /sales HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"paging_token": "1",
"id": "1",
"owner_id": "GA4PTMB27RPMIIOBQEIMRY2J2IRTXUUNSYXWUBUDME3V4DVEGGHA4K7Z",
"base_asset": "CTOKEN",
"default_quote_asset": "SUN",
"start_time": "2018-01-29T11:00:00Z",
"end_time": "2018-07-15T10:00:00Z",
"soft_cap": "100000000.000000",
"hard_cap": "250000000.000000",
"details": {
"description": "VFVLJFCQCGFTGOP2U7WODZHHO5O2ST6FC43BY5XOQL5PRISL7EMQ",
"logo": {
"key": "dpurah4infbubjhcost7fvprh6ms6zoo5jokwuuhaz3spjkohcaiojm6",
"type": "image/png",
"url": "https://storage.testnet.tokend.org/api/dpurah4infbubjhcost7fvprh6ms6zoo5jokwuuhaz3spjkohcaiojm6"
},
"name": "Coin one token",
"short_description": "Here goes a short description",
"youtube_video_id": "B_G17r8-r2U"
},
"state": {
"name": "canceled",
"value": 4
},
"statistics": {
"investors": 0
},
"quote_assets": {
"quote_assets": [
{
"asset": "BTC",
"price": "0.000088",
"quote_balance_id": "BDQM4ERMCK6X3CJC3CIKQ6VKGGESUMHONLEPISPIV47JVDFQCRVVW27P",
"current_cap": "0.000000"
},
{
"asset": "ETH",
"price": "0.000844",
"quote_balance_id": "BAOCWSKEFZWW4RHGMJMRYJCGFFI7LAQP67XFLHZAH7V3GBK7CU4PEKHM",
"current_cap": "0.000000"
}
]
},
"base_hard_cap": "1.000000",
"base_current_cap": "0.000000",
"current_cap": "0.000000",
"sale_type": {
"name": "basic_sale",
"value": 1
}
}
...
]
}
}
val params = SalesParams(
pagingParams = PagingParams(
order = PagingOrder.DESC
),
openOnly = true
)
val salesPage = api
.sales
.getAll(params)
.execute()
.get()
tokenDApi.salesApi.getSales(
SaleResponse.self,
limit: 20,
cursor: nil,
page: nil,
owner: nil,
name: nil,
baseAsset: nil,
openOnly: nil,
completion: { (result) in
switch result {
case .failure(let error):
print("get sales failure: \(error)")
case .success(let sales):
let fetchedSales = sales
}
})
Returns sales that match specified filters.
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Default | Description |
---|---|---|---|
name | string | If present, the result will contain only sales with name contains specified string. Case is ignored | |
base_asset | string | If present, the result will contain only sales with base asset matches specified string. Case-sensitive | |
owner | string | Account ID. If present, the result will contain only sales owned by specified account | |
open_only | boolean | false | If set to true, the result will contain only open sales |
upcoming | boolean | false | If set to true, the result will contain unpcoming sales |
voting | boolean | false | If set to true, the result will contain sales on the voting phase |
promotions | boolean | false | If set to true, the result will contain sales on the promotion phase |
Get sale by ID
GET /sales/2 HTTP/1.1
Content-Type: application/json
{
"paging_token": "2",
"id": "2",
"owner_id": "GAA5WRH3KOAXZPW6PR3BKQSOG3KN3VAW2BO72PC6SHLSUSBW77DQHUB3",
"base_asset": "test",
"default_quote_asset": "USD",
"start_time": "2018-06-19T21:00:00Z",
"end_time": "2018-06-29T21:00:00Z",
"soft_cap": "1.000000",
"hard_cap": "2.000000",
"details": {
"description": "FAB6BK75TFNXPRULP6YUDYBMFZUKOEYBYNZPNGRHGDMVROVEJVJQ",
"logo": {
"key": "dpurah4infpebjhcost7fvnhjxlqgqdft3bamery2an3otqpbx6jbvdt",
"mime_type": "image/png",
"name": "TokenD - Demo - Images (1).png"
},
"name": "Pre-sale",
"short_description": "The best token",
"youtube_video_id": ""
},
"state": {
"name": "closed",
"value": 2
},
"statistics": {
"investors": 3
},
"quote_assets": {
"quote_assets": [
{
"asset": "ETH",
"price": "0.000383",
"quote_balance_id": "BDZJQYMTKEHA3GDTJJSR5XPY22WHIOIRXWJMPZORZCDFD2EPDOJCROMJ",
"current_cap": "0.003821",
"total_current_cap": "0.003822",
"hard_cap": "0.008754"
}
]
},
"base_hard_cap": "10.000000",
"base_current_cap": "0.000000",
"current_cap": "0.872974",
"sale_type": {
"name": "crowd_funding",
"value": 2
}
}
val id = 2
val sale = api
.sales
.getById(id)
.execute()
.get()
Returns detailed information about the sale with specified ID.
Path params
Parameter | Description |
---|---|
id | The ID of the sale |
🔒 📄 Get sale antes
GET /sale_antes?sale_id=39&participant_balance_id=BDDS7UEGTAYFV2R5IH2WRZGXOWZ4YUD2NJUTHCTOK2CWSL3J2DQQRIG6 HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"paging_token": "",
"sale_id": "39",
"participant_balance_id": "BDDS7UEGTAYFV2R5IH2WRZGXOWZ4YUD2NJUTHCTOK2CWSL3J2DQQRIG6",
"amount": "1.000001",
"asset_code": "BTC"
}
]
}
}
val balanceId = "BDDS7UEGTAYFV2R5IH2WRZGXOWZ4YUD2NJUTHCTOK2CWSL3J2DQQRIG6"
val saleId = 2
val params = AntesParams(
participantBalanceId = balanceId,
saleId = saleId
)
val antesPage = signedApi
.sales
.getAntes(params)
.execute()
.get()
Returns list of charged antes.
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Default | Description |
---|---|---|---|
sale_id | integer | If present, the result will contain only antes for specified sale | |
participant_balance_id | string | Balance ID. If present, the result will contain only antes for specified balance |
Trades
📄 Get order book
GET /order_book?base_asset=RTOKEN"e_asset=ETH&is_buy=true HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"paging_token": "800000",
"base_asset_code": "RTOKEN",
"quote_asset_code": "ETH",
"is_buy": true,
"base_amount": "0.900000",
"quote_amount": "0.720000",
"price": "0.800000",
"created_at": "2018-05-24T12:55:03Z"
}
]
}
}
val params = OrderBookParams(
baseAsset = "RTOKEN",
quoteAsset = "ETH",
isBuy = true,
pagingParams = PagingParams(
order = PagingOrder.DESC
)
)
val orderBookPage = api
.trades
.getOrderBook(params)
.execute()
.get()
tokenDApi.orderBookApi.requestOrderBook(
parameters: OrderBookRequestParameters(
isBuy: true,
baseAsset: "BTC",
quoteAsset: "ETH"
),
completion: { (result) in
switch result {
case .success(let orderBook):
let fetchedOrderBook = orderBook
case .failure(let error):
print(error)
}
})
Returns order book – a list of active orders for given asset pair.
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Default | Description |
---|---|---|---|
base_asset | string | Required Base asset of the pair |
|
quote_asset | string | Required Quote asset of the pair |
|
is_buy | boolean | false | Filters the result items by is_buy property |
order_book_id | integer | If present, the result will contain only items from certain order book. For secondary market use 0 |
📄 Get matched orders
GET /trades?base_asset=RTOKEN"e_asset=ETH HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"paging_token": "8",
"id": 8,
"base_asset": "RTOKEN",
"base_amount": "9572.466257",
"price": "0.000163",
"created_at": "2018-04-20T16:48:28Z"
},
...
]
}
}
Returns list of matched orders for given asset pair.
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Default | Description |
---|---|---|---|
base_asset | string | Required Base asset of the pair |
|
quote_asset | string | Required Quote asset of the pair |
|
order_book_id | integer | If present, the result will contain only items from certain order book. For secondary market use 0 |
📄 Get history offers
GET /history_offers?base_asset=RTOKEN"e_asset=ETH HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"paging_token": "1",
"offer_id": "1",
"owner_id": "GATQO5RZVK4532DWHWQVMERXGEVDVRVYJNP723ITWIYJPNDK7SJBSAS7",
"base_asset": "RTOKEN",
"quote_asset": "ETH",
"is_buy": false,
"initial_base_amount": "30.000000",
"current_base_amount": "0.000000",
"price": "26.000000",
"is_canceled": false,
"created_at": "2007-10-17T16:38:27Z"
},
{
"paging_token": "2",
"offer_id": "2",
"owner_id": "GBEULOETHHHW5LEZJ7S3THG2W5OQLEMTSDETTPMVHO36OLFXHNCIC4YV",
"base_asset": "RTOKEN",
"quote_asset": "ETH",
"is_buy": true,
"initial_base_amount": "50.000000",
"current_base_amount": "20.000000",
"price": "26.000000",
"is_canceled": false,
"created_at": "2007-10-17T16:38:32Z"
},
}
}
Returns list of all orders for given asset pair on secondary market.
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Description |
---|---|---|
base_asset | string | Base asset of the pair (required) |
quote_asset | string | Quote asset of the pair (required) |
owner_id | string | Public key of account (56 symbols) (required) |
Key-value storage
Get key-value entries
GET /key_value HTTP/1.1
Content-Type: application/json
[
{
"key": "issuance_tasks:ETH",
"type": {
"name": "uint32",
"value": 1
},
"uint32_value": 0
},
{
"key": "issuance_tasks:DAI",
"type": {
"name": "uint32",
"value": 1
},
"uint32_value": 0
},
...
]
val keyEntries = api
.keyValueEntries
.getEntries()
.execute()
.get()
Returns list of key-value entries.
Get key-value entry by key
GET /key_value/issuance_tasks:ETH HTTP/1.1
Content-Type: application/json
{
"key": "issuance_tasks:ETH",
"type": {
"name": "uint32",
"value": 1
},
"uint32_value": 0
}
val key = "issuance_tasks:ETH"
val keyEntry = api
.keyValueEntries
.getEntryByKey(key)
.execute()
.get()
Returns an entry with the specified key.
Path params
Parameter | Description |
---|---|
key | The key of the entry |
Investment token sales
📄 Get investment token sales
GET /investment_token_sales HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "2",
"paging_token": "2",
"owner_id": "GA4PTMB27RPMIIOBQEIMRY2J2IRTXUUNSYXWUBUDME3V4DVEGGHA4K7Z",
"base_asset": "CTOKEN",
"base_balance": "BDPFMWHLSVG5AF22OSGYLOIWT5TSWBX6EULADLGRRQLV4FQL33VJEPO3",
"amount_to_be_sold": "10000.000000",
"available_amount": "5000.000000",
"details": {
"description": "PDZJG53GCRTI5PNALHZIYFRZU6QOQLJROVPLJ44E3Z43WTZIFHZA",
"logo": {
"key": "dpurex4infgubjhcost7fvpa7hvmycjbmkjk4l3pp3e3dzm3psbpadkm",
"mime_type": "image/png",
"name": "Screen Shot 2018-10-29 at 13.14.14.png"
},
"name": "Coin one token",
"short_description": "Here goes a short description",
"youtube_video_id": "B_G17r8-r2U"
},
"quote_assets": [
{
"quote_asset": "BLN",
"price": "0.002388",
"quote_balance": "BDQTQXFGLB6SXVJMC6TK7KFFJ4NVVPYJXI3PEFWIAUZ34PNITGT5V37S"
},
{
"quote_asset": "ETH",
"price": "0.000844",
"quote_balance": "BDDEUXOJWGFIE44RHMFJRINMOKOPGGZ2Y7UDOHKUR3O6Y3OO3XN6BNCN"
}
],
"trading_start_date": "2018-10-29T17:00:00Z",
"settlement_start_date": "2018-10-30T09:00:00Z",
"settlement_end_date": "2018-10-31T10:00:00Z",
"default_redemption_asset": "BLN",
"settlement_options": null,
"is_prolongation_allowed": true
},
...
]
}
}
Returns sales that match specified filters.
The request returns data in multiple pages, for more information, see Pagination
Query params
Parameter | Type | Default | Description |
---|---|---|---|
name | string | If present, the result will contain only sales with name contains specified string. Case is ignored | |
base_asset | string | If present, the result will contain only sales with base asset matches specified string. Case-sensitive | |
owner | string | Account ID. If present, the result will contain only sales owned by specified account | |
open_only | boolean | false | If set to true, the result will contain only open sales |
Get investment token sale by ID
GET /investment_token_sales/2 HTTP/1.1
Content-Type: application/json
{
"id": "2",
"paging_token": "2",
"owner_id": "GA4PTMB27RPMIIOBQEIMRY2J2IRTXUUNSYXWUBUDME3V4DVEGGHA4K7Z",
"base_asset": "CTOKEN",
"base_balance": "BDPFMWHLSVG5AF22OSGYLOIWT5TSWBX6EULADLGRRQLV4FQL33VJEPO3",
"amount_to_be_sold": "10000.000000",
"available_amount": "5000.000000",
"details": {
"description": "PDZJG53GCRTI5PNALHZIYFRZU6QOQLJROVPLJ44E3Z43WTZIFHZA",
"logo": {
"key": "dpurex4infgubjhcost7fvpa7hvmycjbmkjk4l3pp3e3dzm3psbpadkm",
"mime_type": "image/png",
"name": "Screen Shot 2018-10-29 at 13.14.14.png"
},
"name": "Coin one token",
"short_description": "Here goes a short description",
"youtube_video_id": "B_G17r8-r2U"
},
"quote_assets": [
{
"quote_asset": "BLN",
"price": "0.000088",
"quote_balance": "BDQTQXFGLB6SXVJMC6TK7KFFJ4NVVPYJXI3PEFWIAUZ34PNITGT5V37S"
},
{
"quote_asset": "ETH",
"price": "0.000844",
"quote_balance": "BDDEUXOJWGFIE44RHMFJRINMOKOPGGZ2Y7UDOHKUR3O6Y3OO3XN6BNCN"
}
],
"trading_start_date": "2018-10-29T17:00:00Z",
"settlement_start_date": "2018-10-30T09:00:00Z",
"settlement_end_date": "2018-10-31T10:00:00Z",
"default_redemption_asset": "BLN",
"settlement_options": null,
"is_prolongation_allowed": true
}
Returns detailed information about the sale with specified ID.
Path params
Parameter | Description |
---|---|
id | The ID of the sale |
Settlement options
GET /settlement_options HTTP/1.1
Content-Type: application/json
{
"_links": {
...
},
"_embedded": {
"records": [
{
"id": "1",
"paging_token": "1",
"sale_id": "2",
"investor_id": "GA4PTMB27RPMIIOBQEIMRY2J2IRTXUUNSYXWUBUDME3V4DVEGGHA4K7Z",
"action": {
"name": "redeem",
"value": 1
},
"redemption_asset": "USD"
}
]
}
}
Returns detailed information about the settlement option.
Path params
Parameter | Description |
---|---|
sale_id | The ID of the sale. Optional. |
investor | Account ID of investor. Required. |