Use it when an API call returns 401, when choosing how an automation client should prove its identity, or when reviewing where credentials end up.
REST API Authentication
Authentication establishes the principal making an API request; it does not decide every operation the principal may perform.
1. Find how the API authenticates: OAuth2 bearer token, API key, mTLS or basic auth.
2. 401 = not authenticated; check the Authorization header is sent.
3. Never put credentials in URLs (they end up in logs).
TLS established → credential sent in the Authorization header (token, key) or as a client certificate → server validates it → 401 when missing or invalid → identity attached to the request → authorization decides next
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Read-only Verification Verify boundary
Review the selected authentication method and a bounded request with the intended service identity. Distinguish an authentication challenge from an authorization denial.
Step 2 Common mistakes Narrow the fault
- API keys in URLs or source code.
- Long-lived tokens without rotation.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
A successful login is not a least-privilege or full-service test.
curl -i https://host/api/… without credentials → expect 401. Repeat with the Authorization header → 200. Check that credentials are not placed in the URL and do not appear in logs or shell history.
ReferenceWhat it is1 section · depth on demand
Direct Answer
Authentication establishes the principal making an API request; it does not decide every operation the principal may perform.
ReferenceHow it works1 section · depth on demand
Technical Mechanics
Use Identity & Access Management for general identity principles and AAA for Cisco AAA. Confirm the API-supported scheme before sending credentials.
ReferenceImportant terms & boundaries5 sections · depth on demand
Official Sources
Key operational limits
- Authentication identifies; authorization limits action and object scope
Proof Boundaries
A successful login is not a least-privilege or full-service test.
In depth
Authentication for REST APIs
An API must know who is calling. For human logins and many automation clients this ends in a token: in OAuth 2.0, RFC 6749 describes an authorization server that authenticates the resource owner, obtains authorisation and issues access tokens, and requires confidential clients to authenticate to the token endpoint, which must be protected with TLS because the requests carry credentials.
Authentication methods for network APIs
| Method | Use |
|---|---|
| Basic authentication per request | Simple device APIs (RESTCONF); only over TLS |
| Session token after login | Many controllers: log in once, send the token |
| OAuth 2.0 client credentials | Machine-to-machine; the client authenticates directly (confidential clients only, RFC 6749) |
| OAuth 2.0 authorization code | Users authorising applications through a browser |
| API keys | Simple, but often long-lived and broad |
| Mutual TLS | Client certificate identifies the caller |
OAuth 2.0 roles (RFC 6749)
| Role | Example |
|---|---|
| Resource owner | The admin whose permissions are delegated |
| Client | An automation script or application |
| Authorization server | Identity provider issuing tokens |
| Resource server | The network controller's API |
admin$ curl -s -X POST https://idp.example.net/oauth2/token \
-d grant_type=client_credentials -d scope="network.read" \
-u "$CLIENT_ID:$CLIENT_SECRET" | jq -r .access_token > token
admin$ curl -s -H "Authorization: Bearer $(cat token)" https://ctrl.example.net/api/v1/devices | jq '.[0].hostname'
"ACC-2F-01"
admin$ curl -s -o /dev/null -w "%{http_code}\n" https://ctrl.example.net/api/v1/devices
401
Practices
| Practice | Reason |
|---|---|
| Separate service accounts per automation | Accountability and targeted revocation |
| MFA or SSO for human API access | Same assurance as interactive logins |
| Secrets in a vault | Not in scripts or repositories |
| Rate limiting and lockout | Slows credential guessing |
| Log authentication events | Detect misuse |
Documented example, not captured output.
Quick reference
API authentication shows which user or program is making a request. Network platforms support several methods, from simple username and password to tokens and certificates, and the choice affects how securely credentials are handled in scripts and integrations. The table lists the common methods and where each fits.
REST API authentication on network platforms:
| Method | Example |
|---|---|
| Basic auth over HTTPS | RESTCONF on IOS XE (user/password per request) |
| Token from login call | Catalyst Center (POST /dna/system/api/v1/auth/token → X-Auth-Token) |
| OAuth 2.0 | Meraki/cloud APIs, Webex, many SaaS |
| API keys | Meraki Dashboard API key (bearer) |
| Mutual TLS | Client certificates |
curl -sk -u admin:$PW -X POST https://dnac/dna/system/api/v1/auth/token | jq -r .Token
curl -sk -H "X-Auth-Token: $TOKEN" https://dnac/dna/intent/api/v1/network-device
Never send credentials over plain HTTP, and keep them out of scripts (environment variables, vaults).
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Configuration & expected output
Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.
Expected output
curl -i https://api.example.net/v1/interfacesExpected state: Without credentials the API answers 401.
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer
! Illustrative output, not captured Evidence.401 means "who are you?" — the request carried no valid credential. The header says the API expects a bearer token. A 403 instead would mean the identity is known but not allowed.Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Security → REST API Security → Authentication. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.cisco.com/c/en/us/support/ios-nx-os-software/ios-xe-17/series.html · confidence 94%