Challenge - 5 Problems
API Key Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this API key creation response?
You run this Elasticsearch API call to create an API key. What is the output?
Elasticsearch
POST /_security/api_key
{
"name": "my-api-key",
"role_descriptors": {
"my-role": {
"cluster": ["all"],
"index": [
{
"names": ["my-index"],
"privileges": ["read"]
}
]
}
}
}Attempts:
2 left
💡 Hint
The API key creation response includes the key ID, name, and the encoded key string.
✗ Incorrect
When you create an API key in Elasticsearch, the response includes the unique ID, the name you gave it, and the base64 encoded API key string. This allows you to use the key for authentication.
❓ Predict Output
intermediate2:00remaining
What error does this API key deletion request produce?
You try to delete an API key with this request but get an error. What is the error?
Elasticsearch
DELETE /_security/api_key
{
"id": "nonexistent-id"
}Attempts:
2 left
💡 Hint
Elasticsearch returns a simple found flag for deletion attempts.
✗ Incorrect
When deleting an API key by ID, if the key does not exist, Elasticsearch returns {"found":false} indicating no key was deleted.
🧠 Conceptual
advanced2:00remaining
Which option correctly describes API key privileges in Elasticsearch?
Choose the correct statement about API key privileges in Elasticsearch.
Attempts:
2 left
💡 Hint
Think about how roles define access in Elasticsearch.
✗ Incorrect
API keys in Elasticsearch are created with role descriptors that specify both cluster and index privileges. This allows fine-grained access control.
❓ Predict Output
advanced2:00remaining
What is the output of this API key authentication attempt?
You use this API key in the Authorization header to authenticate. What is the expected response?
Elasticsearch
GET /_security/_authenticate
Headers: {"Authorization": "ApiKey ZXhhbXBsZWFwaWtleQ=="}Attempts:
2 left
💡 Hint
Successful API key authentication returns user info and key details.
✗ Incorrect
When authenticating with a valid API key, Elasticsearch returns the username, roles, and API key id and name used for authentication.
❓ Predict Output
expert2:00remaining
How many API keys are returned by this query?
You run this request to list API keys created by user 'alice'. How many keys are returned?
Elasticsearch
GET /_security/api_key?owner=true
Attempts:
2 left
💡 Hint
The 'owner' parameter filters keys by the authenticated user.
✗ Incorrect
Using "owner": true returns only API keys created by the user making the request, so the count depends on how many keys that user owns.