Skip to main content

Endpoint

method
string
default:"POST"
POST
endpoint
string
/v1/prompt/create

Authentication

This endpoint requires API key authentication. Include your API key in the request headers:
Authorization: Bearer YOUR_API_KEY

Request Body

userDefinedId
string
required
User-defined identifier for the prompt. This is used to reference the prompt in your code
prompt
object
required
The prompt template content. Should follow OpenAI chat completion format with messages array and model
metadata
object
required
Additional metadata for the prompt as key-value pairs

Response

data
object
Created prompt information
id
string
Unique identifier for the prompt
prompt_version_id
string
Unique identifier for the initial prompt version
error
string | null
Error message if the request failed, null otherwise

Example Request

curl -X POST https://api.helicone.ai/v1/prompt/create \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "userDefinedId": "customer-support-v1",
    "prompt": {
      "model": "gpt-4",
      "messages": [
        {
          "role": "system",
          "content": "You are a helpful customer support assistant."
        },
        {
          "role": "user",
          "content": "{{user_question}}"
        }
      ]
    },
    "metadata": {
      "department": "support",
      "version": "1.0"
    }
  }'

Example Response

{
  "data": {
    "id": "prompt_abc123",
    "prompt_version_id": "pv_xyz789"
  },
  "error": null
}

Notes

  • The userDefinedId must be unique within your organization
  • Use {{variable_name}} syntax for template variables in your prompt
  • The initial version is automatically set as version 1.0

Build docs developers (and LLMs) love