# snippetai-for-your-api-documentation
Source: https://speakeasy.com/blog/snippetai-for-your-api-documentation


import { ReactPlayer } from "@/lib/mdx/components";

Helping developers understand how to use your API is a critical part of API adoption. Today, we're excited to announce SnippetAI - an AI-powered code snippet generator that integrates directly into your API documentation. SnippetAI enables your users to ask natural language questions about your API and instantly receive contextualized code examples that leverage your actual SDKs, dramatically reducing integration time and improving the developer experience.

<div className="mt-10 flex justify-center">
  <ReactPlayer
    controls={false}
    loop={true}
    playing={true}
    url="/assets/videos/snippet.mp4"
    volume={0}
    width="100%"
    height="auto"
  />
</div>

## How it works

SnippetAI adds an intelligent assistant to your documentation that specializes in generating code snippets for your API. Users can:

1. Click the "Generate Code Example" button or use keyboard shortcut (⌘+S / Ctrl+S)
2. Ask a natural language question like "How do I create a new user?"
3. Receive contextually relevant code snippets that use your actual SDK implementation

SnippetAI analyzes your OpenAPI specification and SDK code samples to generate snippets that match your real implementation, ensuring developers get accurate, working examples every time.

## Key benefits

- **Accelerated integration**: Developers can quickly generate working code samples for your API without having to piece together documentation
- **Improved Developer Experience**: Natural language interface removes friction when exploring your API's capabilities
- **Higher adoption rates**: By making your API easier to implement, SnippetAI helps drive increased API usage and adoption
- **Lower support burden**: Comprehensive, accurate code examples reduce the need for basic integration support
- **Easy integration**: Add to your documentation site with just a few lines of code as a web component or React component

## Getting started

To add SnippetAI to your documentation:

1. Enable the SnippetAI add-on in your Speakeasy dashboard under the Docs tab
2. Generate a publishing token for your target SDK
3. Integrate SnippetAI into your documentation site using one of three methods:
   - React component
   - Web Component (ES Module)
   - Web Component (UMD script)

The integration process takes just minutes, and you can customize the appearance to match your documentation's look and feel.

For detailed integration instructions, see our [SnippetAI documentation](/docs/sdk-docs/snippet-ai/overview).