# get_site_email_credit_stats

Source: https://modulify.ai/docs/mcp/emails/get-site-email-credit-stats

Counts the AI credits a site's email used over a period and the extra emails they bought.

- Title: Count the credits a site spent on email over time
- Scope: `config:read`
- Access: Read only

It counts them the way the **Credits** view of the **Insights** tab shows them: `credits` and `emails` for the whole window, after any refunds, and `days` with one entry per hour, day or month, as `interval` says. `windowDays` says how many days the window spans. Pass `period`, or `from` and `to` for a custom range, and leave all three out for `30d`. See [Credits spent on email](https://modulify.ai/docs/automations/emails#credits-spent-on-email).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `period` | string | No | One of `day`, `24h`, `7d`, `30d`, `90d`, `12mo` or `all`. `day` is today so far, from midnight UTC, `24h` is the current hour and the 23 before it, `7d`, `30d` and `90d` are the last 7, 30 and 90 days counting today, `12mo` is this month and the 11 before it, and `all` reaches back to the first record. Defaults to `30d`, and is left out when you send `from` and `to`. |
| `from` | string | No | The first day of a custom range as `YYYY-MM-DD` in UTC, sent together with `to`. |
| `to` | string | No | The last day of a custom range as `YYYY-MM-DD` in UTC, included in the range and sent together with `from`. |