Skip to main content
POST
/
api
/
prompts
/
create
curl -X POST "https://your-domain.com/api/prompts/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "command": "summarize",
    "name": "Text Summarizer",
    "content": "Please summarize the following text: {{input}}",
    "tags": ["productivity", "writing"],
    "commit_message": "Initial creation of summarizer prompt",
    "access_grants": []
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "command": "summarize",
  "user_id": "user-123",
  "name": "Text Summarizer",
  "content": "Please summarize the following text: {{input}}",
  "data": {},
  "meta": {},
  "tags": ["productivity", "writing"],
  "is_active": true,
  "version_id": "ver-123",
  "created_at": 1709164800,
  "updated_at": 1709164800,
  "access_grants": []
}
Creates a new prompt and automatically creates the initial version in the history. The user must have the workspace.prompts or workspace.prompts_import permission unless they are an admin.

Request Body

command
string
required
Unique command trigger for the prompt (e.g., “summarize”). Must not already be in use.
name
string
required
Display name for the prompt
content
string
required
The prompt template content. Can include variable placeholders like {{variable}}.
data
object
Additional data to associate with the prompt
meta
object
Metadata for the prompt
tags
array
Array of tag strings for categorizing the prompt
access_grants
array
Array of access grant objects defining who can access this prompt
commit_message
string
Message describing this initial version. Defaults to “Initial version”.
is_production
boolean
default:true
Whether to set the new version as the production version

Response

id
string
required
Unique identifier for the newly created prompt
command
string
required
Command trigger for the prompt
user_id
string
required
ID of the user who created the prompt
name
string
required
Display name for the prompt
content
string
required
The prompt template content
data
object
Additional data associated with the prompt
meta
object
Metadata for the prompt
tags
array
Array of tag strings
is_active
boolean
default:true
Whether the prompt is currently active
version_id
string
required
ID of the initial history entry created for this prompt
created_at
integer
required
Unix timestamp (epoch seconds) when prompt was created
updated_at
integer
required
Unix timestamp (epoch seconds) when prompt was last updated
access_grants
array
default:[]
Array of access grant objects

Error Responses

  • 400 Bad Request: Command is already in use by another prompt
  • 401 Unauthorized: User lacks required permissions
curl -X POST "https://your-domain.com/api/prompts/create" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "command": "summarize",
    "name": "Text Summarizer",
    "content": "Please summarize the following text: {{input}}",
    "tags": ["productivity", "writing"],
    "commit_message": "Initial creation of summarizer prompt",
    "access_grants": []
  }'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "command": "summarize",
  "user_id": "user-123",
  "name": "Text Summarizer",
  "content": "Please summarize the following text: {{input}}",
  "data": {},
  "meta": {},
  "tags": ["productivity", "writing"],
  "is_active": true,
  "version_id": "ver-123",
  "created_at": 1709164800,
  "updated_at": 1709164800,
  "access_grants": []
}