Prompt Templates
List prompt templates
/api/v1/prompt-templatesReturn the catalog of prompt templates available to the caller. A prompt template is a reusable, parameterised LLM prompt that produces a specific kind of marketing copy (e.g. subject lines, social posts). Each entry advertises the parameter slots it accepts via the parameters array.
All query parameters are optional and combine with AND semantics. Pass the returned id of a template as promptTemplateId on POST /prompt-template-runs.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
country | string | — | ISO 3166-1 alpha-2 country code, e.g. de or us. |
language | string | — | ISO 639-1 language code, e.g. de or en. |
categoryKey | string | — | Restrict the listing to templates in a single category (matches :attr:PromptTemplate.categoryKey). |
type | string | — | Restrict the listing to a single task type, regardless of locale. Matches :attr:PromptTemplate.type (e.g. headlines, summarize, blog_intro). |
displayedInApp | boolean | — | Filter by whether the template appears in the in-app picker. Omit to return both displayed and hidden templates. |
page | integer | 1 | Page number to retrieve. The first page is 1 (not 0). |
size | integer | 20 | Number of elements per page. Maximum 100. |
Response
pageobject
sizeintegerRequested page size. Echoed back even when data contains fewer elements (e.g. on the last page).totalElementsintegerTotal number of elements across all pages.totalPagesintegerTotal number of pages given the requested size.currentPageintegerPage number returned. The first page is 1 (not 0).dataarray<object>Elements on the current page. May contain fewer than page.size on the last page.
idstringStable, globally unique identifier for this template (the row primary key on the underlying prompt table). Pass this as promptTemplateId on POST /prompt-template-runs — it is sufficient on its own to resolve the prompt; no separate language field is required.keystringHuman-readable composite key of the form {type}.{language}_{COUNTRY} (e.g. subject_lines.de_DE). Useful for filtering / grouping in UI pickers and for debugging. To run a template use id instead — keys are not guaranteed unique across future schema changes.typestringLocale-agnostic identifier for the kind of task this template produces (e.g. headlines, summarize, blog_intro). Shared by every locale variant of the same template kind, unlike id which is unique per locale. Filter the listing by type to narrow to a single task across locales.categoryKeystringIdentifier of the category this template belongs to (e.g. email, social, blog). Used by the UI to group templates in pickers.translationKeystringi18n key for the template's display name. Resolve to a localized string client-side; do not show the raw key to users.categoryTranslationKeystringi18n key for the template category's display name. Resolve client-side, same as translationKey.descriptionstringEnglish description of what this template produces and when to use it. For end-user display, resolve translationKey to a localized string instead.countrystringISO 3166-1 alpha-2 country code this template was tuned for. Combined with language to pick the right embedding model.languagestringISO 639-1 language code this template was tuned for.defaultInvocationCountintegerHow many times the underlying LLM call is fanned out in parallel by default. Higher values yield more variety at higher cost. Overridden by sampleCount on the generation request.defaultSampleCountintegerDefault number of distinct text variants returned per generation. The user may override via sampleCount on the request.displayedInAppbooleanWhether the template should appear in the template picker UI. Templates with false are still callable by key but are hidden from list views (e.g. internal/experimental templates).parametersobjectParameter slots this template accepts, keyed by slot id. Slot ids follow the input1 / input2 / … convention; only slots the template actually uses appear in the map. Pass the same keys back in parameters on POST /prompt-template-runs to supply values.usageVideoTutorialstringFully-qualified URL of a YouTube tutorial demonstrating how to use this template. null when no tutorial exists.Example
- cURL
- Python
- Node.js
- Go
curl "https://app.neuroflash.com/api/v1/prompt-templates" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
response = requests.get(
f"https://app.neuroflash.com/api/v1/prompt-templates",
headers={"Authorization": f"Bearer {token}"},
).json()
const response = await fetch(
`https://app.neuroflash.com/api/v1/prompt-templates`,
{ headers: { Authorization: `Bearer ${token}` } }
).then((r) => r.json());
req, _ := http.NewRequest("GET", "https://app.neuroflash.com/api/v1/prompt-templates", nil)
req.Header.Set("Authorization", "Bearer "+token)
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
Response:
{
"page": {
"size": 20,
"totalElements": 137,
"totalPages": 7,
"currentPage": 1
},
"data": [
{
"id": "12345",
"key": "subject_lines.de_DE",
"type": "subject_lines",
"categoryKey": "email_marketing",
"translationKey": "subjectLines",
"categoryTranslationKey": "emailMarketing",
"description": "Generate catchy subject lines for marketing emails.",
"country": "de",
"language": "de",
"defaultInvocationCount": 1,
"defaultSampleCount": 2,
"displayedInApp": true,
"parameters": {
"input1": {
"label": "Product",
"placeholder": "e.g. our new sustainable line",
"defaultValue": "",
"characterLimit": 600
},
"input2": {
"label": "Keywords",
"placeholder": "e.g. innovative, futuristic, bold",
"defaultValue": "innovative, futuristic, bold",
"characterLimit": 600
}
},
"usageVideoTutorial": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
]
}
Get a prompt template by id
/api/v1/prompt-templates/{id}Return a single prompt template identified by its id. Pass the same id back as promptTemplateId on POST /prompt-template-runs.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes |
Response
idstringStable, globally unique identifier for this template (the row primary key on the underlying prompt table). Pass this as promptTemplateId on POST /prompt-template-runs — it is sufficient on its own to resolve the prompt; no separate language field is required.keystringHuman-readable composite key of the form {type}.{language}_{COUNTRY} (e.g. subject_lines.de_DE). Useful for filtering / grouping in UI pickers and for debugging. To run a template use id instead — keys are not guaranteed unique across future schema changes.typestringLocale-agnostic identifier for the kind of task this template produces (e.g. headlines, summarize, blog_intro). Shared by every locale variant of the same template kind, unlike id which is unique per locale. Filter the listing by type to narrow to a single task across locales.categoryKeystringIdentifier of the category this template belongs to (e.g. email, social, blog). Used by the UI to group templates in pickers.translationKeystringi18n key for the template's display name. Resolve to a localized string client-side; do not show the raw key to users.categoryTranslationKeystringi18n key for the template category's display name. Resolve client-side, same as translationKey.descriptionstringEnglish description of what this template produces and when to use it. For end-user display, resolve translationKey to a localized string instead.countrystringISO 3166-1 alpha-2 country code this template was tuned for. Combined with language to pick the right embedding model.languagestringISO 639-1 language code this template was tuned for.defaultInvocationCountintegerHow many times the underlying LLM call is fanned out in parallel by default. Higher values yield more variety at higher cost. Overridden by sampleCount on the generation request.defaultSampleCountintegerDefault number of distinct text variants returned per generation. The user may override via sampleCount on the request.displayedInAppbooleanWhether the template should appear in the template picker UI. Templates with false are still callable by key but are hidden from list views (e.g. internal/experimental templates).parametersobjectParameter slots this template accepts, keyed by slot id. Slot ids follow the input1 / input2 / … convention; only slots the template actually uses appear in the map. Pass the same keys back in parameters on POST /prompt-template-runs to supply values.usageVideoTutorialstringFully-qualified URL of a YouTube tutorial demonstrating how to use this template. null when no tutorial exists.Example
- cURL
- Python
- Node.js
- Go
curl "https://app.neuroflash.com/api/v1/prompt-templates/{id}" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
response = requests.get(
f"https://app.neuroflash.com/api/v1/prompt-templates/{id}",
headers={"Authorization": f"Bearer {token}"},
).json()
const response = await fetch(
`https://app.neuroflash.com/api/v1/prompt-templates/${id}`,
{ headers: { Authorization: `Bearer ${token}` } }
).then((r) => r.json());
req, _ := http.NewRequest("GET", "https://app.neuroflash.com/api/v1/prompt-templates/"+id+"", nil)
req.Header.Set("Authorization", "Bearer "+token)
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
Response:
{
"id": "12345",
"key": "subject_lines.de_DE",
"type": "subject_lines",
"categoryKey": "email_marketing",
"translationKey": "subjectLines",
"categoryTranslationKey": "emailMarketing",
"description": "Generate catchy subject lines for marketing emails.",
"country": "de",
"language": "de",
"defaultInvocationCount": 1,
"defaultSampleCount": 2,
"displayedInApp": true,
"parameters": {
"input1": {
"label": "Product",
"placeholder": "e.g. our new sustainable line",
"defaultValue": "",
"characterLimit": 600
},
"input2": {
"label": "Keywords",
"placeholder": "e.g. innovative, futuristic, bold",
"defaultValue": "innovative, futuristic, bold",
"characterLimit": 600
}
},
"usageVideoTutorial": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
Run a prompt template
/api/v1/workspaces/{workspaceId}/prompt-template-runsRun the prompt template identified by promptTemplateId with the parameter values supplied in parameters, invoke the LLM pipeline, and return one or more generated text outputs packaged as a PromptTemplateRun.
The template determines the kind of text produced; tonality / length / personality / brandVoiceId / targetAudienceId steer the style of the output.
Streaming. The response media type is chosen by the caller's Accept header:
Accept: application/json(default) → a complete :class:PromptTemplateRunis returned once generation finishes.Accept: text/event-stream→ a Server-Sent Events stream is returned with partialdeltaevents followed by the final output. Streaming is currently limited to single-sample runs (sampleCountmust be1or unset).
Runs are not persisted yet — historical retrieval (GET /prompt-template-runs/{'{'}id{'}'}) is a future enhancement.
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
workspaceId | string | Yes | The workspace the request operates on. Must match the workspace claim in the gateway token. |
Request Body
promptTemplateIdstringYesId of the prompt template to run. Use the id value returned from GET /prompt-templates. The id encodes the locale, so no separate language field is needed.parametersobjectNoFree-form map of values for the parameter slots the selected prompt template accepts. Each template advertises which slot keys it uses via its parameters object on the :class:PromptTemplate returned from GET /prompt-templates — copy those keys here. Keys not used by the template are ignored. Defaulting: keys omitted from this map fall back to the template's defaultValue for that slot; keys present with a null or empty-string value bypass the default and pass through as-is. Omit the whole parameters object when the template needs no parameters.tonalityarray<string>NoFree-text steering hints for the writing style of the generated text, e.g. casual, professional, playful. These are inserted into the prompt; values are not constrained to an enum.lengthstringNoFree-text steering hint for output length, e.g. short, medium, long. Inserted into the prompt. Not a hard character limit.sampleCountintegerNoWhat you almost always want. The number of distinct text variants to return in outputs. The service fans out enough LLM invocations to produce at least this many samples, then trims to exactly sampleCount. Range: 1 - 10. When omitted, the template's defaultSampleCount is used.invocationCountintegerNoLow-level knob — most callers should leave this unset. How many parallel LLM invocations to run. Each invocation can yield several outputs depending on the template, so this is not the same as the number of variants returned. Setting sampleCount is the right way to control how many outputs you get; this field exists for advanced callers who want to explicitly trade off variety vs. cost. If sampleCount is also set, sampleCount wins.qualitystringNoAn enumeration.personalitystringNoFree-text personality description injected into the prompt. If set together with brandVoiceId the explicit personality text wins over the resolved brand voice.brandVoiceIdstringNoIdentifier of the brand voice that should steer this run. The service resolves the brand voice server-side; callers do not (and cannot) send the brand voice payload directly.targetAudienceIdstringNoIdentifier of the target audience that should steer this run. The service resolves the audience description server-side from this id (callers do not send the audience payload).additionalContextarray<string>NoExtra context snippets prepended to the prompt (e.g. product facts, reference excerpts). Each entry is a plain string.Response
outputsarray<object>Generated text outputs produced by the run. Length is at most sampleCount (or the template's default). Order is randomised.
idstringStable, globally unique identifier for this output. Use this as a back-reference when telling the system which output a user picked or rejected.textstringThe generated text.Example
- cURL
- Python
- Node.js
- Go
curl -X POST "https://app.neuroflash.com/api/v1/workspaces/{workspace_id}/prompt-template-runs" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"promptTemplateId": "string",
"parameters": {},
"tonality": [],
"length": "string",
"sampleCount": 0,
"invocationCount": 0,
"quality": "string",
"personality": "string",
"brandVoiceId": "string",
"targetAudienceId": "string",
"additionalContext": []
}'
import requests
response = requests.post(
f"https://app.neuroflash.com/api/v1/workspaces/{workspace_id}/prompt-template-runs",
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
json={
"promptTemplateId": "string",
"parameters": {},
"tonality": [],
"length": "string",
"sampleCount": 0,
"invocationCount": 0,
"quality": "string",
"personality": "string",
"brandVoiceId": "string",
"targetAudienceId": "string",
"additionalContext": []
},
).json()
const response = await fetch(
`https://app.neuroflash.com/api/v1/workspaces/${workspaceId}/prompt-template-runs`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"promptTemplateId": "string",
"parameters": {},
"tonality": [],
"length": "string",
"sampleCount": 0,
"invocationCount": 0,
"quality": "string",
"personality": "string",
"brandVoiceId": "string",
"targetAudienceId": "string",
"additionalContext": []
}),
}
).then((r) => r.json());
body, _ := json.Marshal(map[string]any{
"promptTemplateId": "string",
"parameters": map[string]any{},
"tonality": []any{},
"length": "string",
"sampleCount": 0,
"invocationCount": 0,
"quality": "string",
"personality": "string",
"brandVoiceId": "string",
"targetAudienceId": "string",
"additionalContext": []any{},
})
req, _ := http.NewRequest("POST", "https://app.neuroflash.com/api/v1/workspaces/"+workspaceID+"/prompt-template-runs", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+token)
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
Response:
{
"outputs": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"text": "Innovate today, lead tomorrow — see what's new."
}
]
}