usage-events

List observed usage event field values

Changed on

Returns a page of the distinct values seen so far in one field of the organization's usage events, in ascending value order unless sort is value desc. A client can offer them as choices for usage filters.

Subjects come back as subject references, such as principal/{uuid}, which the usage filters accept as they are. For field=tags, a request without key lists the tag keys, and a request with key lists the values of that tag.

For a caller with access to the whole organization, a value stays in the list after the events that carried it leave retention or are deleted. For a caller whose access covers only particular principals or groups, the subject list holds only the subjects of the events of those principals and groups, so a subject leaves the list with its events. Such a caller's groups and teams lists hold only the groups the caller's access names. Every other field lists the organization's values, the same as for a caller with access to the whole organization.

The service may return fewer values than requested when the page reaches its byte budget. Follow the page links to continue.

The list doesn't take a time range or other usage filters, and it doesn't count usage. A cursor belongs to its field and key. With a cursor from another selection, the request fails with 400.

get/v1/ai-cost-management/events/field-values

Request

  • Base URL
    https://global.api.konghq.com
  • Auth
    • HTTP bearer
    • or HTTP bearer
    • or HTTP bearer
    • or HTTP bearer

Query parameters

filter, AICostUsageEventFieldValueFilterParameters

Filters on the returned values. Every filter must match, and a bare value means eq.

  • value: eq, neq, oeq, contains, and ocontains, for every field, including the gateway ID fields. With field=tags, each value, including each part of an oeq or ocontains list, has at most 256 characters, none of them a control character.
  • type: eq, neq, and oeq, with a subject type. With any field other than subject, a type filter fails with 400.

Any other filter key fails with 400. eq, neq, and oeq compare strings case-sensitively, and contains and ocontains ignore case. For a UUID field, eq, neq, and oeq compare full UUIDs case-insensitively.

value, StringFieldFilter

Filter using one of the following operators: eq, oeq, neq, contains, ocontains

type, union

Filters a field by its value with eq, neq, or oeq. Accepts principal, consumer, and oidc. A bare value means eq.

Narrows the list. Each filter has the form filter[field][operator]=value, or filter[field]=value for eq. An operator that takes no value, such as exists, leaves out =value.

A request can combine several filters, and every filter must match.

sort, string

The order of the results, as a comma-separated list of fields in priority order. Each field can be followed by a space and asc or desc, and sorts in ascending order without one. The service breaks ties so that the order is unique.

Sortable fields: value. Defaults to value asc.

page[size], integer

The number of results on each page.

1 to 100. Defaults to 20.

page[after], string

A cursor for the page after an earlier response's page. Clients take it from that response's meta.page.next link, which also carries the request's other parameters, and don't build or change it.

A request can't send both page[after] and page[before].

page[before], string

A cursor for the page before an earlier response's page. Clients take it from that response's meta.page.previous link, which also carries the request's other parameters, and don't build or change it.

A request can't send both page[after] and page[before].

field, 'subject' | 'tags' | 'source' | 'provider' | 'model' | 'model_id' | 'region' | 'client' | 'groups' | 'teams' | 'service_id' | 'route_id' | 'consumer_id' | 'application_id' | 'consumer_group_ids' required

The field whose values to list:

  • subject: subject references, such as principal/{uuid} or oidc/{sub}.
  • tags: the tag keys, or with key, the values of that tag.
  • groups, teams, consumer_group_ids: the individual group references, team references, or consumer group IDs from the events' lists.
  • source, provider, model, model_id, region, client, service_id, route_id, consumer_id, application_id: the field's values.
key, string

The tag key whose values to list. Without key, field=tags lists the tag keys. An unknown key returns an empty page.

1 to 128 characters, each a lowercase ASCII letter, a digit, ., _, or -. A key with any field other than tags isn't accepted.

q, string

Returns only values that contain this text, ignoring case. % and _ are plain characters, not wildcards. A value must match both q and filter. An empty q doesn't narrow the list.

Response

A page of distinct values.

object required
data, object[] required

The values on this page, in sort order.

meta, CursorMeta required

Pagination metadata.

Example response

{
  "meta": {
    "page": {
      "size": 10
    }
  }
}

Changes