Fetch Account Transactions
Get the transactions from the user's account.
Request Url
GET
https://api.catapult.inetwork.com/v1/users/{userId}/account/transactions
Query Parameters
Parameter | Description | Mandatory |
---|---|---|
maxItems | Limit the number of transactions that will be returned. | No |
fromDate | Return only transactions that are newer than the parameter. Format: "yyyy-MM-dd'T'HH:mm:ssZ" | No |
toDate | Return only transactions that are older than the parameter. Format: "yyyy-MM-dd'T'HH:mm:ssZ" | No |
type | Return only transactions that are this type. | No |
page | Used for pagination to indicate the page requested for querying a list of transactions. If no value is specified the default is 0. | No |
size | Used for pagination to indicate the size of each page requested for querying a list of transactions. If no value is specified the default value is 25 (maximum value 1000). | No |
number | Return only transactions that are from the specified number. | No |
Transaction Properties
PROPERTY | DESCRIPTION |
---|---|
id | The unique identifier for the transaction. |
time | The time the transaction was processed. |
amount | The transaction amount in dollars, as a string; the currency symbol is not included. |
type | The type of transaction. |
units | The number of product units the transaction charged or credited. |
productType | The product the transaction was related to (not all transactions are related to a product). |
number | The phone number the transaction was related to (not all transactions are related to a phone number). |
Transaction Types
TYPE | DESCRIPTION |
---|---|
charge | A charge for the use of a service or resource (for example, phone calls, SMS messages, phone numbers). |
payment | A payment you made to increase your account balance. |
credit | An increase to your account balance that you did not pay for (for example, an initial account credit or promotion). |
auto-recharge | An automated payment made to keep your account balance above the minimum balance you configured. |
Product Types
Type | Description |
---|---|
local-number-per-month | The monthly charge for a local phone number. |
toll-free-number-per-month | The monthly charge for a toll-free phone number. |
sms-in | A SMS message that came in to one of your numbers. |
sms-out | A SMS message that was sent outbound one of your numbers. |
mms-in | A MMS message that was sent to one of your numbers. |
mms-out | A MMS message that was sent outbound one of your numbers. |
call-in | An inbound phone call to one of your numbers. |
call-out | An outbound phone call that was created by your app. |
sip-call-in | A phone call that came inbound via SIP to one of your registered endpoints. |
sip-call-out | A phone call made outbound to a SIP address. |
transcription | A transcription of a recorded call. |
cnam-search | A CNAM lookup request for a phone number. |
Example 1 of 6: Get transactions
curl -v -X GET https://api.catapult.inetwork.com/v1/users/{user-id}/account/transations -u {{apiToken}}:{secret} -H "Content-type: application/json"
//Promise
client.Account.getTransactions()
.then(function (response) {
console.log(response.transactions);
if(response.hasNextPage) {
return response.getNextPage();
}
else {
return {transactions: []};
}
})
.then(function(response) {
console.log(response.transactions);
});
var transactions = client.Account.GetTransactions();
var firstTransaction = transactions.First();
Console.WriteLine($"{firstTransaction.Type} - ${firstTransaction.Amount}");
// charge - 0.00750
transactions = Account.get_transactions(client)
first_transaction = transactions.next
first_transaction_amount = first_transaction[:amount]
The above command returns JSON structured like this:
[
{
"id": "{transactionId1}",
"time": "2013-02-21T13:39:09.122Z",
"amount": "0.00750",
"type": "charge",
"units": 1,
"productType": "sms-out",
"number": "{number}"
},
{
"id": "{transactionId2}",
"time": "2013-02-21T13:37:42.079Z",
"amount": "0.00750",
"type": "charge",
"units": 1,
"productType": "sms-out",
"number": "{number}"
}
]
Example 2 of 6: Get transactions by date
curl -v -X GET https://api.catapult.inetwork.com/v1/users/{user-id}/account/transations?fromDate=2013-02-21T13:38:00 -u {{apiToken}}:{secret} -H "Content-type: application/json"
//Get transactions filtering by date
//Promise
var params = {
fromDate: "2013-02-21T13:38:00"
};
client.Account.getTransactions(params)
.then(function (response) {
console.log(response.transactions);
if(response.hasNextPage) {
return response.getNextPage();
}
else {
return {transactions: []};
}
})
.then(function(response) {
console.log(response.transactions);
});
var transactions = await client.Account.GetTransactions(
new AccountTransactionQuery {
FromDate = new DateTime(2013, 2, 21, 13, 38, 0, 0, DateTimeKind.Utc)
}
);
transactions = Account.get_transactions(client, {:from_date => "2013-02-21T13:38:00"})
The above command returns JSON structured like this:
[
{
"id": "{transactionId}",
"time": "2013-02-21T13:39:09.122Z",
"amount": "0.00750",
"type": "charge",
"units": 1,
"productType": "sms-out",
"number": "{number}"
}
]
Example 3 of 6: Get transactions filtering by date
curl -v -X GET "https://api.catapult.inetwork.com/v1/users/{user-id}/account/transations?toDate=2013-02-21T13:40:00&fromDate=2013-02-21T13:38:00" -u {{apiToken}}:{secret} -H "Content-type: application/json"
//Get transactions filtering by date
//Promise
var params = {
fromDate: "2013-02-21T13:38:00",
toDate: "2013-02-21T13:40:00"
};
client.Account.getTransactions(params)
.then(function (response) {
console.log(response.transactions);
if(response.hasNextPage) {
return response.getNextPage();
}
else {
return {transactions: []};
}
})
.then(function(response) {
console.log(response.transactions);
});
var transactions = client.Account.GetTransactions(new AccountTransactionQuery {
FromDate = new DateTime(2013, 2, 21, 13, 38, 0, 0, DateTimeKind.Utc),
ToDate = new DateTime(2013, 2, 21, 13, 40, 0, 0, DateTimeKind.Utc)
});
transactions = Account.get_transactions(client, {:from_date => "2013-02-21T13:38:00", :to_date => "2013-02-21T13:40:00"})
The above command returns JSON structured like this:
[
{
"id": "{transactionId}",
"time": "2013-02-21T13:39:09.122Z",
"amount": "0.00750",
"type": "charge",
"units": 1,
"productType": "sms-out",
"number": "{number}"
}
]
Example 4 of 6: Get transactions by number
curl -v -X GET https://api.catapult.inetwork.com/v1/users/{user-id}/account/transations?number=+19191231234 -u {{apiToken}}:{secret} -H "Content-type: application/json"
//Get transactions limiting result
//Promise
var params = {
number: '+19191231234'
}
client.Account.getTransactions(params)
.then(function (response) {
console.log(response.transactions);
if(response.hasNextPage) {
return response.getNextPage();
}
else {
return {transactions: []};
}
})
.then(function(response) {
console.log(response.transactions);
});
var transactions = await client.Account.GetTransactions(
new AccountTransactionQuery {
Number = '+19191231234'
}
);
transactions = Account.get_transactions(client, {:number => "+19191231234"})
The above command returns JSON structured like this:
[
{ "id": "{transactionId1}",
"time": "2017-05-30T20:45:10Z",
"amount": "0.005",
"type": "charge",
"units": 1,
"productType": "sms-out",
"number": "+19191231234",
"resourceId": "m-asdf" },
{ "id": "{transactionId2}",
"time": "2017-05-30T20:47:36Z",
"amount": "0.015",
"type": "charge",
"units": 1,
"productType": "mms-out",
"number": "+19191231234",
"resourceId": "m-asdf" },
{ "id": "{transactionId3}",
"time": "2017-05-30T20:57:13Z",
"amount": "0.06",
"type": "charge",
"units": 6,
"productType": "call-out",
"number": "+19191231234",
"resourceId": "c-asdf" }
]
Example 5 of 6: Get transactions limiting number of results
curl -v -X GET https://api.catapult.inetwork.com/v1/users/{user-id}/account/transations?maxItems=1 -u {{apiToken}}:{secret} -H "Content-type: application/json"
//Get transactions limiting result
//Promise
var params = {
maxItems: 1
};
client.Account.getTransactions(params)
.then(function (response) {
console.log(response.transactions);
if(response.hasNextPage) {
return response.getNextPage();
}
else {
return {transactions: []};
}
})
.then(function(response) {
console.log(response.transactions);
});
var transactions = client.Account.GetTransactions(new AccountTransactionQuery {
MaxItem = 1
});
transactions = Account.get_transactions(client, {:max_item => 1})
The above command returns JSON structured like this:
[
{
"id": "{transactionId}",
"time": "2013-02-21T13:39:09.122Z",
"amount": "0.00750",
"type": "charge",
"units": 1,
"productType": "sms-out",
"number": "{number}"
}
]
Example 6 of 6: Get transactions by payment type
curl -v -X GET https://api.catapult.inetwork.com/v1/users/{user-id}/account/transations?type=Payment -u {{apiToken}}:{secret} -H "Content-type: application/json"
//Get transactions of `payment` type
//Promise
var params = {
type: "Payment"
};
client.Account.getTransactions(params)
.then(function (response) {
console.log(response.transactions);
if(response.hasNextPage) {
return response.getNextPage();
}
else {
return {transactions: []};
}
})
.then(function(response) {
console.log(response.transactions);
});
var transactions = client.Account.GetTransactions(new AccountTransactionQuery {
Type = AccountTransactionType.Payment
});
transactions = Account.get_transactions(client, {:type => "payment"})
The above command returns JSON structured like this:
[
{
"id": "{transactionId1}",
"time": "2013-02-15T18:43:50.602Z",
"amount": "1000.00000",
"type": "payment",
"units": 0
},
{
"id": "{transactionId2}",
"time": "2013-02-05T14:56:51.279Z",
"amount": "5000.00000",
"type": "payment",
"units": 0
}
]