Skip to main content
Ahora la API de REST tiene control de versiones. Para obtener más información, consulta "Acerca del control de versiones de la API".

REST API endpoints for API Insights

Use the REST API to view statistics for API usage in an organization.

Get route stats by actor

Get API request count statistics for an actor broken down by route within a specified time frame.

Tokens de acceso específicos para "Get route stats by actor"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "API Insights" organization permissions (read)

Parámetros para "Get route stats by actor"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
org string Requerido

The organization name. The name is not case sensitive.

actor_type string Requerido

The type of the actor

Puede ser uno de los siguientes: installations, classic_pats, fine_grained_pats, oauth_apps, github_apps_user_to_server

actor_id integer Requerido

The ID of the actor

Parámetros de consulta
Nombre, Tipo, Descripción
min_timestamp string Requerido

The minimum timestamp to query for stats

max_timestamp string Requerido

The maximum timestamp to query for stats

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Valor predeterminado: 1

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Valor predeterminado: 30

direction string

The direction to sort the results by.

Valor predeterminado: desc

Puede ser uno de los siguientes: asc, desc

sort array

The property to sort the results by.

Códigos de estado de respuesta HTTP para "Get route stats by actor"

status codeDescripción
200

OK

Ejemplos de código para "Get route stats by actor"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

