Skip to content

docs: Add troubleshooting guide for HTTP 412 errors in API token documentation#21948

Open
Ancairon wants to merge 1 commit intomasterfrom
docs/add-http-412-troubleshooting-guide
Open

docs: Add troubleshooting guide for HTTP 412 errors in API token documentation#21948
Ancairon wants to merge 1 commit intomasterfrom
docs/add-http-412-troubleshooting-guide

Conversation

@Ancairon
Copy link
Member

@Ancairon Ancairon commented Mar 13, 2026

Summary

This PR adds a troubleshooting section to the API tokens documentation to help users understand and resolve HTTP 412 errors when accessing Netdata Cloud API endpoints.

Changes

  • Added "Troubleshooting HTTP 412 Errors" section to docs/netdata-cloud/authentication-and-authorization/api-tokens.md
  • Explained that HTTP 412 in Netdata Cloud context indicates missing Authorization Bearer token
  • Provided step-by-step instructions for generating API tokens from Netdata Cloud settings
  • Included examples of correct header format and common causes of the error

Motivation

Users encountering HTTP 412 errors need clear guidance specific to Netdata Cloud, as this status code has a specific meaning in our context (missing authorization token) rather than the generic HTTP precondition failure interpretation.

Testing

  • Documentation changes are purely informational
  • Verified markdown formatting is correct
  • Ensured instructions align with existing token generation documentation

Summary by cubic

Adds a troubleshooting guide for HTTP 412 errors to the API token docs, clarifying that in Netdata Cloud this usually means a missing or invalid Authorization Bearer token. Includes steps to generate a token, a correct header example, and common causes to quickly fix failing requests.

Written for commit b245e02. Summary will update on new commits.

Explain that HTTP 412 in Netdata Cloud indicates missing authorization
bearer token, not generic precondition failure. Provide step-by-step
guide for users to generate API tokens and include them in request
headers.
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 4/5

  • This PR looks safe to merge with low risk, since the only reported issue is a documentation inconsistency rather than a functional code defect.
  • In docs/netdata-cloud/authentication-and-authorization/api-tokens.md, the 412 troubleshooting bullet conflicts with earlier guidance by mixing missing-token behavior with invalid/revoked or insufficient-scope token cases, which could mislead users during debugging.
  • Given the moderate severity (4/10) and high confidence (9/10), the impact is mainly user-facing clarity in docs, not runtime stability or security behavior changes.
  • Pay close attention to docs/netdata-cloud/authentication-and-authorization/api-tokens.md - align the 412 explanation so token-missing and token-validity/scope scenarios are clearly separated.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="docs/netdata-cloud/authentication-and-authorization/api-tokens.md">

<violation number="1" location="docs/netdata-cloud/authentication-and-authorization/api-tokens.md:110">
P2: This bullet contradicts the earlier explanation that HTTP 412 specifically means the Authorization token is missing. Listing invalid/revoked or insufficient-scope tokens here makes the troubleshooting guidance internally inconsistent.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant Client as User / MCP Client
    participant API as Netdata Cloud API
    participant Auth as Auth Middleware
    participant Settings as User Settings (UI)

    Note over Client, Settings: Token Generation (Prerequisite)
    Client->>Settings: Navigate to API Tokens
    Settings->>Settings: NEW: Generate Token with Scopes
    Settings-->>Client: Bearer <token>

    Note over Client, Auth: Runtime Request Flow

    Client->>API: API Request (e.g., GET /api/v2/nodes)
    
    alt Missing or Malformed "Authorization" Header
        API->>Auth: Check for Bearer Token
        Auth-->>API: Missing/Invalid
        API-->>Client: NEW (Clarified): HTTP 412 Precondition Failed
    else Header Exists
        API->>Auth: Validate Bearer <token>
        Auth->>Auth: Verify Token & Scopes (e.g., scope:all)
        
        alt Valid Token & Authorized Scope
            Auth-->>API: Success
            API-->>Client: HTTP 200 OK + JSON Response
        else Invalid Token or Insufficient Scopes
            Auth-->>API: Failed Validation
            API-->>Client: NEW (Clarified): HTTP 412 Precondition Failed
        end
    end

    Note right of API: Netdata Cloud uses 412 specifically for<br/>Auth failures instead of generic 401/403.
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

**Common causes:**

- Missing `Authorization` header entirely
- Using an invalid or revoked token
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This bullet contradicts the earlier explanation that HTTP 412 specifically means the Authorization token is missing. Listing invalid/revoked or insufficient-scope tokens here makes the troubleshooting guidance internally inconsistent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/netdata-cloud/authentication-and-authorization/api-tokens.md, line 110:

<comment>This bullet contradicts the earlier explanation that HTTP 412 specifically means the Authorization token is missing. Listing invalid/revoked or insufficient-scope tokens here makes the troubleshooting guidance internally inconsistent.</comment>

<file context>
@@ -81,3 +81,32 @@ curl -H 'Accept: application/json' -H "Authorization: Bearer <token>" https://ap
+**Common causes:**
+
+- Missing `Authorization` header entirely
+- Using an invalid or revoked token
+- Incorrect header format (missing "Bearer " prefix)
+- Token with insufficient scope for the requested endpoint
</file context>
Fix with Cubic

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a troubleshooting section to the Netdata Cloud API token documentation to help users diagnose HTTP 412 responses when calling Cloud API endpoints.

Changes:

  • Reformats the “Available Scopes” table for API tokens.
  • Adds a “Troubleshooting HTTP 412 Errors” section with guidance on adding Authorization: Bearer ... headers and generating tokens.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +87 to +90
If you receive an HTTP 412 (Precondition Failed) error when accessing Netdata Cloud API endpoints, this indicates that you are trying to access an authenticated endpoint without providing a valid Bearer token in the `Authorization` header.

In the context of Netdata Cloud, HTTP 412 specifically means that the API request is missing the required authorization token, rather than indicating a generic HTTP precondition failure.

Comment on lines +93 to +97
1. **Generate an API token** from your Netdata Cloud settings:
- Click your profile picture in the bottom-left corner
- Select "User Settings"
- Navigate to the API Tokens section
- Create a new token with appropriate scopes for your use case
2. **Include the token in your request headers**:

```console
curl -H 'Accept: application/json' -H "Authorization: Bearer <your-token-here>" https://app.netdata.cloud/api/v2/nodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants