Access prompts via the API
Prompt Share exposes a small HTTP API so your own worker scripts can pull prompts from your library, run generation, and mark the results done — no browser session required. This page walks through creating a key and running the full loop.
The generation flow has three moving parts: lock the next available prompt (it moves to Queued so no other worker grabs it), do your generation work, then mark it complete (it moves to Generated). Prompts you have set to Inactive are skipped entirely.
1. Create an API key
In the app, open Settings → Personal API Keys, enter a name (for example My worker), and click create. The full key is shown once — copy it immediately and store it securely. Only a hash is kept on the server, so it can never be shown again; if you lose it, revoke it and make a new one.
Every key looks like this and is tied to your account:
sk_1a2b3c4d5e6f...
You can create several keys (one per worker/script) and revoke any of them individually from the same screen without affecting the others.
2. Authenticate
Send the key in an Authorization header as a Bearer token. This works on every /api/v1/* endpoint and replaces the browser cookie session — no CSRF token is needed for key-authenticated requests.
Authorization: Bearer sk_1a2b3c4d5e6f...
All examples below use this base URL:
https://psapi.degird.com
3. Generate prompts
/api/v1/prompts/lockAtomically claims the oldest Pending prompt, flips it to Queued, and returns it. Pass a script_id to identify the worker, and optionally a type to only pick prompts of that type. Returns null when nothing is available.
curl -X POST https://psapi.degird.com/api/v1/prompts/lock \
-H "Authorization: Bearer sk_1a2b3c4d5e6f..." \
-H "Content-Type: application/json" \
-d '{ "script_id": "my-worker-1", "type": "Image" }'Response
{
"id": "a1b2c3d4",
"prompt": "A neon cyberpunk city street at night",
"type": "Image",
"status": "Queued",
"tags": "neon,city",
"locked_by": "my-worker-1",
"locked_at": "2026-07-09T03:00:00.000Z",
"pack_title": "Cyberpunk Pack"
}/api/v1/prompts/completeAfter you finish generating, mark the prompt done. It moves to Generated.
curl -X POST https://psapi.degird.com/api/v1/prompts/complete \
-H "Authorization: Bearer sk_1a2b3c4d5e6f..." \
-H "Content-Type: application/json" \
-d '{ "prompt_id": "a1b2c3d4" }'Response
{ "success": true }/api/v1/prompts/recoverIf a worker crashes mid-job, its prompt stays Queued. Call recover to release your stuck prompts back to Pending. (The server also sweeps stuck prompts automatically every few minutes, so this is optional.)
curl -X POST https://psapi.degird.com/api/v1/prompts/recover \ -H "Authorization: Bearer sk_1a2b3c4d5e6f..."
Full worker example
A minimal Node.js loop that drains every pending prompt: lock one, generate, complete, repeat until lock returns null.
const API = "https://psapi.degird.com";
const KEY = process.env.PROMPT_SHARE_KEY; // your sk_... key
const headers = {
"Authorization": `Bearer ${KEY}`,
"Content-Type": "application/json",
};
async function run() {
while (true) {
// 1. Lock the next pending prompt
const locked = await fetch(`${API}/api/v1/prompts/lock`, {
method: "POST",
headers,
body: JSON.stringify({ script_id: "my-worker-1" }),
}).then((r) => r.json());
if (!locked) {
console.log("No pending prompts left. Done.");
break;
}
// 2. Do your generation work with locked.prompt
console.log("Generating:", locked.id, locked.prompt);
// ... call your image/text model here ...
// 3. Mark it complete
await fetch(`${API}/api/v1/prompts/complete`, {
method: "POST",
headers,
body: JSON.stringify({ prompt_id: locked.id }),
});
}
}
run().catch(console.error);Notes & limits
- Keep the key secret. Anyone with it has full API access to your account — store it in an environment variable, never in client-side code or a public repo.
- The raw key is shown only once at creation. Lost it? Revoke it in Settings and create a new one.
- Inactive prompts are never returned by /lock, so parking a prompt as Inactive removes it from automation until you set it back to Pending.
- Only Pending prompts are lockable. A worker cannot pick a prompt that is already Queued, Generated, or Inactive.
- Rate limit: 120 requests per minute per account (counted per user, not per IP — so it is the same whether you call from one worker or several). A worker spends 2 requests per prompt (lock + complete), so that covers roughly 60 prompts per minute. Exceeding it returns HTTP 429; space out heavy automation rather than hammering the endpoints in a tight loop.