get/orgs/{org}/insights/api/route-stats/{actor_type}/{actor_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/orgs/ORG/insights/api/route-stats/ACTOR_TYPE/ACTOR_ID?min_timestamp=MIN_TIMESTAMP&max_timestamp=MAX_TIMESTAMP"

Response

Status: 200
[ { "http_method": "GET", "api_route": "/repositories/:repository_id", "total_request_count": 544665, "rate_limited_request_count": 13, "last_request_timestamp": "2024-09-18T15:43:03Z", "last_rate_limited_timestamp": "2024-09-18T06:30:09Z" } ]

Get subject stats

Get API request statistics for all subjects within an organization within a specified time frame. Subjects can be users or GitHub Apps.

Tokens de acceso específicos para "Get subject stats"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "API Insights" organization permissions (read)

Parámetros para "Get subject stats"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
org string Requerido

The organization name. The name is not case sensitive.

Parámetros de consulta
Nombre, Tipo, Descripción
min_timestamp string Requerido

The minimum timestamp to query for stats

max_timestamp string Requerido

The maximum timestamp to query for stats

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Valor predeterminado: 1

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Valor predeterminado: 30

direction string

The direction to sort the results by.

Valor predeterminado: desc

Puede ser uno de los siguientes: asc, desc

sort array

The property to sort the results by.

Códigos de estado de respuesta HTTP para "Get subject stats"

status codeDescripción
200

OK

Ejemplos de código para "Get subject stats"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

get/orgs/{org}/insights/api/subject-stats
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/orgs/ORG/insights/api/subject-stats?min_timestamp=MIN_TIMESTAMP&max_timestamp=MAX_TIMESTAMP"

Response

Status: 200
[ { "subject_type": "installation", "subject_id": 954453, "subject_name": "GitHub Actions", "integration_id": 124345, "total_request_count": 544665, "rate_limited_request_count": 13, "last_request_timestamp": "2024-09-18T15:43:03Z", "last_rate_limited_timestamp": "2024-09-18T06:30:09Z" } ]

Get summary stats

Get overall statistics of API requests made within an organization by all users and apps within a specified time frame.

Tokens de acceso específicos para "Get summary stats"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "API Insights" organization permissions (read)

Parámetros para "Get summary stats"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
org string Requerido

The organization name. The name is not case sensitive.

Parámetros de consulta
Nombre, Tipo, Descripción
min_timestamp string Requerido

The minimum timestamp to query for stats

max_timestamp string Requerido

The maximum timestamp to query for stats

Códigos de estado de respuesta HTTP para "Get summary stats"

status codeDescripción
200

OK

Ejemplos de código para "Get summary stats"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

get/orgs/{org}/insights/api/summary-stats
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/orgs/ORG/insights/api/summary-stats?min_timestamp=MIN_TIMESTAMP&max_timestamp=MAX_TIMESTAMP"

Response

Status: 200
{ "total_request_count": 34225, "rate_limited_request_count": 23 }

Get summary stats by user

Get overall statistics of API requests within the organization for a user.

Tokens de acceso específicos para "Get summary stats by user"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "API Insights" organization permissions (read)

Parámetros para "Get summary stats by user"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
org string Requerido

The organization name. The name is not case sensitive.

user_id string Requerido

The ID of the user to query for stats

Parámetros de consulta
Nombre, Tipo, Descripción
min_timestamp string Requerido

The minimum timestamp to query for stats

max_timestamp string Requerido

The maximum timestamp to query for stats

Códigos de estado de respuesta HTTP para "Get summary stats by user"

status codeDescripción
200

OK

Ejemplos de código para "Get summary stats by user"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

get/orgs/{org}/insights/api/summary-stats/users/{user_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/orgs/ORG/insights/api/summary-stats/users/USER_ID?min_timestamp=MIN_TIMESTAMP&max_timestamp=MAX_TIMESTAMP"

Response

Status: 200
{ "total_request_count": 34225, "rate_limited_request_count": 23 }

Get summary stats by actor

Get overall statistics of API requests within the organization made by a specific actor. Actors can be GitHub App installations, OAuth apps or other tokens on behalf of a user.

Tokens de acceso específicos para "Get summary stats by actor"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "API Insights" organization permissions (read)

Parámetros para "Get summary stats by actor"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
org string Requerido

The organization name. The name is not case sensitive.

actor_type string Requerido

The type of the actor

Puede ser uno de los siguientes: installations, classic_pats, fine_grained_pats, oauth_apps, github_apps_user_to_server

actor_id integer Requerido

The ID of the actor

Parámetros de consulta
Nombre, Tipo, Descripción
min_timestamp string Requerido

The minimum timestamp to query for stats

max_timestamp string Requerido

The maximum timestamp to query for stats

Códigos de estado de respuesta HTTP para "Get summary stats by actor"

status codeDescripción
200

OK

Ejemplos de código para "Get summary stats by actor"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

get/orgs/{org}/insights/api/summary-stats/{actor_type}/{actor_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/orgs/ORG/insights/api/summary-stats/ACTOR_TYPE/ACTOR_ID?min_timestamp=MIN_TIMESTAMP&max_timestamp=MAX_TIMESTAMP"

Response

Status: 200
{ "total_request_count": 34225, "rate_limited_request_count": 23 }

Get time stats

Get the number of API requests and rate-limited requests made within an organization over a specified time period.

Tokens de acceso específicos para "Get time stats"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "API Insights" organization permissions (read)

Parámetros para "Get time stats"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
org string Requerido

The organization name. The name is not case sensitive.

Parámetros de consulta
Nombre, Tipo, Descripción
min_timestamp string Requerido

The minimum timestamp to query for stats

max_timestamp string Requerido

The maximum timestamp to query for stats

timestamp_increment string Requerido

The increment of time used to breakdown the query results (5m, 10m, 1h, etc.)

Códigos de estado de respuesta HTTP para "Get time stats"

status codeDescripción
200

OK

Ejemplos de código para "Get time stats"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

get/orgs/{org}/insights/api/time-stats
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/orgs/ORG/insights/api/time-stats?min_timestamp=MIN_TIMESTAMP&max_timestamp=MAX_TIMESTAMP&timestamp_increment=TIMESTAMP_INCREMENT"

Response

Status: 200
[ { "timestamp": "2024-09-11T15:00:00Z", "total_request_count": 34225, "rate_limited_request_count": 0 }, { "timestamp": "2024-09-11T15:05:00Z", "total_request_count": 10587, "rate_limited_request_count": 18 }, { "timestamp": "2024-09-11T15:10:00Z", "total_request_count": 43587, "rate_limited_request_count": 14 }, { "timestamp": "2024-09-11T15:15:00Z", "total_request_count": 19463, "rate_limited_request_count": 4 }, { "timestamp": "2024-09-11T15:20:00Z", "total_request_count": 60542, "rate_limited_request_count": 3 }, { "timestamp": "2024-09-11T15:25:00Z", "total_request_count": 55872, "rate_limited_request_count": 23 } ]

Get time stats by user

Get the number of API requests and rate-limited requests made within an organization by a specific user over a specified time period.

Tokens de acceso específicos para "Get time stats by user"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "API Insights" organization permissions (read)

Parámetros para "Get time stats by user"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
org string Requerido

The organization name. The name is not case sensitive.

user_id string Requerido

The ID of the user to query for stats

Parámetros de consulta
Nombre, Tipo, Descripción
min_timestamp string Requerido

The minimum timestamp to query for stats

max_timestamp string Requerido

The maximum timestamp to query for stats

timestamp_increment string Requerido

The increment of time used to breakdown the query results (5m, 10m, 1h, etc.)

Códigos de estado de respuesta HTTP para "Get time stats by user"

status codeDescripción
200

OK

Ejemplos de código para "Get time stats by user"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

get/orgs/{org}/insights/api/time-stats/users/{user_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/orgs/ORG/insights/api/time-stats/users/USER_ID?min_timestamp=MIN_TIMESTAMP&max_timestamp=MAX_TIMESTAMP&timestamp_increment=TIMESTAMP_INCREMENT"

Response

Status: 200
[ { "timestamp": "2024-09-11T15:00:00Z", "total_request_count": 34225, "rate_limited_request_count": 0 }, { "timestamp": "2024-09-11T15:05:00Z", "total_request_count": 10587, "rate_limited_request_count": 18 }, { "timestamp": "2024-09-11T15:10:00Z", "total_request_count": 43587, "rate_limited_request_count": 14 }, { "timestamp": "2024-09-11T15:15:00Z", "total_request_count": 19463, "rate_limited_request_count": 4 }, { "timestamp": "2024-09-11T15:20:00Z", "total_request_count": 60542, "rate_limited_request_count": 3 }, { "timestamp": "2024-09-11T15:25:00Z", "total_request_count": 55872, "rate_limited_request_count": 23 } ]

Get time stats by actor

Get the number of API requests and rate-limited requests made within an organization by a specific actor within a specified time period.

Tokens de acceso específicos para "Get time stats by actor"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "API Insights" organization permissions (read)

Parámetros para "Get time stats by actor"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
org string Requerido

The organization name. The name is not case sensitive.

actor_type string Requerido

The type of the actor

Puede ser uno de los siguientes: installations, classic_pats, fine_grained_pats, oauth_apps, github_apps_user_to_server

actor_id integer Requerido

The ID of the actor

Parámetros de consulta
Nombre, Tipo, Descripción
min_timestamp string Requerido

The minimum timestamp to query for stats

max_timestamp string Requerido

The maximum timestamp to query for stats

timestamp_increment string Requerido

The increment of time used to breakdown the query results (5m, 10m, 1h, etc.)

Códigos de estado de respuesta HTTP para "Get time stats by actor"

status codeDescripción
200

OK

Ejemplos de código para "Get time stats by actor"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

get/orgs/{org}/insights/api/time-stats/{actor_type}/{actor_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/orgs/ORG/insights/api/time-stats/ACTOR_TYPE/ACTOR_ID?min_timestamp=MIN_TIMESTAMP&max_timestamp=MAX_TIMESTAMP&timestamp_increment=TIMESTAMP_INCREMENT"

Response

Status: 200
[ { "timestamp": "2024-09-11T15:00:00Z", "total_request_count": 34225, "rate_limited_request_count": 0 }, { "timestamp": "2024-09-11T15:05:00Z", "total_request_count": 10587, "rate_limited_request_count": 18 }, { "timestamp": "2024-09-11T15:10:00Z", "total_request_count": 43587, "rate_limited_request_count": 14 }, { "timestamp": "2024-09-11T15:15:00Z", "total_request_count": 19463, "rate_limited_request_count": 4 }, { "timestamp": "2024-09-11T15:20:00Z", "total_request_count": 60542, "rate_limited_request_count": 3 }, { "timestamp": "2024-09-11T15:25:00Z", "total_request_count": 55872, "rate_limited_request_count": 23 } ]

Get user stats

Get API usage statistics within an organization for a user broken down by the type of access.

Tokens de acceso específicos para "Get user stats"

Este punto de conexión funciona con los siguientes tipos de token pormenorizados:

El token pormenorizado debe tener el siguiente conjunto de permisos:

  • "API Insights" organization permissions (read)

Parámetros para "Get user stats"

Encabezados
Nombre, Tipo, Descripción
accept string

Setting to application/vnd.github+json is recommended.

Parámetros de la ruta de acceso
Nombre, Tipo, Descripción
org string Requerido

The organization name. The name is not case sensitive.

user_id string Requerido

The ID of the user to query for stats

Parámetros de consulta
Nombre, Tipo, Descripción
min_timestamp string Requerido

The minimum timestamp to query for stats

max_timestamp string Requerido

The maximum timestamp to query for stats

page integer

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Valor predeterminado: 1

per_page integer

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

Valor predeterminado: 30

direction string

The direction to sort the results by.

Valor predeterminado: desc

Puede ser uno de los siguientes: asc, desc

sort array

The property to sort the results by.

Códigos de estado de respuesta HTTP para "Get user stats"

status codeDescripción
200

OK

Ejemplos de código para "Get user stats"

If you access GitHub at GHE.com, replace api.github.com with your enterprise's dedicated subdomain at api.SUBDOMAIN.ghe.com.

Ejemplo de solicitud

get/orgs/{org}/insights/api/user-stats/{user_id}
curl -L \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "https://api.github.com/orgs/ORG/insights/api/user-stats/USER_ID?min_timestamp=MIN_TIMESTAMP&max_timestamp=MAX_TIMESTAMP"

Response

Status: 200
[ { "actor_type": "oauth_app", "actor_id": 954453, "actor_name": "GitHub Actions", "oauth_application_id": 1245, "total_request_count": 544665, "rate_limited_request_count": 13, "last_request_timestamp": "2024-09-18T15:43:03Z", "last_rate_limited_timestamp": "2024-09-18T06:30:09Z" } ]