Skip to main content

Overview

Use this endpoint to retrieve the contents of a prompt template from a specific project, either by version number or by tag. This is useful if you want to render the prompt locally, inspect its structure, or execute it manually with your own runtime.

Endpoint

GET https://api.promptrun.ai/v1/prompt

Query Parameters

ParamTypeRequiredDescription
projectIdstring✅ YesThe UUID of the project
versionnumber❌ Yes*The specific version number of the prompt
tagstring❌ Yes*A named alias like "prod" or "dev"
⚠️ You must provide either version or tag, but not both.

Example Request

curl -X GET "https://api.promptrun.ai/v1/prompt?projectId=abc123&tag=prod" \
  -H "Authorization: Bearer <API_KEY>"

Example Response

{
  "updatedAt": "2025-07-21T04:17:39.294Z",
  "prompt": "Generate {{word_count}} words essay about Georgian History.",
  "version": 27,
  "versionMessage": "I have updated system prompt to generate {{word_count}} words essay about Georgian History.",
  "tag": "latest",
  "project": {
    "id": "d0d52c6e-85ba-4025-a84c-3c99834fe2ac",
    "name": "Georgian History Essay Generator"
  }
}

Validation Logic

If both version and tag are provided, the API will return:
{
  "error": "You must provide either `version` or `tag`, but not both."
}

Use Cases

  • Fetch prompt content for rendering inside your app or chatbot
  • Validate prompt structure before executing it
  • Preview and compare different versions for auditing

Error Codes

CodeMeaning
400Both version and tag provided
401Unauthorized or invalid API key
404Project or prompt version/tag not found

Coming Soon

  • Ability to fetch schema alongside prompt
  • Support for fetching multiple prompt variants in batch