> For the complete documentation index, see [llms.txt](https://docs.xcash.foundation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xcash.foundation/api/xpayment-twitter.md).

# X-Payment Twitter

Note zachys (atomic units) are 10^6 in X-Cash

## Stats <a href="#stats" id="stats"></a>

This method gets the stats

**URL**: <https://api.xcash.foundation/v1/xpayment-twitter/twitter/unauthorized/stats/>

**Method**: GET

**Inputs**: *None*.

**Results**:

* *totalUsers* - unsigned int; Total users registered.
* *avgTipAmount* - unsigned int; Average tip amount sent in zachys (atomic units).
* *totalDeposits* - unsigned int; Total deposits.
* *totalWithdraws* - unsigned int; Total withdraws.
* *totalTipsPublic* - unsigned int; Total public tips sent.
* *totalTipsPrivate* - unsigned int; Total private tips sent.
* *totalVolumeSentPublic* - unsigned long long; Total volume sent for public tips, in zachys (atomic units).
* *totalVolumeSentPrivate* - unsigned long long; Total volume sent for private tips, in zachys (atomic units).
* *totalTipsLastDayPublic* - unsigned int; Total public tips sent in last day.
* *totalTipsLastDayPrivate* - unsigned int; Total private tips sent in last day.
* *totalVolumeSentLastDayPublic* - unsigned long long; Total volume sent for public tips in last day, in zachys (atomic units).
* *totalVolumeSentLastDayPrivate* - unsigned long long; Total volume sent for private tips in last day, in zachys (atomic units).
* *totalTipsLastHourPublic* - unsigned int; Total public tips sent in last hour.
* *totalTipsLastHourPrivate* - unsigned int; Total private tips sent in last hour.
* *totalVolumeSentLastHourPublic* - unsigned long long; Total volume sent for public tips in last hour, in zachys (atomic units).
* *totalVolumeSentLastHourPrivate* - unsigned long long; Total volume sent for private tips in last hour, in zachys (atomic units).

```bash
$ curl -X GET https://api.xcash.foundation/v1/xpayment-twitter/twitter/unauthorized/stats/ -H 'Accept: application/json'
{
  "totalUsers": 7,
  "avgTipAmount": 10,
  "totalDeposits": 5,
  "totalWithdraws": 17,
  "totalTipsPublic": 7,
  "totalTipsPrivate": 10,
  "totalVolumeSentPublic": 500000000,
  "totalVolumeSentPrivate": 1000000000,
  "totalTipsLastDayPublic": 7,
  "totalTipsLastDayPrivate": 10,
  "totalVolumeSentLastDayPublic": 500000000,
  "totalVolumeSentLastDayPrivate": 1000000000,
  "totalTipsLastHourPublic": 7,
  "totalTipsLastHourPrivate": 10,
  "totalVolumeSentLastHourPublic": 500000000,
  "totalVolumeSentLastHourPrivate": 1000000000
}
```

## Stats Per Day <a href="#stats-per-day" id="stats-per-day"></a>

This method gets the daily amount of payments and volumes sent per day

**URL**: <https://api.xcash.foundation/v1/xpayment-twitter/twitter/unauthorized/statsPerDay/{start}/{limit}>

**Method**: GET

**Resources**:

* *start* - **Required** - The start day to return data (Default is 1, the first start day).
* *limit* - **Required** - The maximum amount of days to return (Default is all).

**Inputs**: *None*.

**Results**:

Array of objects with the following structure:

* *time* - unsigned int; Total users registered.
* *amount* - unsigned long long; Total tips sent.
* *volume* - unsigned long long; Total volume sent in zachys (atomic units).

```bash
$ curl -X GET https://api.xcash.foundation/v1/xpayment-twitter/twitter/unauthorized/statsPerDay/1/2/ -H 'Accept: application/json'
[
  {
    "time": 1654228489,
    "amount": 100,
    "volume": 100000000
  },
  {
    "time": 1654228489,
    "amount": 100,
    "volume": 100000000
  }
]
```

## Top Stats <a href="#top-stats" id="top-stats"></a>

This method gets the top users for tips and volume

**URL**: <https://api.xcash.foundation/v1/xpayment-twitter/twitter/unauthorized/topStats/{amount}>

**Method**: GET

**Resources**:

* *amount* - not required - The amount of items to return (Default is 10).

**Inputs**: *None*.

**Results**:

* *topTips* - Array of objects with the following structure:
  * *username* - string; The username.
  * *tips* - unsigned int; Total tips sent.
* *topVolumes* - Array of objects with the following structure:
  * *username* - string; The username.
  * *volume* - unsigned long long; Total volume sent in zachys (atomic units).

```bash
$ curl -X GET https://api.xcash.foundation/v1/xpayment-twitter/twitter/unauthorized/topStats/2 -H 'Accept: application/json'
{
  "topTips": [
    {
      "username": "test1",
      "tips": 105
    },
    {
      "username": "test2",
      "tips": 100
    }
  ],
  "topVolumes": [
    {
      "username": "test1",
      "volume": 105000000
    },
    {
      "username": "test2",
      "volume": 100000000
    }
  ]
}
```

## Recent Tips <a href="#recent-tips" id="recent-tips"></a>

This method gets the recent tips

**URL**: <https://api.xcash.foundation/v1/xpayment-twitter/twitter/unauthorized/recentTips/{amount}>

**Method**: POST

**Resources**:

* *amount* - not required - The amount of items to return (Default is 10).

**Inputs (All are required)**:

* *sort* - "First" for most recent tips, "Last" for the least recent tips.
* *type* - "Public" for only public transactions, "Private" for only private transactions, "All" for both.

**Results**:

Array of objects with the following structure:

* *tweetId* - string; The tweet id.
* *fromUser* - string; The username who sent the tip.
* *toUser* - string; The username who received the tip.
* *amount* - unsigned long long; The anount of the tip in zachys (atomic units).
* *time* - unsigned int; The time.
* *type* - string; The tip type.

```bash
$ curl -X POST https://api.xcash.foundation/v1/xpayment-twitter/twitter/unauthorized/recentTips/2 -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Content-Type: application/json'  -d '{"sort":"First","type":"All"}'
[
  {
    "tweetId": "",
    "fromUser": "",
    "toUser": "",
    "amount": 0,
    "time": 1654204410,
    "type": "private"
  },
  {
    "tweetId": "1531918830276075521",
    "fromUser": "test1",
    "toUser": "test",
    "amount": 5000000,
    "time": 1654195778,
    "type": "public"
  }
]
```
