Use this API to track internal events and to retrieve the Service Ping payload that GitLab collects, including its non-SQL metrics and the queries behind it.
Track usage data event
POST /api/v4/usage_data/increment_counter
This feature was introduced in GitLab 13.4.
Request body (application/json)
| Property | Type | Description |
|---|---|---|
eventRequired | String | The event name that should be tracked Example: i_ |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Track usage data event for the current user
POST /api/v4/usage_data/increment_unique_users
Request body (application/json)
| Property | Type | Description |
|---|---|---|
eventRequired | String | The event name that should be tracked Example: i_ |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
List all non-SQL metrics
GET /api/v4/usage_data/non_sql_metrics
Lists all non-SQL metrics data used in the Service ping. This action is behind the usage_data_non_sql_metrics feature flag. Administrators only.
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
List all Service Ping SQL queries
GET /api/v4/usage_data/queries
Lists all raw SQL queries used to compute Service Ping. This action is behind the usage_data_queries_api feature flag. Administrators only.
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Retrieve Service Ping payload
GET /api/v4/usage_data/service_ping
Retrieves the Service Ping payload from the application cache as JSON. If no cached payload is available, returns an empty response. Requires a personal access token with the read_service_ping scope. Introduced in GitLab 16.9.
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
401 | 401 Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
Track an internal GitLab event
POST /api/v4/usage_data/track_event
Tracks a GitLab internal event. This action increments Service Ping counters in Redis and is optionally sent to Snowplow. Introduced in GitLab 16.2.
Request body (application/json)
| Property | Type | Description |
|---|---|---|
additional_ | Object | Additional properties to be tracked Example: {"label": |
eventRequired | String | The event name that should be tracked Example: i_ |
namespace_ | Integer | Namespace ID Example: 1234 |
project_ | Integer | Project ID.project_Example: 1234 |
project_ | String | Project path (used to resolve project_project_Example: namespace/ |
send_ | Boolean | Send the tracked event to Snowplow Example: true |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
401 | Unauthorized | — |
404 | Not found | — |
Track multiple internal GitLab events
POST /api/v4/usage_data/track_events
Tracks one or more GitLab internal events in a single request. Each event increments Service Ping counters in Redis and is optionally sent to Snowplow. This feature was introduced in GitLab 17.3.
Request body (application/json)
| Property | Type | Description |
|---|---|---|
eventsRequired | Array of objects | An array of internal events. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Validation error | — |
401 | Unauthorized | — |