# List services

List the services a source detected, most recently seen first, as the **Services** page lists them.

[endpoint]
method = "GET"
base_url = "https://telemetry.betterstack.com"
path = "/api/v4/sources/{source_id}/services"

[[path_param]]
name = "source_id"
required = true
type = "string"
description = "Source whose services are listed. Get its ID via [List sources](/docs/logs/api/list-all-existing-sources/)."

[[query_param]]
name = "name"
type = "string"
description = "Only services whose name contains this text, ignoring letter case."

[[query_param]]
name = "page"
type = "integer"
description = "Page to return, starting at 1."

[[query_param]]
name = "per_page"
default = "50"
type = "integer"
description = "Results per page. Maximum 250."

[[query_param]]
name = "team_id"
type = "string"
description = "Team to use, such as `t123`. Get the ID via [List teams](/docs/uptime/api/teams/list/). Required when you can access more than one team."

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"
[/endpoint]

[info]
#### Results are paginated
Use `pagination.next` and `pagination.prev` to move through pages or jump to a specific one using `page` and `per_page`. See [Pagination](/docs/getting-started/integrations/api/#pagination).
[/info]

[responses]
[[response]]
status = 200
description = "Returns the list of services."
body = '''
{
  "data": [
    {
      "id": "123456789",
      "type": "service",
      "attributes": {
        "source_id": "123456",
        "name": "checkout",
        "namespace": null,
        "platform": "postgresql",
        "platform_title": "PostgreSQL",
        "matching": "exact",
        "source_types": [
          "logs",
          "spans"
        ],
        "name_fields": {
          "logs": [
            "kubernetes.container_name"
          ],
          "spans": [
            "resource.service.name"
          ]
        },
        "kubernetes_labels": {
          "app": "checkout"
        },
        "created_at": "2026-11-10T08:12:44.123Z",
        "last_seen_at": "2026-11-22T17:03:56.000Z"
      }
    }
  ],
  "pagination": {
    "first": "https://telemetry.betterstack.com/api/v4/sources/123456/services?page=1",
    "last": "https://telemetry.betterstack.com/api/v4/sources/123456/services?page=1",
    "prev": null,
    "next": null,
    "total_count": 1
  }
}
'''

[[response]]
status = 401
description = "The API token is missing or invalid."
body = '''
{
  "errors": "Invalid Team API token. How to find your Team API token: https://betterstack.com/docs/logs/api/getting-started/#obtaining-a-logtail-api-token"
}
'''

[[response]]
status = 403
description = "Your role doesn't allow viewing this, or the token can't be used for this API."

[[response]]
status = 404
description = "The `source_id` value isn't one of your sources."
body = '''
{
  "errors": "Resource with the provided ID was not found"
}
'''

[[response]]
status = 422
description = "The `page` value isn't a whole number, or the token can access several teams and `team_id` doesn't name one of them."
[/responses]

[params]
title = "Response attributes"

[[param]]
name = "id"
type = "string"
description = "The ID of the service."

[[param]]
name = "type"
type = "string"
description = "Always `service`."

[[param]]
name = "source_id"
type = "string"
description = "The ID of the source that detected the service."

[[param]]
name = "name"
type = "string"
description = "The service's name."

[[param]]
name = "namespace"
type = "string or null"
description = "The Kubernetes namespace of a service named `<namespace>/<kind>/<name>`. `null` for other services."

[[param]]
name = "platform"
type = "string or null"
description = "What the service runs, such as `postgresql`, `nginx` or `rails`. `null` when it isn't known."

[[param]]
name = "platform_title"
type = "string or null"
description = "The platform's name, such as `PostgreSQL`. `null` when the platform isn't known."

[[param]]
name = "matching"
type = "string"
description = "How the name matches the service field of logs, spans and metrics.<br/>Valid values:<br/>`exact`: Matches the name itself.<br/>`prefix`: Matches every name that starts with it.<br/>`workload`: Matches a Kubernetes service named `<namespace>/<kind>/<name>` by its full name or by `<name>` alone."

[[param]]
name = "source_types"
type = "array of strings"
description = "The kinds of data the service was seen in, such as `logs`, `spans` or `metrics`."

[[param]]
name = "name_fields"
type = "object"
description = "The fields the service's name is read from, as lists keyed by the kind of data, such as `logs` or `spans`. Set them in the source's settings under **Extract services**. Each value is a list of strings."

[[param]]
name = "kubernetes_labels"
type = "object"
description = "The Kubernetes labels of the service's workload, without the ones Kubernetes adds itself, such as `pod-template-hash`. An empty object for a service outside Kubernetes. Each value is a string."

[[param]]
name = "created_at"
type = "datetime"
description = "When the service was first detected. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "last_seen_at"
type = "datetime or null"
description = "When the service was last seen in the source's data. `null` when it isn't known. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "pagination.first"
type = "string"
description = "The URL of the first page of results."

[[param]]
name = "pagination.last"
type = "string"
description = "The URL of the last page of results."

[[param]]
name = "pagination.prev"
type = "string or null"
description = "The URL of the previous page, or `null` on the first page."

[[param]]
name = "pagination.next"
type = "string or null"
description = "The URL of the next page, or `null` on the last page."

[[param]]
name = "pagination.total_count"
type = "integer"
description = "How many results the whole list holds, across every page."
[/params]

#### Example cURL

```shell
[label List services]
curl --request GET \
  --url https://telemetry.betterstack.com/api/v4/sources/123456/services \
  --header "Authorization: Bearer $TOKEN"
```
