# get_deploy_hook_call_stats

Source: https://modulify.ai/docs/api/deploy-hooks/get-deploy-hook-call-stats

Counts the calls to a site's deploy hooks over a period, split into builds started, already building and rejected.

- Title: Count deploy hook calls over time
- Scope: `config:read`
- Access: Read only
- Endpoint: `POST /v1/get_deploy_hook_call_stats`

Rejected covers every call that started nothing for another reason, `disabled`, `refused`, `rate-limited` and `failed`. The response holds `totals` for the whole window and `days`, one entry per hour, day or month as `interval` says, each with `total`, `started`, `alreadyBuilding` and `rejected`. Entries with no calls come back as zeros, so the list always covers the full window, and `windowDays` says how many days it spans.

`period` takes the same choices as the date pickers in Modulify. Send `from` and `to` instead for a custom range, at most 3,660 days apart, and leave all three out for `30d`.

Pass a `hookId` to count one hook only. Calls removed from the log are not counted. See [Deploy hooks](https://modulify.ai/docs/automations/deploy-hooks#read-the-insights).

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/get_deploy_hook_call_stats`, sending the inputs below as a JSON object. The token needs the `config:read` scope.

It only reads and changes nothing, so retrying it is safe.

```bash
curl -X POST https://api.modulify.ai/v1/get_deploy_hook_call_stats \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID"}'
```

Over MCP, the same method is the [get_deploy_hook_call_stats tool](https://modulify.ai/docs/mcp/deploy-hooks/get-deploy-hook-call-stats).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `hookId` | string | No | Only this hook, by its id from `list_deploy_hooks`. Leave it out for every hook on the site. |
| `period` | string | No | `day` is today so far, from midnight UTC, `24h` the current hour and the 23 before it, `7d`, `30d` and `90d` the last 7, 30 and 90 days counting today, `12mo` this month and the 11 before it, and `all` everything back to the first call. Leave it out when sending `from` and `to`. Defaults to `30d`. |
| `from` | string | No | The first day of a custom range as `YYYY-MM-DD` in UTC. Send it together with `to`. |
| `to` | string | No | The last day of a custom range as `YYYY-MM-DD` in UTC, included in the range. Send it together with `from`. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.