REST API Reference
Promptmark exposes ~31 JSON API endpoints under /api/. All endpoints require authentication via Bearer JWT in the Authorization header.
Authorization: Bearer YOUR_JWT_TOKEN
Prompts
/api/prompts
Create a new prompt.
Body:
{
"title": "My Prompt",
"prompt": "Write a {{style}} email about {{topic}}",
"notes": "Optional notes",
"type_id": "general",
"tags": ["email", "writing"],
"collection_id": "col_123",
"is_public": false,
"is_remixable": false,
"self_rating": 3.5
}
Response: 201 Created with the created prompt object.
/api/prompts
List prompts with optional filtering.
Query parameters: search, tag, collection_id, type_id, page, limit
Response: 200 OK with paginated prompt list.
/api/prompts/:id
Get a specific prompt by ID.
Response: 200 OK with the prompt object.
/api/prompts/:id
Update a prompt. Only provided fields are changed.
Response: 200 OK with the updated prompt.
/api/prompts/:id
Soft-delete a prompt.
Response: 204 No Content
Tags
/api/tags/add
Add a tag to a prompt.
Body: {"prompt_id": "...", "tag": "new-tag"}
/api/tags/remove
Remove a tag from a prompt.
Body: {"prompt_id": "...", "tag": "old-tag"}
/api/tags/rename
Rename a tag across all prompts.
Body: {"old_name": "old-tag", "new_name": "new-tag"}
Versions
/api/prompts/:id/versions
List version history for a prompt.
Response: 200 OK with array of version snapshots.
/api/prompts/:id/versions/:vid
Get a specific version snapshot.
Response: 200 OK with the version object.
/api/prompts/:id/versions
Create an explicit major version with a description.
Body: {"description": "Version description"}
/api/prompts/:id/restore/:vid
Restore a prompt to a previous version. Snapshots current state first.
Response: 200 OK with the restored prompt.
Collections
/api/collections
List all collections.
Response: 200 OK with collection array.
/api/collections
Create a new collection.
Body: {"name": "...", "description": "...", "color": "cyan", "icon": "code"}
/api/collections/:id
/api/collections/:id
/api/collections/:id
/api/prompts/:id/collection
Move a prompt to a collection.
Body: {"collection_id": "col_123"}
Testing
/api/test/start
Start a test run. Returns a test ID for SSE streaming.
Body: {"prompt_id": "...", "model_id": "...", "variables": {...}}
/api/test/stream
SSE stream for test responses.
Query: id (test ID from start endpoint)
/api/test/:id/feedback
Submit feedback for a test response.
Body: {"rating": 1, "notes": "Great response"}
Achievements
/api/onboarding/achievements
/api/onboarding/dismiss
/api/onboarding/restore
Scans
/api/prompts/:id/scan/acknowledge
Acknowledge a safety scan issue.
Body: {"category": "pii"}
Categories: pii, injection, secrets, danger
Sharing
/api/share/prompt/:id
/api/share/collection/:id
/api/share/prompt/:id/qr
Utility
/api/ping
Check authentication status. Returns 200 if token is valid, 401 if not.
Response: {"status": "ok", "user_id": "123"}
/health