Core
API v2.x
2

# searchApiKeys

Searches for API keys.

To search for an API key corresponding to a token you can search on the fingerprint property which is a SHA256 hash of the token.


# Query Syntax

# HTTP

Copied to clipboard!
URL: http://kuzzle:7512/users/api-keys/_search[?from=0][&size=42]
Method: POST
Body:
Copied to clipboard!
{
  "match": {
    "description": "sigfox"
  }
}

# Other protocols

Copied to clipboard!
{
  "controller": "auth",
  "action": "searchApiKeys",
  "body": {
    "match": {
      "description": "sigfox"
    }
  },

  // optional arguments
  "from": 0,
  "size": 10
}

# Arguments

# Optional:

  • from: the offset from the first result you want to fetch. Usually used with the size argument
  • size: the maximum number of API keys returned in one response page

# Body properties

# Optional:

The search query itself, using the ElasticSearch Query DSL syntax.

If the body is left empty, the result will return all available api keys for the user.


# Response

Returns an object with the following properties:

  • hits: array of object. Each object describes a found API key:
    • _id: API key ID
    • _source: API key definition without the token field
  • total: total number of API keys found. Depending on pagination options, this can be greater than the actual number of API keys in a single result page
Copied to clipboard!
{
  "status": 200,
  "error": null,
  "action": "searchApiKeys",
  "controller": "auth",
  "requestId": "<unique request identifier>",
  "result": {
    "total": 2,
    "hits": [
      {
        "_id": "api-key-1",
        "_source": {
          // API key content
        }
      },
      {
        "_id": "api-key-1",
        "_source" {
          // API key content
        }
      }
    ]
  }
}