A Go-based API for managing prompt/knowledge/context data with template filling capabilities.
- RESTful API for managing JSON data structure
- Endpoints for Prompts, Contexts, Knowledge, and Template Libraries
- Template variable filling functionality
- JSON data persistence
The data managed by this API is generated and exported from Synapse, a native macOS app for organizing and managing reusable prompts, context information, and knowledge items for LLM workflows.
Synapse is a powerful macOS application designed to help users structure and manage their AI workflow content. It features:
- Three Main Sections: Prompts (with placeholders), Contexts (reference materials), and Knowledge (facts and summaries)
- Organized Structure: Custom groups, tags, favorites, and smart collections for easy organization and retrieval
- Rich Features: AI-powered prompt generation (OpenRouter integration), advanced search and filtering, import/export, visual editor, and metadata tracking
- Workflow Enhancements: Global hotkeys, batch prompt generation, keyboard navigation, and a native three-panel macOS interface
- Data Storage: All data is stored in a human-readable JSON file at
~/Documents/synapse_data.json, which can be imported/exported for use with this API
For more details, see the Synapse documentation or the full feature list below.
- Clone the repository
- Run
go mod tidyto install dependencies - Run
go run main.goto start the server
The server will start on port 8081.
To start the API server:
go run main.goOr to build and run:
go build -o synapse-api
./synapse-apiGET /api/data- Get all dataPUT /api/data- Update all data
GET /api/prompts- Get all promptsPUT /api/prompts- Update prompts
GET /api/contexts- Get all contextsPUT /api/contexts- Update contexts
GET /api/knowledge- Get all knowledge itemsPUT /api/knowledge- Update knowledge items
GET /api/templates- Get all template librariesPUT /api/templates- Update template libraries
POST /api/fill-template- Fill a template with variablesPOST /api/fill-template-by-id- Fill a template by its ID with variables
Example request body for /api/fill-template:
{
"template": "Hello {name}, welcome to {place}!",
"variables": {
"name": "John",
"place": "our platform"
}
}Example request body for /api/fill-template-by-id:
{
"template_id": "94BD3B8E-93C4-4ED8-B2A1-9765016C9521",
"variables": {
"meeting_topic": "project planning",
"recipient_name": "John Doe",
"sender_name": "Jane Smith"
}
}You can run the provided test script to verify the API is working:
./test-api.shNote: You'll need curl and jq installed for the test script to work.
The API manages a JSON structure with the following main components:
savedSearches- Array of saved searchestemplateLibraries- Array of template libraries with snippetsgroups- Object containing groups for Prompts, Contexts, and KnowledgecustomSnippets- Array of custom snippetssmartCollections- Array of smart collectionslastModified- Timestamp of last modification
- Gorilla Mux - HTTP router