Get a single snippet
Snippets
Get Snippet
Retrieves a single snippet by its ID. API Cost: 1 request.
GET
Get a single snippet
Overview
Retrieves a single snippet by its ID. This endpoint returns the complete snippet data including content, metadata, folder assignment, and timestamps. API Cost: 1 requestCode Examples
Response Example
Use Cases
Fetching Prompt for Voice AI Integration
Fetching Prompt for Voice AI Integration
Retrieve a specific prompt variation for use in voice AI services like VAPI:
Display in Application UI
Display in Application UI
Fetch snippet data to display in your application:
Verify Snippet Exists Before Update
Verify Snippet Exists Before Update
Check if a snippet exists before performing operations:
Cache Frequently Accessed Snippets
Cache Frequently Accessed Snippets
Implement caching to reduce API calls:
Error Handling
Common Issues
404 Not Found
404 Not Found
Problem: The snippet ID doesn’t exist or was deleted.Solution:
- Verify the snippet ID is correct
- Check if the snippet was deleted
- Ensure the snippet belongs to your workspace
403 Forbidden
403 Forbidden
Problem: Your API key doesn’t have access to the snippet’s team.
Solution: - Check your API key’s team permissions - Ensure the API key has
access to the required team - Verify your workspace subscription is active
401 Unauthorized
401 Unauthorized
Best Practices
Use caching for frequently accessed snippets to reduce API calls
Implement error handling for all possible error scenarios
Store snippet IDs persistently to avoid lookup operations
Monitor usage through the response’s usage field
Validate IDs before making requests to avoid unnecessary API calls
Related Endpoints
- Get Multiple Snippets - Fetch multiple snippets at once
- Create Snippet - Create a new snippet
- Update Snippet - Update an existing snippet
- Get Snippet Variation - Get a specific variation