Apidog Docs
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
HomeLearning CenterSupport CenterAPI References
HomeLearning CenterSupport CenterAPI References
Discord Community
Slack Community
X / Twitter
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
  1. Publish API Docs
  • Apidog Learning Center
  • Get started
    • Introduce Apidog
    • Navigating Apidog
    • Basic concepts in Apidog
    • Quick Start
      • Overview
      • Specify a new endpoint
      • Make a request to the endpoint
      • Add an assertion
      • Create a test scenario
      • Share your API documentation
      • Explore more
      • Send a request and save as an endpoint
    • Migration to Apidog
      • Overview
      • Manual import
      • Scheduled import
      • Import options
      • Export data
      • Import from...
        • Import from Postman
        • Import OpenAPI (Swagger) spec
        • Import cURL
        • Import Markdowns
        • Import from Insomnia
        • Import from apiDoc
        • Import .har file
        • Import WSDL
  • Design APIs
    • Overview
    • Organization method of endpoints
    • Endpoint basics
    • Components
    • Common fields
    • Global parameters
    • Endpoint change history
    • Batch endpoint management
    • Configure multiple request body examples
    • Module
    • Schemas
      • Overview
      • Create a new schema
      • Build a schema
      • Generate Schemas from JSON etc.
    • Security schemes
      • Overview
      • Create a security scheme
      • Use the security scheme
      • Security scheme in online documentation
    • Advanced features
      • Custom endpoint fields
      • Import endpoints as test steps
      • Endpoint status
      • Appearance of parameter lists
      • Endpoint unique identification
  • Develop and Debug APIs
    • Overview
    • Generate requests
    • Send requests
    • Endpoint cases
    • Dynamic values
    • Validate responses
    • Design-first Mode & Request-first Mode
    • Generate code
    • Environments & variables
      • Overview
      • Using variables
      • Environment Management
    • Vault secrets
      • Overview
      • HashiCorp Vault
      • Azure Key Vault
      • AWS Secrets Manager
    • Pre/Post processors
      • Overview
      • Assertion
      • Extract variable
      • Wait
      • Database operations
        • Overview
        • MySQL
        • MongoDB
        • Redis
        • Oracle Client
      • Using scripts
        • Overview
        • Pre processor scripts
        • Post processor scripts
        • Public scripts
        • Postman scripts reference
        • Calling other programming languages
        • Using JS libraries
        • Visualizing responses
        • Script examples
          • Assertion scripts
          • Using variables in scripts
          • Using scripts to modify request messages
          • Other examples
    • Dynamic values Modules
  • Mock API data
    • Overview
    • Smart mock
    • Custom mock
    • Mock priority sequence
    • Mock scripts
    • Cloud mock
    • Self-hosted runner mock
    • Mock language (Locales)
  • Automated tests
    • Overview
    • Test reports
    • Test scenarios
      • Create a test scenario
      • Pass data between requests
      • Flow control conditions
      • Sync data from endpoints/endpoint cases
      • Import endpoints/endpoint cases from other projects
      • Export test scenarios
    • Run test scenarios
      • Run a test scenario
      • Data-driven testing
      • Run test scenarios in batch
      • Scheduled tasks
      • Manage the runtime environment of APIs from other projects
    • Test APIs
      • Integration testing
      • Performance testing
      • End-to-end testing
      • Regression testing
    • Apidog CLI
      • Overview
      • Installing and running Apidog CLI
      • Apidog CLI Options
    • CI/CD
      • Overview
      • Integrate with Github Actions
      • Integrate with Jenkins
      • Integrate with Gitlab
      • Trigger Test by Git Commit
  • Publish API Docs
    • Overview
    • API Technologies Supported
    • Quick share
    • View the API documentation
    • Markdown documentations
    • Publish docs sites
    • Custom layouts
    • Custom CSS, JavaScript, HTML
    • Custom domain
    • LLM-friendly Features
    • SEO settings
    • Advanced Settings
      • Documentation Search
      • CORS Proxy
      • Integrating Google Analytics with Doc Sites
      • Folder tree settings
      • Visibility settings
      • Embedding values in document URLs
    • API Versions
      • Overview
      • Create API versions
      • Publish API versions
      • Share endpoints with API versions
  • Send requests
    • Overview
    • gRPC
    • Use request proxy agents for debugging
    • SOAP/WebService
    • GraphQL
    • WebSocket
    • SSE debugging
    • Socket.IO
    • Create requests
      • Request History
      • Request basics
      • Parameters and body
      • Request headers
      • Request settings
      • HTTP/2
    • Authentication and authorization
      • Overview
      • CA and client certificates
      • Authorization types supported by Apidog
      • Digest Auth
      • OAuth 1.0
      • OAuth 2.0
      • Hawk Authentication
      • Kerberos
      • NTLM
      • Akamai EdgeGrid
    • Response and cookies
      • Overview
      • API response in Apidog
      • Create and send cookies
      • Debug requests
      • Save the request as an endpoint
  • Branches
    • Overview
    • Create a new sprint branch
    • Test APIs in a branch
    • Design API in a branch
    • Merge sprint branches
    • Manage sprint branches
  • AI Features
    • Overview
    • Enable AI Features
    • Modify Schemas with AI
    • FAQs
  • Apidog MCP Server
    • Overview
    • Connect API Specification within Apidog Project to AI via Apidog MCP Server
    • Connect Online API Documentation Published by Apidog to AI via Apidog MCP Server
    • Connect OpenAPI Files to AI via Apidog MCP Server
  • Best practices
    • How to handle API signatures
    • How to access OAuth 2.0 protected APIs
    • Apidog collaboration workflow
    • Managing authentication state in Apidog
  • Administration
    • Onboarding Checklist
      • Basic Concepts
      • Onboarding Guide
    • Managing Teams
      • Managing Teams
      • Managing Team Members
      • Member Roles & Permission Settings
      • Team Activities
      • Team Resources
        • General Runner
        • Team Variables
        • Request Proxy Agent
      • Real-time Collaborations
        • Team Collaboration
    • Managing Projects
      • Managing Projects
      • Managing Project Members
      • Notification Settings
      • Project Resources
        • Database Connection
    • Managing Organizations
      • Single Sign-On (SSO)
        • SSO Overview
        • Configure Microsoft Entra ID
        • Configure Okta
        • Configure SSO for an Organization
        • Managing user accounts
        • Mapping Groups to Teams
      • SCIM Provisioning
        • Intro to SCIM Provisioning
        • Microsoft Entra ID
        • Okta
      • Organization Resources
        • Self-hosted Runner
  • Billing
    • Overview
    • Credits
    • Unable to use credit cards?
    • Managing subscriptions
    • Upgrade plan
  • Data & Security
    • Where is Apidog's data stored, and how is data security ensured?
    • How is user data stored? Will this data be public? Or will it be private? Will all data be stored in the cloud?
    • When sending requests, do they go through the Apidog server? Is data security ensured?
  • Add-ons
    • API Hub
    • Apidog Intellij IDEA plugin
    • Browser Extension
      • Chrome
      • Microsoft Edge
    • Request Proxy
      • Request proxy in Apidog web
      • Request proxy in shared docs
      • Request proxy in Apidog client
  • Account & preferences
    • Account settings
    • Generate OpenAPI access token
    • Language settings
    • Hot keys
    • Network proxy configuration
    • Data backup
    • Updating Apidog
    • Deleting account
    • Experimental Features
  • References
    • API-Design First Approach
    • Apidog OpenAPI/Swagger Specificaiton Extensions
    • JSONPath
    • XPath
    • Regular Expressions
    • JSON Schema
    • CSV File Format
    • Install Java Environment
    • Runner deployment environment
    • Apidog flavored Markdown
  • Apidog Europe
    • Apidog Europe
  • Support Center
  1. Publish API Docs

