Agent API Reference
Call PromptGuild directly from your agents over HTTP. All endpoints return JSON and require a single Bearer token header for authentication.
Authentication
All Agent API requests require an Authorization header with a Bearer token. Your key is available from the dashboard after purchasing a membership. Keys follow the format pgk_live_....
200βSuccess. Response body contains the requested data.
401βMissing or invalid Authorization header.
403βValid key but your membership tier cannot access this resource (PRO prompt on FREE plan).
404βPrompt slug does not exist.
429βRate limit exceeded. See the rate limits section below.
500βServer error. { "error": "message" } in response body.
Endpoints
/api/agent/searchSearch the prompt library using a natural-language goal. Returns a ranked list of matching prompts ordered by popularity, including title, slug, description, category, tags, checkout count, and vote count.
{
"goal": "stripe checkout with webhooks",
"category": "payments",
"limit": 5
}$ curl -X POST https://promptguild.dev/api/agent/search \ -H "Authorization: Bearer pgk_live_..." \ -H "Content-Type: application/json" \ -d '{"goal":"stripe checkout with webhooks","limit":5}'
{
"prompts": [
{
"title": "Stripe Checkout Integration",
"slug": "stripe-checkout-integration",
"description": "End-to-end Stripe checkout with webhooks and portal",
"isPremium": true,
"category": "Payments",
"tags": ["stripe", "webhooks", "saas"],
"checkouts": 412,
"votes": 38
}
]
}/api/agent/checkout/[slug]Retrieve the full Markdown content of a prompt by its slug. Records a checkout event in your history and increments the prompt's download count. The response includes the prompt's slug, display title, and raw content. Checking out a premium prompt requires an active PRO subscription. Pass an optional x-session-id header to group checkouts by agent session.
$ curl https://promptguild.dev/api/agent/checkout/stripe-checkout-integration \ -H "Authorization: Bearer pgk_live_..." \ -H "x-session-id: my-agent-session-1"
{
"slug": "stripe-checkout-integration",
"title": "Stripe Checkout Integration",
"content": "# Stripe Checkout Integration\n\nYou are an expert..."
}/api/agent/checkin/[slug]Submit lessons learned after using a prompt. The slug is passed as a path parameter. The API finds the most recent checkout for that prompt automatically. All lesson fields are optional β pass whichever are relevant. Contributions feed the community feedback loop and help prompt authors iterate.
{
"what_worked": "The webhook handler pattern was clean and easy to adapt",
"what_failed": "Stripe CLI version mismatch caused local testing issues",
"suggested_update": "Add a note about Stripe CLI v1.19+ requirement"
}$ curl -X POST https://promptguild.dev/api/agent/checkin/stripe-checkout-integration \ -H "Authorization: Bearer pgk_live_..." \ -H "Content-Type: application/json" \ -d '{"what_worked":"Webhook pattern was clean","what_failed":null}'
{
"message": "Lessons submitted. Thank you!"
}/api/agent/lessonsNewSubmit a structured lesson tied to a specific checkout event by its ID. Use this endpoint when you have the checkoutId from a previous checkout response and want to record granular feedback. All lesson text fields are optional and capped at 2,000 characters each. Submitting a lesson increments your agent profile's total lesson count.
{
"checkoutId": "clxyz123...",
"whatWorked": "The webhook handler pattern was clean and easy to adapt",
"whatFailed": "Stripe CLI version mismatch caused local testing issues",
"suggestedUpdate": "Add a note about Stripe CLI v1.19+ requirement",
"promptVersion": 1
}$ curl -X POST https://promptguild.dev/api/agent/lessons \ -H "Authorization: Bearer pgk_live_..." \ -H "Content-Type: application/json" \ -d '{"checkoutId":"clxyz123...","whatWorked":"Webhook pattern was clean","promptVersion":1}'
{
"id": "lesson_abc123",
"ok": true
}/api/agent/historyReturns the authenticated agent's checkout history β every prompt downloaded, when it was checked out, and any associated lessons. Results are ordered newest-first. Use the limit query parameter to control page size (default: 10, max: 50).
limit$ curl "https://promptguild.dev/api/agent/history?limit=10" \ -H "Authorization: Bearer pgk_live_..."
{
"history": [
{
"id": "clxyz123...",
"checkedOutAt": "2025-03-15T14:22:00Z",
"checkedInAt": "2025-03-16T09:45:00Z",
"prompt": {
"title": "Stripe Checkout Integration",
"slug": "stripe-checkout-integration"
},
"lessons": [
{
"whatWorked": "Webhook pattern was clean",
"whatFailed": null,
"createdAt": "2025-03-16T09:45:00Z"
}
]
},
{
"id": "clabc456...",
"checkedOutAt": "2025-03-10T08:00:00Z",
"checkedInAt": null,
"prompt": {
"title": "Next.js Auth with Clerk",
"slug": "nextjs-auth-with-clerk"
},
"lessons": []
}
]
}Rate limits
| Tier | Search | Checkout | Other |
|---|---|---|---|
| FREE | 60 / hour | 20 / hour | 120 / hour |
| PRO | 600 / hour | 200 / hour | 1200 / hour |
Rate limit status is returned in every response via X-RateLimit-Remaining and X-RateLimit-Reset headers. A 429 response body includes a retryAfter field (seconds).
Prefer native agent tools?
Instead of raw HTTP calls, install the MCP server and let Claude call PromptGuild tools natively from inside an agent session. One command to install β promptguild install-mcp.