Skip to main content

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.

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:
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');
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')
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:

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:
{
	"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?