Custom CSS, JavaScript, HTML

When publishing your API documentation, you can add custom global HTML, CSS, and JavaScript to personalize page styles and extend functionality.
This feature is useful for:
Embedding third-party services (e.g., chatbots, AI assistants)
Modifying default styles (e.g., font, color, background)
Adding interactive elements (e.g., buttons, popups, quick feedback)
By using this feature wisely, your documentation can better reflect your brand identity and improve the user experience.

CSS#

With custom CSS, you can change fonts, hide elements, adjust margins, alter colors, and more.
Since the documentation structure may change in future updates, we recommend following these two principles to ensure your styles remain effective:
1.
Use reserved CSS variables
2.
Use reserved CSS class names

Use reserved CSS variables#

Apidog provides a set of CSS variables prefixed with --g- to control basic page styles such as font, color, and background. These variables adapt well to both light and dark modes, making your styles more stable and maintainable.
Common Variables Reference
Example: Change main text color

Use reserved CSS class names#

To target specific areas for styling, use Apidog’s reserved class names with the .g- prefix, which are relatively stable and less likely to break due to DOM changes.
Common CSS Class Reference
Example: Hide the left sidebar

Inspecting page structure and class names#

In addition to the reserved CSS variables and class names mentioned above, you can also use the browser's developer tools to find the class name corresponding to the page element you want to modify, and then write CSS to adjust the style.
It is recommended to use class names starting with .g- first. These are reserved by the platform, have a relatively stable structure, and are not easy to fail. For other structural class names, please use them with caution to avoid style failure after product upgrades.
You can open the published doc site in the browser and use the developer tools (developer mode/console) to view the page structure and style class names:
Mac: Command + Option + Iorfn + F12
Windows: Ctrl + Shift + Iorfn + F12orF12
Upon opening, click the "Element Selector" (the mouse icon), and then click any area on the page to view the HTML tags and class names corresponding to that area.
You can also use the search function (Cmd/Ctrl + F) to locate a class name.
image.png

