> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getsnippets.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Getting started with the Snippets AI API

## Welcome to the Snippets AI API

The Snippets AI API allows you to programmatically manage snippets, folders, tags, and variations. Build powerful integrations to automate your workflow and sync your code snippets across different platforms.

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/api-reference/authentication">
    Learn how to authenticate your API requests
  </Card>

  <Card title="Rate Limiting" icon="gauge-high" href="/api-reference/rate-limiting">
    Understand rate limits and usage quotas
  </Card>

  <Card title="Error Codes" icon="triangle-exclamation" href="/api-reference/errors">
    Reference for all API error codes
  </Card>

  <Card title="Usage & Billing" icon="credit-card" href="/api-reference/usage-billing">
    Learn about API usage costs and billing
  </Card>
</CardGroup>

## Base URL

All API requests should be made to:

```
https://www.getsnippets.ai/api/prompts
```

## Quick Start

Get up and running in minutes:

### 1. Get Your API Key

1. Log into your Snippets AI workspace
2. Navigate to Admin → API Access
3. Create a new API key with appropriate team permissions
4. Copy the secret key (you won't be able to see it again)

### 2. Make Your First Request

Here's a simple example to fetch a snippet:

```javascript theme={null}
const axios = require('axios');

const API_KEY = 'your_api_key_here';
const BASE_URL = 'https://www.getsnippets.ai/api/prompts';

async function getSnippet(snippetId) {
	try {
		const response = await axios.get(`${BASE_URL}/snippet`, {
			headers: {
				Authorization: `Bearer ${API_KEY}`,
			},
			params: {
				id: snippetId,
			},
		});

		console.log('Snippet:', response.data);
		return response.data;
	} catch (error) {
		console.error('Error:', error.response?.data || error.message);
	}
}

getSnippet('your-snippet-id');
```

```python theme={null}
import requests

API_KEY = 'your_api_key_here'
BASE_URL = 'https://www.getsnippets.ai/api/prompts'

def get_snippet(snippet_id):
    headers = {
        'Authorization': f'Bearer {API_KEY}'
    }
    params = {
        'id': snippet_id
    }

    response = requests.get(
        f'{BASE_URL}/snippet',
        headers=headers,
        params=params
    )

    if response.status_code == 200:
        print('Snippet:', response.json())
        return response.json()
    else:
        print('Error:', response.json())

get_snippet('your-snippet-id')
```

```bash theme={null}
curl -X GET "https://www.getsnippets.ai/api/prompts/snippet?id=your-snippet-id" \
  -H "Authorization: Bearer your_api_key_here"
```

## API Resources

The API is organized around four main resource types:

<CardGroup cols={2}>
  <Card title="Snippets" icon="code" href="/api-reference/snippets/get-snippet">
    Manage your code and text snippets
  </Card>

  <Card title="Variations" icon="clone" href="/api-reference/variations/get-variation">
    Handle multiple versions of snippets
  </Card>

  <Card title="Folders" icon="folder" href="/api-reference/folders/get-folder">
    Organize snippets into folders
  </Card>

  <Card title="Tags" icon="tags" href="/api-reference/tags/get-tag">
    Categorize snippets with tags
  </Card>
</CardGroup>

## Key Features

### 🔐 Secure Authentication

All requests use Bearer token authentication with API keys that have granular team-level permissions.

### ⚡ Rate Limited

The API is rate-limited to 20 requests per minute per API key to ensure fair usage and system stability.

### 💰 Usage-Based Billing

Pay only for what you use: \$10 per 100,000 API requests. Each endpoint clearly documents its cost.

### 📊 Detailed Metadata

Every response includes usage information, pagination details, and comprehensive metadata about the operation.

### 🔄 Batch Operations

Save on API costs by using batch endpoints to create, update, or delete multiple resources at once.

## Response Format

All API responses follow a consistent format:

```json theme={null}
{
	"success": true,
	"data": {
		// Response data here
	},
	"usage": {
		"remainingRequests": 99850
	},
	"metadata": {
		// Additional metadata
	}
}
```

### Success Response

* `success`: Boolean indicating if the request was successful
* `data`: The requested data or result
* `usage`: Information about API usage and remaining quota
* `metadata`: Additional context about the operation

### Error Response

* `success`: Always `false` for errors
* `message`: Human-readable error description
* `error`: Additional error details (when available)

## Need Help?

<CardGroup cols={2}>
  <Card title="Documentation" icon="book" href="https://docs.getsnippets.ai">
    Full documentation and guides
  </Card>

  <Card title="Support" icon="life-ring" href="mailto:team@getsnippets.ai">
    Contact our support team
  </Card>
</CardGroup>
