<commit_before>+++
title = "User HTTP API "
description = "Grafana User HTTP API"
keywords = ["grafana", "http", "documentation", "api", "user"]
aliases = ["/http_api/user/"]
type = "docs"
[menu.docs]
name = "Users"
parent = "http_api"
+++

# User HTTP resources / actions

## Search Users

`GET /api/users?perpage=10&page=1`

**Example Request**:

    GET /api/users HTTP/1.1
    Accept: application/json
    Content-Type: application/json
    Authorization: Bearer <KEY>

Default value for the `perpage` parameter is `1000` and for the `page` parameter is `1`.

**Example Response**:

    HTTP/1.1 200
    Content-Type: application/json

    [
      {
        "id": 1,
        "name": "Admin",
        "login": "admin",
        "email": "<EMAIL>",
        "isAdmin": true
      },
      {
        "id": 2,
        "name": "User",
        "login": "user",
        "email": "<EMAIL>",
        "isAdmin": false
      }
    ]

## Search Users with Paging

`GET /api/users/search?perpage=10&page=1`

**Example Request**:

    GET /api/users/search?perpage=10&page=1 HTTP/1.1
    Accept: application/json
    Content-Type: application/json
    Authorization: Bearer <KEY>

Default value for the `perpage` parameter is `1000` and for the `page` parameter is `1`. The `totalCount` field in the response can be used for pagination of the user list E.g. if `totalCount` is equal to 100 users and the `perpage` parameter is set to 10 then there are 10 pages of users.

**Example Response**:

    HTTP/1.1 200
    Content-Type: application/json
    {
      "totalCount": 2,
      "users": [
        {
          "id": 1,
          "name": "Admin",
          "login": "admin",
          "email": "<EMAIL>",
          "isAdmin": true
        },
        {<commit_msg>docs: add query parameter to api user search<commit_after>+++
title = "User HTTP API "
description = "Grafana User HTTP API"
keywords = ["grafana", "http", "documentation", "api", "user"]
aliases = ["/http_api/user/"]
type = "docs"
[menu.docs]
name = "Users"
parent = "http_api"
+++

# User HTTP resources / actions

## Search Users

`GET /api/users?perpage=10&page=1`

**Example Request**:

    GET /api/users HTTP/1.1
    Accept: application/json
    Content-Type: application/json
    Authorization: Bearer <KEY>

Default value for the `perpage` parameter is `1000` and for the `page` parameter is `1`.

**Example Response**:

    HTTP/1.1 200
    Content-Type: application/json

    [
      {
        "id": 1,
        "name": "Admin",
        "login": "admin",
        "email": "<EMAIL>",
        "isAdmin": true
      },
      {
        "id": 2,
        "name": "User",
        "login": "user",
        "email": "<EMAIL>",
        "isAdmin": false
      }
    ]

## Search Users with Paging

`GET /api/users/search?perpage=10&page=1&query=mygraf`

**Example Request**:

    GET /api/users/search?perpage=10&page=1&query=mygraf HTTP/1.1
    Accept: application/json
    Content-Type: application/json
    Authorization: Bearer <KEY>DF<KEY>

Default value for the `perpage` parameter is `1000` and for the `page` parameter is `1`. The `totalCount` field in the response can be used for pagination of the user list E.g. if `totalCount` is equal to 100 users and the `perpage` parameter is set to 10 then there are 10 pages of users. The `query` parameter is optional and it will return results where the query value is contained in one of the `name`, `login` or `email` fields. Query values with spaces need to be url encoded e.g. `query=Jane%20Doe`.

**Example Response**:

    HTTP/1.1 200
    Content-Type: application/json
    {
      "totalCount": 2,
      "users": [
        {
          "id": 1,
          "name": "Admin",
          "login": "admin",
          "email": "<EMAIL>",
          "isAdmin": true
        },
        {
{'fraction_non_alphanumeric': 0.1446673706441394, 'fraction_numerical': 0.02375923970432946, 'mean_word_length': 2.594876660341556, 'pattern_counts': {'":': 34, '<': 14, '<?xml version=': 0, '>': 14, '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': '4527408', 'n_tokens_mistral': 1269, 'n_tokens_neox': 1200, 'n_words': 395}