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. By default, PromptStash returns the latest version tagged active, or you can target an exact prompt version number with x-version.
- 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 toactivex-version: exact prompt version number, such as1or3
x-tag and x-version are mutually exclusive.
Successful response (200):
{
"content": "...prompt content...",
"name": "Version name",
"version": 3,
"tags": ["active"],
"variables": [
{
"name": "tone",
"type": "string",
"required": true,
"requireUserInput": true
}
],
"schema": {
"type": "object",
"properties": {
"tone": { "type": "string" }
},
"required": ["tone"]
}
}Error responses:
- 400:
{ ok: false, error: "Missing required headers" } - 400:
{ ok: false, error: "x-version and x-tag cannot be used together" } - 400:
{ ok: false, error: "Invalid x-version header" } - 401:
{ ok: false, error: "Invalid API key" } - 404:
{ ok: false, error: "Prompt not found or has no matching versions" }
Example using curl with x-tag:
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 with x-version:
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-version": "3",
},
});
if (!res.ok) throw new Error(await res.text());
const data = await res.json();
// data: { content, name, version, tags, variables, schema }Next steps
Last updated on