Runner details API does not return token_expires_at field

Summary

The Create a runner linked to a user API accepts and stores a token_expires_at parameter when creating a runner authentication token. However, the Retrieve runner's details API (GET /api/v4/runners/:id) does not include token_expires_at in its response, making it impossible for API consumers to inspect the token expiry of an existing runner.

Steps to reproduce

  1. Create a runner with a token expiry via the Users API:
    POST /api/v4/user/runners
    {
      "runner_type": "project_type",
      "project_id": <project_id>,
      "token_expires_at": "2025-01-01T00:00:00Z"
    }
  2. Note the token_expires_at value in the response.
  3. Retrieve the runner's details:
    GET /api/v4/runners/:id
  4. Observe that token_expires_at is absent from the response.

Current behavior

GET /api/v4/runners/:id does not include token_expires_at in its response payload, even when the runner was created with a token expiry date.

Expected behavior

GET /api/v4/runners/:id should include token_expires_at in its response payload, consistent with the field being accepted on creation and already surfaced by the reset authentication token endpoint (POST /api/v4/runners/:id/reset_authentication_token).

Environment

  • Deployment type: GitLab.com and Self-Managed
  • Affects: REST API
Edited by 🤖 GitLab Bot 🤖