PromptStash Documentation
Welcome to the PromptStash docs. This guide helps you get an API key and retrieve prompts from your projects, plus links to explore the Playground.
Create an API key
You can create and manage API keys in the app.
- Go to
/app/api-keys
. - Click “Create API Key” and give it a descriptive name.
- Copy the generated key and store it securely. It is shown only once.
Retrieve a prompt from the API
Use the public endpoint to retrieve a prompt version by slug.
- Method:
GET
- URL:
https://promptstash.app/api/prompts/retrieve
- Required headers:
x-api-key
: your API keyx-project-slug
: the project slugx-prompt-slug
: the prompt slug
- Optional headers:
x-tag
: version tag to target; defaults toactive
Successful response (200):
{
"content": "...prompt content...",
"name": "Version name",
"version": 3,
"tags": ["active"]
}
Error responses:
- 400:
{ ok: false, error: "Missing required headers" }
- 401:
{ ok: false, error: "Invalid API key" }
- 404:
{ ok: false, error: "Prompt not found or has no matching versions" }
Example using curl:
curl -X GET \
'https://promptstash.app/api/prompts/retrieve' \
-H 'x-api-key: YOUR_API_KEY' \
-H 'x-project-slug: your-project' \
-H 'x-prompt-slug: your-prompt' \
-H 'x-tag: active'
Example using fetch:
const res = await fetch("https://promptstash.app/api/prompts/retrieve", {
method: "GET",
headers: {
"x-api-key": process.env.PROMPTSTASH_API_KEY!,
"x-project-slug": "your-project",
"x-prompt-slug": "your-prompt",
// 'x-tag': 'active', // optional
},
});
if (!res.ok) throw new Error(await res.text());
const data = await res.json();
// data: { content, name, version, tags }
Next steps
Last updated on