This endpoint represents all effects that changed a given
account. It will return relevant effects from the creation of the
account to the current ledger.
This endpoint can also be used in streaming mode so it is possible to use it to
listen for new effects as transactions happen in the Stellar network.
If called in streaming mode Horizon will start at the earliest known effect unless a cursor
is
set. In that case it will start from the cursor
. You can also set cursor
value to now
to only
stream effects created since your request time.
Request
GET /accounts/{account}/effects{?cursor,limit,order}
Arguments
name |
notes |
description |
example |
account |
required, string |
Account ID |
GA2HGBJIJKI6O4XEM7CZWY5PS6GKSXL6D34ERAJYQSPYA6X6AI7HYW36 |
?cursor |
optional, default null |
A paging token, specifying where to start returning records from. When streaming this can be set to now to stream object created since your request time. |
12884905984 |
?order |
optional, string, default asc |
The order in which to return rows, “asc” or “desc”. |
asc |
?limit |
optional, number, default 10 |
Maximum number of records to return. |
200 |
curl Example Request
curl "https://horizon-testnet.stellar.org/accounts/GA2HGBJIJKI6O4XEM7CZWY5PS6GKSXL6D34ERAJYQSPYA6X6AI7HYW36/effects?limit=1"
JavaScript Example Request
var StellarSdk = require('stellar-sdk');
var server = new StellarSdk.Server('https://horizon-testnet.stellar.org');
server.effects()
.forAccount("GA2HGBJIJKI6O4XEM7CZWY5PS6GKSXL6D34ERAJYQSPYA6X6AI7HYW36")
.call()
.then(function (effectResults) {
// page 1
console.log(effectResults.records)
})
.catch(function (err) {
console.log(err)
})
JavaScript Streaming Example
var StellarSdk = require('stellar-sdk')
var server = new StellarSdk.Server('https://horizon-testnet.stellar.org');
var effectHandler = function (effectResponse) {
console.log(effectResponse);
};
var es = server.effects()
.forAccount("GA2HGBJIJKI6O4XEM7CZWY5PS6GKSXL6D34ERAJYQSPYA6X6AI7HYW36")
.cursor('now')
.stream({
onmessage: effectHandler
})
Response
The list of effects.
Example Response
{
"_links": {
"self": {
"href": "https://horizon-testnet.stellar.org/accounts/GA2HGBJIJKI6O4XEM7CZWY5PS6GKSXL6D34ERAJYQSPYA6X6AI7HYW36/effects?cursor=&limit=1&order=asc"
},
"next": {
"href": "https://horizon-testnet.stellar.org/accounts/GA2HGBJIJKI6O4XEM7CZWY5PS6GKSXL6D34ERAJYQSPYA6X6AI7HYW36/effects?cursor=1919197546291201-1&limit=1&order=asc"
},
"prev": {
"href": "https://horizon-testnet.stellar.org/accounts/GA2HGBJIJKI6O4XEM7CZWY5PS6GKSXL6D34ERAJYQSPYA6X6AI7HYW36/effects?cursor=1919197546291201-1&limit=1&order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"operation": {
"href": "https://horizon-testnet.stellar.org/operations/1919197546291201"
},
"succeeds": {
"href": "https://horizon-testnet.stellar.org/effects?order=desc&cursor=1919197546291201-1"
},
"precedes": {
"href": "https://horizon-testnet.stellar.org/effects?order=asc&cursor=1919197546291201-1"
}
},
"id": "0001919197546291201-0000000001",
"paging_token": "1919197546291201-1",
"account": "GA2HGBJIJKI6O4XEM7CZWY5PS6GKSXL6D34ERAJYQSPYA6X6AI7HYW36",
"type": "account_created",
"type_i": 0,
"created_at": "2019-03-25T22:43:38Z",
"starting_balance": "10000.0000000"
}
]
}
}
Possible Errors
Edit this doc in GitHub