In distributed Splunk environments using LDAP or local authentication, REST API logins might fail even though credentials work in Splunk Web. Typical failure symptoms:
API responses show:{"messages":[{"type":"WARN","text":"call not properly authenticated"}]}
splunkd_access.log shows HTTP 401
/services/authorization/tokens/v1/authenticate returns 404 Not Found
/services/auth/login reports “Login failed”, even with known working accounts
Wrong header formats are used, e.g. Authorization: Bearer instead of Authorization: Splunk for session keys
Example masked access logs:
[06/Nov/2025:09:13:19 +0000] "POST /servicesNS/<username>/search/search/jobs/export HTTP/1.1" 401 - "-" "curl/8.7.1"
Example masked successful LDAP login entry:
INFO AuditLogger - Audit: [timestamp=..., user=<LDAP_USER_ID>, action=login attempt, info=succeeded ... method=LDAP useragent="curl/8.7.1" ...]Confirm configured authentication type:
$SPLUNK_HOME/bin/splunk btool authentication list --debug
Example:
[authentication]
authType = LDAP
authTypePreferredForUserCollision = Splunk
Ensure REST calls are sent to the same host used for successful Splunk Web login.
Confirm local user exists on the node if using local auth ($SPLUNK_HOME/etc/passwd).
LDAP or local admin names must not include site-specific identifiers in the article.
In splunkd_access.log → look for HTTP 401 / 403.
In splunkd.log → look for messages containing:AuthenticationManager, Login failed, token, basic auth disabled.
/services/auth/login does not accept -u user:pass. It requires POST fields:
curl -sk https://<HOST>:8089/services/auth/login \
-d username=<USERNAME> \
--data-urlencode password='<PASSWORD>' \
-d output_mode=json
"sessionKey":"...".5. Test REST Using Session Key
curl -sk -H "Authorization: Splunk <SESSION_KEY>" \
'https://<HOST>:8089/services/server/info?output_mode=json'
If token-based auth is enabled:
curl -sk -H "Authorization: Splunk <SESSION_KEY>" \
https://<HOST>:8089/services/authorization/tokens?output_mode=json \
-d name='api-token' \
-d audience='Users' \
-d type='permanent' \
-d user='<USERNAME>'
Note: /services/authorization/tokens/v1/authenticate is not a valid endpoint in Splunk Enterprise.
To resolve REST API authentication failures and generate a valid token for use with Authorization: Bearer, run the following command (replace placeholders accordingly):
curl -k -u 'admin:<PASSWORD>' \
https://<HOSTNAME>:8089/services/authorization/tokens?output_mode=json \
--data name=<USERNAME> \
--data audience=Users \
--data-urlencode expires_on=+30d
This will return a JSON response containing a field called "token".
Use that token in API requests like this:
curl -k -X POST \
-H "Authorization: Bearer <TOKEN_FROM_RESPONSE>" \
-d 'search=| rest /services/apps/local | table title,label' \
https://<HOSTNAME>:8089/servicesNS/nobody/search/search/jobs/export?output_mode=json&count=0
Use REST to create authentication tokens
| Revision | Publish Date | Comments |
|---|---|---|
1.0 |
01-Oct-2026
|
Initial Release |