Developer Guide

API Reference

Integrate EchoStash into your applications using our REST API. Fetch and render prompts programmatically with simple HTTP requests.

Getting Started

The EchoStash API allows you to programmatically access your prompts. You can use any HTTP client like cURL, or integrate with your preferred programming language.

Base URL

All API requests should be made to: https://gra-echostash-be-prod.up.railway.app

We also provide lightweight helper classes for Python and JavaScript to streamline integration. See the Helper Libraries section below.

Authentication

All API requests require authentication via an API key. Sign in to create API keys.

API Key Header

Include your API key using the X-API-KEY header with every request.

Terminal
curl -X GET "https://gra-echostash-be-prod.up.railway.app/api/sdk/prompts/123" \
  -H "X-API-KEY: sk_your_api_key"

Get Prompt

Retrieve a prompt by its ID. Returns the currently published version content and metadata.

GET/api/sdk/prompts/{promptId}

Terminal
curl -X GET "https://gra-echostash-be-prod.up.railway.app/api/sdk/prompts/123" \
  -H "X-API-KEY: sk_your_api_key"

Response

Response
{
  "id": 123,
  "name": "Welcome Email",
  "description": "Personalized welcome email template for new users",
  "content": "Hello, {{name}}! Welcome to {{company}}.",
  "parameterSymbol": "{{}}",
  "publishedVersionNo": 3,
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-20T14:00:00Z"
}

Get Specific Version

Retrieve a specific version of a prompt by its version number. Useful for accessing historical versions or testing changes before publishing.

GET/api/sdk/prompts/{promptId}/versions/{versionNo}

Terminal
curl -X GET "https://gra-echostash-be-prod.up.railway.app/api/sdk/prompts/123/versions/2" \
  -H "X-API-KEY: sk_your_api_key"

Response

Response
{
  "versionNo": 2,
  "content": "Hello, {{name}}! Welcome aboard.",
  "parameterSymbol": "{{}}",
  "metadata": "{\"author\": \"product-team\", \"notes\": \"Simplified greeting\"}",
  "createdAt": "2024-01-18T08:00:00Z"
}

Render Prompt

Render a prompt with variable substitution. Pass your variables in the request body, and they will be replaced based on the prompt's parameter symbol (e.g., {{}}).

POST/api/sdk/prompts/{promptId}/render

Terminal
curl -X POST "https://gra-echostash-be-prod.up.railway.app/api/sdk/prompts/123/render" \
  -H "X-API-KEY: sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"variables": {"name": "World", "company": "Acme Corp"}}'

Response

Response
{
  "content": "Hello, World! Welcome to Acme Corp.",
  "promptId": 123,
  "versionNo": 3
}

Render Specific Version

You can render a specific version or the latest unpublished version by passing the version parameter.

Terminal
# Render a specific version
curl -X POST "https://gra-echostash-be-prod.up.railway.app/api/sdk/prompts/123/render" \
  -H "X-API-KEY: sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"variables": {"name": "World"}, "version": "2"}'

# Render the latest unpublished version
curl -X POST "https://gra-echostash-be-prod.up.railway.app/api/sdk/prompts/123/render" \
  -H "X-API-KEY: sk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"variables": {"name": "World"}, "version": "latest"}'

Error Handling

The API returns standard HTTP status codes. Errors include a JSON body with details about what went wrong.

200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
404Not Found - Prompt or version does not exist
429Too Many Requests - Rate limit exceeded

Example Error Response

Response
{
  "timestamp": "2024-01-15T10:30:00Z",
  "status": 404,
  "error": "Prompt not found",
  "path": "/api/sdk/prompts/999"
}

Helper Libraries

To simplify integration, we provide lightweight helper classes for Python and JavaScript. These files wrap the API endpoints and can be dropped directly into your project.

Need help? Contact us at support@echostash.app