SDK Documentation
Lightweight wrapper classes for TypeScript and Python. No package to install — just copy the class into your project.
Installation & Setup
typescript
// No package to install — just copy the PromptCask class below into your project.
// Then instantiate the client:
const client = new PromptCask({
apiKey: "pk_live_...",
baseUrl: "https://app.promptcask.com",
});Prompts
typescript
// List prompts
const { data } = await client.prompts.list({ page: 1, limit: 20 });
console.log(data.prompts); // Prompt[]
// Get a single prompt
const prompt = await client.prompts.get("prompt-uuid");
// Create a prompt
const created = await client.prompts.create({
title: "Email Writer",
content: "Write a {{tone}} email about {{topic}}",
tags: ["marketing"],
});
// Update a prompt
await client.prompts.update("prompt-uuid", {
title: "Updated Email Writer",
tags: ["marketing", "email"],
});
// Delete a prompt
await client.prompts.delete("prompt-uuid");
// Execute a prompt with variable substitution
const result = await client.prompts.execute("prompt-uuid", {
variables: { tone: "professional", topic: "AI safety" },
});
console.log(result.data.response);Skill Files
typescript
// List skill files
const skills = await client.skillFiles.list({ page: 1, limit: 20 });
// Create a skill file
const skill = await client.skillFiles.create({
name: "code-review.skill.md",
description: "Reviews pull requests",
content: "# Code Review\n\nReview PRs for best practices...",
});
// Update a skill file
await client.skillFiles.update("skill-uuid", { description: "Updated description" });
// Delete a skill file
await client.skillFiles.delete("skill-uuid");Snippets
typescript
// List snippets
const snippets = await client.snippets.list({ page: 1 });
// Create a snippet
const snippet = await client.snippets.create({
name: "Brand Voice",
content: "Always use a professional yet approachable tone.",
tags: ["brand"],
});
// Update
await client.snippets.update("snippet-uuid", { content: "Updated voice guidelines." });
// Delete
await client.snippets.delete("snippet-uuid");Plugins
typescript
// List plugins
const plugins = await client.plugins.list();
// Create a plugin
const plugin = await client.plugins.create({
name: "Slack Notifier",
type: "integration",
config: { channel: "#prompts" },
});
// Update
await client.plugins.update("plugin-uuid", { config: { channel: "#updates" } });
// Delete
await client.plugins.delete("plugin-uuid");Search
typescript
// Semantic search across all workspace content
const results = await client.search({
q: "how to write professional emails",
type: "prompt,snippet",
limit: 10,
});
console.log(results.data); // SearchResult[]Batch Operations
typescript
// Execute multiple operations in one request (max 25)
const batch = await client.batch([
{ method: "GET", path: "/prompts" },
{ method: "POST", path: "/snippets", body: { name: "Test", content: "Hello" } },
{ method: "DELETE", path: "/snippets/snippet-uuid" },
]);
console.log(batch.results); // BatchResult[]Full Wrapper Class — Copy & Paste
Copy this entire class into your project. No external dependencies required.
typescript
/**
* PromptCask TypeScript SDK wrapper.
* Copy this class into your project and instantiate with your API key.
*/
class PromptCask {
private apiKey: string;
private baseUrl: string;
constructor(opts: { apiKey: string; baseUrl?: string }) {
this.apiKey = opts.apiKey;
this.baseUrl = (opts.baseUrl ?? "https://app.promptcask.com") + "/api/v1";
}
private async request<T = any>(
method: string,
path: string,
body?: Record<string, unknown>,
params?: Record<string, string | number>
): Promise<T> {
const url = new URL(this.baseUrl + path);
if (params) {
for (const [k, v] of Object.entries(params)) {
if (v !== undefined) url.searchParams.set(k, String(v));
}
}
const res = await fetch(url.toString(), {
method,
headers: {
Authorization: `Bearer ${this.apiKey}`,
"Content-Type": "application/json",
},
body: body ? JSON.stringify(body) : undefined,
});
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err?.error?.message ?? `HTTP ${res.status}`);
}
if (res.status === 204) return undefined as T;
return res.json();
}
prompts = {
list: (params?: { page?: number; limit?: number }) =>
this.request("GET", "/prompts", undefined, params as any),
get: (id: string) => this.request("GET", `/prompts/${id}`),
create: (data: { title: string; content?: string; description?: string; category?: string; tags?: string[] }) =>
this.request("POST", "/prompts", data),
update: (id: string, data: Record<string, unknown>) =>
this.request("PATCH", `/prompts/${id}`, data),
delete: (id: string) => this.request("DELETE", `/prompts/${id}`),
execute: (id: string, data: { variables?: Record<string, string>; model?: string }) =>
this.request("POST", `/prompts/${id}/execute`, data),
};
skillFiles = {
list: (params?: { page?: number; limit?: number }) =>
this.request("GET", "/skill-files", undefined, params as any),
get: (id: string) => this.request("GET", `/skill-files/${id}`),
create: (data: { name: string; description?: string; content?: string }) =>
this.request("POST", "/skill-files", data),
update: (id: string, data: Record<string, unknown>) =>
this.request("PATCH", `/skill-files/${id}`, data),
delete: (id: string) => this.request("DELETE", `/skill-files/${id}`),
};
snippets = {
list: (params?: { page?: number; limit?: number }) =>
this.request("GET", "/snippets", undefined, params as any),
get: (id: string) => this.request("GET", `/snippets/${id}`),
create: (data: { name: string; content: string; tags?: string[] }) =>
this.request("POST", "/snippets", data),
update: (id: string, data: Record<string, unknown>) =>
this.request("PATCH", `/snippets/${id}`, data),
delete: (id: string) => this.request("DELETE", `/snippets/${id}`),
};
plugins = {
list: (params?: { status?: string }) =>
this.request("GET", "/plugins", undefined, params as any),
get: (id: string) => this.request("GET", `/plugins/${id}`),
create: (data: { name: string; type?: string; config?: Record<string, unknown> }) =>
this.request("POST", "/plugins", data),
update: (id: string, data: Record<string, unknown>) =>
this.request("PATCH", `/plugins/${id}`, data),
delete: (id: string) => this.request("DELETE", `/plugins/${id}`),
};
search = (params: { q: string; type?: string; limit?: number }) =>
this.request("GET", "/search", undefined, params as any);
batch = (operations: { method: string; path: string; body?: Record<string, unknown> }[]) =>
this.request("POST", "/batch", { operations });
}