<commit_before>[role="xpack"]
[[ml-get-category]]
=== Get Categories

The get categories API enables you to retrieve job results for one or more
categories.


==== Request

`GET _xpack/ml/anomaly_detectors/<job_id>/results/categories` +

`GET _xpack/ml/anomaly_detectors/<job_id>/results/categories/<category_id>`

==== Description

For more information about categories, see
{xpack-ref}/ml-configuring-categories.html[Categorizing Log Messages].
//<<ml-configuring-categories>>.

==== Path Parameters

`job_id`::
  (string) Identifier for the job.

`category_id`::
  (string) Identifier for the category. If you do not specify this optional parameter,
  the API returns information about all categories in the job.


==== Request Body

`page`::
`from`:::
  (integer) Skips the specified number of categories.
`size`:::<commit_msg>[DOCS] Update type for category_id (elastic/x-pack-elasticsearch#2197)<commit_after>[role="xpack"]
[[ml-get-category]]
=== Get Categories

The get categories API enables you to retrieve job results for one or more
categories.


==== Request

`GET _xpack/ml/anomaly_detectors/<job_id>/results/categories` +

`GET _xpack/ml/anomaly_detectors/<job_id>/results/categories/<category_id>`

==== Description

For more information about categories, see
{xpack-ref}/ml-configuring-categories.html[Categorizing Log Messages].
//<<ml-configuring-categories>>.

==== Path Parameters

`job_id`::
  (string) Identifier for the job.

`category_id`::
  (long) Identifier for the category. If you do not specify this optional parameter,
  the API returns information about all categories in the job.


==== Request Body

`page`::
`from`:::
  (integer) Skips the specified number of categories.
`size`:::
{'fraction_non_alphanumeric': 0.13162492719860222, 'fraction_numerical': 0.0023296447291788003, 'mean_word_length': 5.20216606498195, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7545664', 'n_tokens_mistral': 543, 'n_tokens_neox': 528, 'n_words': 162}