Create Prompt
Create a new prompt that you can use across your AI applications. Build prompts from one or more components, and use handlebars-style variables like {{userName}} for personalization.
Safe by Default: Creating a prompt creates a new version but doesn’t activate it. Your production prompts stay unchanged until you explicitly activate the new version (via the UI or when you reference it in the Messages API). This lets you test and prepare new prompts without risk.
Versioning: Every prompt is immutable and versioned with fingerprinting, so you can safely iterate and track changes over time.
curl --request POST \
--url https://www.greenflash.ai/api/v1/prompts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Customer Support Prompt",
"description": "Standard customer support prompt",
"externalPromptId": "support-v1",
"components": [
{
"content": "You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.",
"type": "system",
"source": "customer",
"name": "Base Instructions",
"isDynamic": false
}
],
"tags": [
"support",
"customer-facing"
]
}
'import os
from greenflash import Greenflash
client = Greenflash(
api_key=os.environ.get("GREENFLASH_API_KEY"), # This is the default and can be omitted
)
create_prompt_response = client.prompts.create(
components=[{
"content": "You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.",
"type": "system",
"source": "customer",
"name": "Base Instructions",
"is_dynamic": False,
}],
name="Customer Support Prompt",
product_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
role="x",
description="Standard customer support prompt",
external_prompt_id="support-v1",
)
print(create_prompt_response.component_ids)import Greenflash from 'greenflash';
const client = new Greenflash({
apiKey: process.env['GREENFLASH_API_KEY'], // This is the default and can be omitted
});
const createPromptResponse = await client.prompts.create({
components: [
{
content: 'You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.',
type: 'system',
source: 'customer',
name: 'Base Instructions',
isDynamic: false,
},
],
name: 'Customer Support Prompt',
productId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
role: 'x',
description: 'Standard customer support prompt',
externalPromptId: 'support-v1',
});
console.log(createPromptResponse.componentIds);package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.greenflash.ai/api/v1/prompts"
payload := strings.NewReader("{\n \"name\": \"Customer Support Prompt\",\n \"description\": \"Standard customer support prompt\",\n \"externalPromptId\": \"support-v1\",\n \"components\": [\n {\n \"content\": \"You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.\",\n \"type\": \"system\",\n \"source\": \"customer\",\n \"name\": \"Base Instructions\",\n \"isDynamic\": false\n }\n ],\n \"tags\": [\n \"support\",\n \"customer-facing\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.greenflash.ai/api/v1/prompts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Customer Support Prompt\",\n \"description\": \"Standard customer support prompt\",\n \"externalPromptId\": \"support-v1\",\n \"components\": [\n {\n \"content\": \"You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.\",\n \"type\": \"system\",\n \"source\": \"customer\",\n \"name\": \"Base Instructions\",\n \"isDynamic\": false\n }\n ],\n \"tags\": [\n \"support\",\n \"customer-facing\"\n ]\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.greenflash.ai/api/v1/prompts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Customer Support Prompt',
'description' => 'Standard customer support prompt',
'externalPromptId' => 'support-v1',
'components' => [
[
'content' => 'You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.',
'type' => 'system',
'source' => 'customer',
'name' => 'Base Instructions',
'isDynamic' => false
]
],
'tags' => [
'support',
'customer-facing'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"promptId": "123e4567-e89b-12d3-a456-426614174000",
"versionId": "123e4567-e89b-12d3-a456-426614174001",
"componentIds": [
"123e4567-e89b-12d3-a456-426614174002"
]
}{
"success": true,
"error": "<string>"
}{
"success": true,
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Prompt name.
Product this prompt will map to.
Role key in the product mapping (e.g. "agent tool").
1Array of component objects.
1Show child attributes
Show child attributes
Your external identifier for the prompt.
Prompt description.
Prompt source.
customer, participant, greenflash, agent Response
Prompt created successfully
The created prompt ID.
The created version ID. Version is created but not activated (activation happens via UI or Messages API).
The IDs of the created prompt components.
The external prompt ID.
Was this page helpful?
curl --request POST \
--url https://www.greenflash.ai/api/v1/prompts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Customer Support Prompt",
"description": "Standard customer support prompt",
"externalPromptId": "support-v1",
"components": [
{
"content": "You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.",
"type": "system",
"source": "customer",
"name": "Base Instructions",
"isDynamic": false
}
],
"tags": [
"support",
"customer-facing"
]
}
'import os
from greenflash import Greenflash
client = Greenflash(
api_key=os.environ.get("GREENFLASH_API_KEY"), # This is the default and can be omitted
)
create_prompt_response = client.prompts.create(
components=[{
"content": "You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.",
"type": "system",
"source": "customer",
"name": "Base Instructions",
"is_dynamic": False,
}],
name="Customer Support Prompt",
product_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
role="x",
description="Standard customer support prompt",
external_prompt_id="support-v1",
)
print(create_prompt_response.component_ids)import Greenflash from 'greenflash';
const client = new Greenflash({
apiKey: process.env['GREENFLASH_API_KEY'], // This is the default and can be omitted
});
const createPromptResponse = await client.prompts.create({
components: [
{
content: 'You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.',
type: 'system',
source: 'customer',
name: 'Base Instructions',
isDynamic: false,
},
],
name: 'Customer Support Prompt',
productId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
role: 'x',
description: 'Standard customer support prompt',
externalPromptId: 'support-v1',
});
console.log(createPromptResponse.componentIds);package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.greenflash.ai/api/v1/prompts"
payload := strings.NewReader("{\n \"name\": \"Customer Support Prompt\",\n \"description\": \"Standard customer support prompt\",\n \"externalPromptId\": \"support-v1\",\n \"components\": [\n {\n \"content\": \"You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.\",\n \"type\": \"system\",\n \"source\": \"customer\",\n \"name\": \"Base Instructions\",\n \"isDynamic\": false\n }\n ],\n \"tags\": [\n \"support\",\n \"customer-facing\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.greenflash.ai/api/v1/prompts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Customer Support Prompt\",\n \"description\": \"Standard customer support prompt\",\n \"externalPromptId\": \"support-v1\",\n \"components\": [\n {\n \"content\": \"You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.\",\n \"type\": \"system\",\n \"source\": \"customer\",\n \"name\": \"Base Instructions\",\n \"isDynamic\": false\n }\n ],\n \"tags\": [\n \"support\",\n \"customer-facing\"\n ]\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.greenflash.ai/api/v1/prompts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Customer Support Prompt',
'description' => 'Standard customer support prompt',
'externalPromptId' => 'support-v1',
'components' => [
[
'content' => 'You are a helpful assistant for {{productName}}. Greet {{userName}} warmly.',
'type' => 'system',
'source' => 'customer',
'name' => 'Base Instructions',
'isDynamic' => false
]
],
'tags' => [
'support',
'customer-facing'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"promptId": "123e4567-e89b-12d3-a456-426614174000",
"versionId": "123e4567-e89b-12d3-a456-426614174001",
"componentIds": [
"123e4567-e89b-12d3-a456-426614174002"
]
}{
"success": true,
"error": "<string>"
}{
"success": true,
"error": "<string>"
}
