Skip to main content

API Setup Template

The Setup guide helps users prepare their environment to work with your API. This includes obtaining credentials, configuring authentication, installing SDKs, and ensuring they have the right tools and permissions. It’s the bridge between deciding to use your API and actually making that first call.
This template doesn’t exist in the original source yet. This is a foundational template based on API documentation best practices.

When to Use This Template

Use this template when you need to:
  • Guide users through account creation and API key generation
  • Explain authentication and authorization
  • Help users install SDKs or libraries
  • Configure development and production environments
  • Set up webhooks or callback URLs
  • Verify that prerequisites are met

Why Setup Documentation Matters

Users can’t make API calls until they have:
  • Valid credentials (API keys, tokens, etc.)
  • The right development environment
  • Proper authentication configured
  • Understanding of different environments (sandbox vs. production)
Without clear setup documentation, users get stuck before they even start.
Poor setup documentation is a major source of support tickets. Invest time here to reduce friction.

What to Include

How do users get access to your API?Start with the absolute first step—getting an account.
## Create an Account

Before you can use the API, you'll need to create a free account:

<Steps>
  <Step title="Sign up">
    Visit [dashboard.example.com/signup](https://dashboard.example.com/signup) 
    and create an account using your email address.
  </Step>
  
  <Step title="Verify your email">
    Check your inbox for a verification email and click the confirmation link.
  </Step>
  
  <Step title="Complete your profile">
    Add your company information and intended use case. This helps us 
    provide better support.
  </Step>
</Steps>

<Info>
New accounts start in sandbox mode with test credentials. You'll need to 
complete verification before accessing production API keys.
</Info>
How do users obtain API keys or tokens?Provide step-by-step instructions with screenshots.
## Get Your API Keys

<Steps>
  <Step title="Access the dashboard">
    Log in to your [dashboard](https://dashboard.example.com) and navigate 
    to **Settings > API Keys**.
  </Step>
  
  <Step title="Create an API key">
    Click **Create New Key** and choose the key type:
    
    - **Test keys** (`sk_test_...`) - Use in development and testing
    - **Production keys** (`sk_live_...`) - Use for real transactions
    
    <Warning>
    Production keys require account verification and may take 24-48 hours to activate.
    </Warning>
  </Step>
  
  <Step title="Copy and store securely">
    Copy your API key immediately - you won't be able to view it again.
    
    <Card title="Security Best Practices" icon="shield">
      - Never commit keys to version control
      - Store keys in environment variables
      - Rotate keys regularly
      - Use different keys for each environment
    </Card>
  </Step>
</Steps>
How do users authenticate requests?Explain your authentication mechanism clearly.
## Authentication

All API requests must be authenticated using your API key.

### Using API Keys

Include your API key in the `Authorization` header as a Bearer token:

```bash
curl https://api.example.com/v1/payments \
  -H "Authorization: Bearer sk_test_abc123"
```

<CodeGroup>
```javascript Node.js
const client = new APIClient({
  apiKey: process.env.API_KEY // Load from environment
});
```

```python Python
import os
client = APIClient(
  api_key=os.environ.get('API_KEY')
)
```
</CodeGroup>

### Authentication Errors

| Status | Error | Cause |
|--------|-------|-------|
| 401 | `invalid_api_key` | API key is missing or incorrect |
| 401 | `expired_api_key` | API key has been revoked |
| 403 | `insufficient_permissions` | Key doesn't have required scope |
How do users install client libraries?Provide installation instructions for all supported languages.
## Install the SDK

We provide official SDKs for popular programming languages:

<Tabs>
  <Tab title="Node.js">
    **Requirements**: Node.js 16+ 
    
    ```bash
    npm install @example/api-client
    # or
    yarn add @example/api-client
    ```
    
    ```javascript
    const { APIClient } = require('@example/api-client');
    const client = new APIClient({ apiKey: 'your_api_key' });
    ```
  </Tab>
  
  <Tab title="Python">
    **Requirements**: Python 3.7+
    
    ```bash
    pip install example-api
    ```
    
    ```python
    from example_api import APIClient
    client = APIClient(api_key='your_api_key')
    ```
  </Tab>
  
  <Tab title="Ruby">
    **Requirements**: Ruby 2.7+
    
    ```bash
    gem install example-api
    ```
    
    ```ruby
    require 'example_api'
    client = ExampleAPI::Client.new(api_key: 'your_api_key')
    ```
  </Tab>
  
  <Tab title="REST API">
    Don't use an SDK? Make HTTP requests directly:
    
    ```bash
    curl https://api.example.com/v1/payments \
      -X POST \
      -H "Authorization: Bearer your_api_key" \
      -H "Content-Type: application/json" \
      -d '{"amount": 2000, "currency": "usd"}'
    ```
  </Tab>
</Tabs>

<Tip>
View all SDKs and code examples at [github.com/example/sdks](https://github.com/example/sdks)
</Tip>
How do users configure different environments?Help users understand sandbox vs. production.
## Environments

Our API supports two environments:

### Sandbox (Test Mode)

<Card title="Sandbox Environment" icon="flask">
  - Base URL: `https://api-sandbox.example.com`
  - API keys start with `sk_test_`
  - No real transactions are processed
  - Use test data (see [test cards](/docs/testing))
  - Rate limit: 100 requests/second
</Card>

Perfect for development, testing, and integration.

### Production (Live Mode)

<Card title="Production Environment" icon="rocket">
  - Base URL: `https://api.example.com`
  - API keys start with `sk_live_`
  - Real transactions are processed
  - Requires verified account
  - Rate limit: 1000 requests/second
</Card>

Use for real customer transactions.

### Switching Environments

Simply change the API key—our SDKs automatically detect the environment:

```javascript
// Test mode
const testClient = new APIClient({ 
  apiKey: 'sk_test_abc123' 
});

// Production mode
const liveClient = new APIClient({ 
  apiKey: 'sk_live_xyz789' 
});
```

<Warning>
Never use test API keys in production or production keys in development.
</Warning>
Do users need to set up webhooks?If your API uses webhooks, explain how to configure them.
## Set Up Webhooks

Webhooks notify your application when events happen in your account.

<Steps>
  <Step title="Create an endpoint">
    Create a URL in your application that can receive POST requests:
    
    ```javascript
    app.post('/webhooks/payments', (req, res) => {
      const event = req.body;
      
      switch(event.type) {
        case 'payment.succeeded':
          // Handle successful payment
          break;
        case 'payment.failed':
          // Handle failed payment
          break;
      }
      
      res.sendStatus(200);
    });
    ```
  </Step>
  
  <Step title="Register the endpoint">
    In your dashboard, go to **Settings > Webhooks** and add your endpoint URL:
    
    - Development: `https://your-dev-server.com/webhooks/payments`
    - Production: `https://your-app.com/webhooks/payments`
  </Step>
  
  <Step title="Verify signatures">
    Always verify webhook signatures to ensure requests are from us:
    
    ```javascript
    const signature = req.headers['x-webhook-signature'];
    const isValid = client.webhooks.verify(req.body, signature);
    
    if (!isValid) {
      return res.sendStatus(401);
    }
    ```
  </Step>
</Steps>

<Tip>
Use [webhook.site](https://webhook.site) to test webhook delivery during development.
</Tip>
How can users verify everything is configured correctly?Provide a simple test to validate the setup.
## Test Your Connection

Verify your setup with a simple API call:

```bash
curl https://api.example.com/v1/account \
  -H "Authorization: Bearer your_api_key"
```

Successful response:

```json
{
  "id": "acct_abc123",
  "email": "[email protected]",
  "status": "active",
  "environment": "test"
}
```

<Check>
If you received your account information, you're ready to start building!
</Check>

Template Structure

# Getting Started with [API Name]

## Prerequisites

[System requirements, knowledge prerequisites]

## Create an Account

[Sign up process]

## Get API Keys

[How to obtain credentials]

## Authentication

[How to authenticate requests]

## Install the SDK (Optional)

[SDK installation for supported languages]

## Environments

[Sandbox vs. production configuration]

## Set Up Webhooks (Optional)

[Webhook configuration if applicable]

## Test Your Setup

[Simple verification test]

## Next Steps

[Link to quickstart and other guides]

Best Practices

1

Make account creation frictionless

Don’t require extensive information upfront. Let users get started quickly with test credentials.
2

Provide sandbox access immediately

Users should be able to start testing within minutes of signing up, without waiting for verification.
3

Use clear API key naming

Name conventions like sk_test_ and sk_live_ make it obvious which environment a key is for.
4

Emphasize security early

Teach users proper security practices from the start (environment variables, key rotation, etc.).
5

Support multiple installation methods

Provide instructions for package managers (npm, pip, gem) and direct HTTP requests.
6

Include a verification step

Give users a simple way to test that everything is configured correctly.
7

Link to the quickstart

Once setup is complete, guide users directly to making their first API call.

Common Setup Issues

Possible causes:
  • Key was copied with extra whitespace
  • Using test key with production URL (or vice versa)
  • Key was revoked or regenerated
  • Account requires verification
Solution: Generate a new key and ensure environment matches.
Possible causes:
  • Incorrect package name
  • Unsupported language version
  • Network/firewall blocking package registry
Solution: Check language version requirements and network access.
Possible causes:
  • URL not publicly accessible
  • Firewall blocking incoming requests
  • Server not returning 200 status
  • Webhook endpoint not registered
Solution: Test with webhook.site first, then verify server configuration.
Setup documentation should get users from zero to ready-to-build as quickly as possible. Remove every unnecessary barrier.

Next Steps

Quickstart Guide

Make your first API call in 10 minutes

Overview

Learn what the API can do

API Reference

Browse all available endpoints

Administration Guide

System administration and deployment

Build docs developers (and LLMs) love