JavaScript#

Custom JavaScript is used to embed third-party services like AI assistants or support widgets. Note: Apidog's custom JavaScript field does not support <script> or <style> tags. You must convert these into pure JavaScript. For example:
❌ Original(not supported)
✅ Converted to Pure JavaScript
If you want to embed a third-party script or style but are not sure how to rewrite it into pure JS format, you can copy the prompt below and paste it into an AI tool (such as Claude) to let AI help you convert it automatically:
I'm using Apidog's "Custom JavaScript" feature, which only allows pure JavaScript (no <script> or <style> tags).

Please convert the following code to pure JavaScript. Here are the requirements:
1. Rewrite the <script> tag to document.createElement('script') dynamic creation method;
2. Inject the <style> content into the newly created style tag and insert the head;
3. Please use standard methods (such as createElement, appendChild) for all DOM operations, and do not use document.write;
4. If the original code uses window.addEventListener('DOMContentLoaded'...), please replace it with the 'load' event, which is more stable;
5. The final generated JavaScript should be able to run directly in the browser without any explanation.

Original code:
---
(paste your code here)
---
For security, custom JavaScript only works when accessing docs via Custom domain.
If you access it through the default documentation address provided by Apidog (such as starting with https://xxx.apidog.io/), the custom JS will not be loaded and executed.
Please ensure that the code itself is reliable to avoid affecting normal loading or destroying the page structure.
If you need to wait for the page to load before executing the code, use load instead of DOMContentLoaded, for example:

Example: Click the button to expand/collapse the iframe dialog#

Script for "Click the button to expand/collapse the iframe dialog"
How to use:
1
Paste the code into Apidog's "Custom JavaScript" area.
2
Visit doc sites via your custom domain
3
A button appears at the bottom-right corner; click to open the chat iframe.
4
Replace iframe.src with your AI service, e.g.:
Custom CSS and JavaScript

Example: Embedding Chatbase widget#

Script for "Embedding Chatbase Chat Widget"
How to use:
1
Create a Chatbase app, get the embed code, convert it to pure JS using the prompt above.
image.png
Paste the converted code into the Apidog's Custom JS section.
2
Visit the doc sites via your custom domain.
3
A button will appear at the bottom-right corner. Click it to open a dialog window.
Custom CSS and JavaScript

HTML#

Coming soon...

FAQs#

Custom JS not working?
Make sure you're visiting the documentation via a custom domain. Custom JavaScript is only executed when using a bound custom domain.
Why use 'load' instead of 'DOMContentLoaded'?
Modified at 2025-07-16 07:35:30
Previous
Custom layouts
Next
Custom domain
Built with