Prompt management reference
Method signatures, parameters, responses and examples for prompt management.
Use a configured server-side nirmos client from the quickstart. See the prompt management guide for prerequisites and workflows. Example IDs and configured model names are placeholders; replace them with organization-visible resources before executing. Mutating calls change live resources.
HTTP calls reject with APIError subclasses on unsuccessful HTTP responses and may throw NetworkError, TimeoutError or RequestAbortedError. Signatures describe SDK values after response decoding; they are not raw HTTP envelopes. Backend validation, permissions and feature availability remain authoritative.
Some responses use broad recursive domain DTOs. This page omits their unrelated optional fields and provides endpoint-specific views where verified. Optional permits absence; nullable permits explicit null. Validate IDs before reuse. Tightening exported schemas is separate implementation work.
| Method | Transport |
|---|---|
prompts.list | Control plane |
prompts.get | Control plane |
prompts.create | Control plane |
prompts.update | Control plane |
prompts.duplicate | Control plane |
prompts.archive | Control plane |
prompts.restore | Control plane |
prompts.delete | Control plane |
prompts.versions.summaries | Control plane |
prompts.versions.list | Control plane |
prompts.versions.get | Control plane |
prompts.versions.create | Control plane |
prompts.versions.publish | Control plane |
prompts.branches.list | Control plane |
prompts.branches.create | Control plane |
prompts.branches.merge | Control plane |
prompts.branches.delete | Control plane |
prompts.preview | Control plane |
prompts.compile | Control plane |
prompts.test | Runtime |
prompts.list
List Prompts
Control plane: GET /v1/prompts.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:read.
REST endpoint, security and schemas · Related guide
Types: Queries · RequestOptions · Responses
nirmos.prompts.list(
query?: Queries["listPrompts"] /* default: {} */,
options?: RequestOptions | undefined
): Promise<Responses["listPrompts"]>| Parameter | Required | Type / default |
|---|---|---|
query | No | Queries["listPrompts"]; default {} |
options | No | RequestOptions | undefined |
Query fields
| Field | Required | Type |
|---|---|---|
limit | No | number | undefined |
cursor | No | string | undefined |
search | No | string | undefined |
status | No | "draft" | "archived" | "published" | "all" | undefined |
sort | No | "updated" | "newest" | "oldest" | "name" | undefined |
Returns: Responses["listPrompts"].
Example
const result = await nirmos.prompts.list({});prompts.get
Get Prompt
Control plane: GET /v1/prompts/:id.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:read.
REST endpoint, security and schemas · Related guide
Types: Queries · RequestOptions · Responses
nirmos.prompts.get(
id: string,
query?: Queries["getPrompt"] /* default: {} */,
options?: RequestOptions | undefined
): Promise<Responses["getPrompt"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
query | No | Queries["getPrompt"]; default {} |
options | No | RequestOptions | undefined |
Query fields
| Field | Required | Type |
|---|---|---|
branchSlug | No | string | undefined |
Returns: Responses["getPrompt"].
Prompt detail response
The service returns one editor prompt. The generated SDK declaration is a broad recursive DTO and marks many fields optional. This documentation projection describes the current service response; it is not an exported SDK type. Check nullable versions before reading messages.
type PromptDetailView = {
id: string; name: string; slug: string; status: string;
description: string | null;
latestVersionId: string | null; // Global live pointer; null before first publication.
defaultBranch: { id: string; name: string; slug: string } | null;
selectedBranch: BranchView | null;
branches: BranchView[];
versions: Array<{ id: string; version: number; status: string;
commitMessage: string | null; createdAt: string;
branch: { id: string; name: string; slug: string } | null }>;
editableVersion: EditorVersionView | null;
latestVersion: { id: string; version: number; status: string } | null; // Global live version.
variables: unknown[]; createdAt: string; updatedAt: string;
};
type BranchView = {
id: string; name: string; slug: string; isDefault: boolean;
description: string | null; sourceVersionId: string | null; headVersionId: string | null;
headVersion: { id: string; version: number; status: string } | null;
createdAt: string; updatedAt: string;
};
type EditorVersionView = {
id: string; version: number; status: string; commitMessage: string | null;
metadata: Record<string, unknown> | null; variables: unknown[];
messages: Array<{ id: string; order: number; role: string; name: string | null;
contentBlocks: Array<{ id: string; order: number; type: string; text: string | null;
uri: string | null; mimeType: string | null; data: unknown;
metadata: Record<string, unknown> | null }> }>;
};A compact projection from a prompt before its first saved version is:
{ "id": "prompt_example", "name": "Support", "slug": "support", "status": "draft",
"description": null, "latestVersionId": null, "editableVersion": null,
"latestVersion": null, "versions": [], "variables": [] }Other branch/date fields are omitted from this projection for readability. A
non-null editableVersion can be newer than the live latestVersionId.
Use managed retrieval for active content.
Example
const result = await nirmos.prompts.get("resource-id", {});prompts.create
Create Prompt
Control plane: POST /v1/prompts.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:create.
REST endpoint, security and schemas · Related guide
Types: Requests · RequestOptions · Responses
nirmos.prompts.create(
body: Requests["createPrompt"],
options?: RequestOptions | undefined
): Promise<Responses["createPrompt"]>| Parameter | Required | Type / default |
|---|---|---|
body | Yes | Requests["createPrompt"] |
options | No | RequestOptions | undefined |
Request fields
| Field | Required | Type |
|---|---|---|
name | Yes | string |
slug | Yes | string |
description | No | string | undefined |
Returns: Responses["createPrompt"].
Example
const result = await nirmos.prompts.create({
"name": "Support",
"slug": "support"
});prompts.update
Update Prompt
Control plane: PATCH /v1/prompts/:id.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:update.
REST endpoint, security and schemas · Related guide
Types: Requests · RequestOptions · Responses
nirmos.prompts.update(
id: string,
body: Requests["updatePrompt"],
options?: RequestOptions | undefined
): Promise<Responses["updatePrompt"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
body | Yes | Requests["updatePrompt"] |
options | No | RequestOptions | undefined |
Request fields
| Field | Required | Type |
|---|---|---|
name | Yes | string |
slug | Yes | string |
description | No | string | undefined |
Returns: Responses["updatePrompt"].
Example
const result = await nirmos.prompts.update("resource-id", {
"name": "Support",
"slug": "support"
});prompts.duplicate
Duplicate Prompt Action
Control plane: POST /v1/prompts/:id/duplicate.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:create.
REST endpoint, security and schemas · Related guide
Types: RequestOptions · Responses
nirmos.prompts.duplicate(
id: string,
options?: RequestOptions | undefined
): Promise<Responses["duplicatePromptAction"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
options | No | RequestOptions | undefined |
Returns: Responses["duplicatePromptAction"].
Use the linked feature workflow for this response. Unrelated optional fields in the broad SDK declaration are not endpoint guarantees.
Example
const result = await nirmos.prompts.duplicate("resource-id");prompts.archive
Archive Prompt Action
Control plane: POST /v1/prompts/:id/archive.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:update.
REST endpoint, security and schemas · Related guide
Types: RequestOptions · Responses
nirmos.prompts.archive(
id: string,
options?: RequestOptions | undefined
): Promise<Responses["archivePromptAction"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
options | No | RequestOptions | undefined |
Returns: Responses["archivePromptAction"].
Use the linked feature workflow for this response. Unrelated optional fields in the broad SDK declaration are not endpoint guarantees.
Example
const result = await nirmos.prompts.archive("resource-id");prompts.restore
Unarchive Prompt Action
Control plane: POST /v1/prompts/:id/restore.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:update.
REST endpoint, security and schemas · Related guide
Types: RequestOptions · Responses
nirmos.prompts.restore(
id: string,
options?: RequestOptions | undefined
): Promise<Responses["unarchivePromptAction"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
options | No | RequestOptions | undefined |
Returns: Responses["unarchivePromptAction"].
Use the linked feature workflow for this response. Unrelated optional fields in the broad SDK declaration are not endpoint guarantees.
Example
const result = await nirmos.prompts.restore("resource-id");prompts.delete
Delete Prompt Action
Control plane: DELETE /v1/prompts/:id.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:delete.
REST endpoint, security and schemas · Related guide
Types: RequestOptions · Responses
nirmos.prompts.delete(
id: string,
options?: RequestOptions | undefined
): Promise<Responses["deletePromptAction"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
options | No | RequestOptions | undefined |
Returns: Responses["deletePromptAction"].
Use the linked feature workflow for this response. Unrelated optional fields in the broad SDK declaration are not endpoint guarantees.
Example
const result = await nirmos.prompts.delete("resource-id");prompts.versions.summaries
List Prompt Version Summaries
Control plane: GET /v1/prompts/:id/version-summaries.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:read.
REST endpoint, security and schemas · Related guide
Types: Queries · RequestOptions · Responses
nirmos.prompts.versions.summaries(
id: string,
query?: Queries["listPromptVersionSummaries"] /* default: {} */,
options?: RequestOptions | undefined
): Promise<Responses["listPromptVersionSummaries"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
query | No | Queries["listPromptVersionSummaries"]; default {} |
options | No | RequestOptions | undefined |
Query fields
| Field | Required | Type |
|---|---|---|
limit | No | number | undefined |
cursor | No | string | undefined |
branchId | No | string | undefined |
Returns: Responses["listPromptVersionSummaries"].
Example
const result = await nirmos.prompts.versions.summaries("resource-id", {});prompts.versions.list
List Prompt Versions
Control plane: GET /v1/prompts/:id/versions.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:read.
REST endpoint, security and schemas · Related guide
Types: Queries · RequestOptions · Responses
nirmos.prompts.versions.list(
id: string,
query?: Queries["listPromptVersions"] /* default: {} */,
options?: RequestOptions | undefined
): Promise<Responses["listPromptVersions"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
query | No | Queries["listPromptVersions"]; default {} |
options | No | RequestOptions | undefined |
Query fields
| Field | Required | Type |
|---|---|---|
limit | No | number | undefined |
cursor | No | string | undefined |
branchId | No | string | undefined |
Returns: Responses["listPromptVersions"].
Response field table (same declared fields).
Example
const result = await nirmos.prompts.versions.list("resource-id", {});prompts.versions.get
Get Prompt Version
Control plane: GET /v1/prompt-versions/:id.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:read.
REST endpoint, security and schemas · Related guide
Types: RequestOptions · Responses
nirmos.prompts.versions.get(
id: string,
options?: RequestOptions | undefined
): Promise<Responses["getPromptVersion"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
options | No | RequestOptions | undefined |
Returns: Responses["getPromptVersion"].
Use the linked feature workflow for this response. Unrelated optional fields in the broad SDK declaration are not endpoint guarantees.
Example
const result = await nirmos.prompts.versions.get("resource-id");prompts.versions.create
Create Prompt Version
Control plane: POST /v1/prompts/:id/versions.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:create.
REST endpoint, security and schemas · Related guide
Types: Requests · RequestOptions · Responses
nirmos.prompts.versions.create(
id: string,
body: Requests["createPromptVersion"],
options?: RequestOptions | undefined
): Promise<Responses["createPromptVersion"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
body | Yes | Requests["createPromptVersion"] |
options | No | RequestOptions | undefined |
Request fields
| Field | Required | Type |
|---|---|---|
branchId | Yes | string |
parentVersionId | No | string | undefined |
commitMessage | Yes | string |
metadata | No | { [key: string]: unknown; } | undefined |
provider | No | string | undefined |
model | No | string | undefined |
temperature | Yes | number |
maxTokens | Yes | number |
topP | Yes | number |
messages | Yes | Requests["createPromptVersion"]["messages"] |
structuredOutput | No | Requests["createPromptVersion"]["structuredOutput"] |
Returns: Responses["createPromptVersion"].
Use the linked feature workflow for this response. Unrelated optional fields in the broad SDK declaration are not endpoint guarantees.
Example
const result = await nirmos.prompts.versions.create("resource-id", {
"branchId": "branch-id",
"commitMessage": "Update support instructions",
"temperature": 1,
"maxTokens": 300,
"topP": 1,
"messages": [
{
"order": 1,
"role": "system",
"contentBlocks": [
{
"order": 1,
"type": "text"
}
]
}
]
});prompts.versions.publish
Publish Prompt Version
Control plane: POST /v1/prompts/:id/versions/:versionId/publish.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:publish.
REST endpoint, security and schemas · Related guide
Types: RequestOptions · Responses
nirmos.prompts.versions.publish(
id: string,
versionId: string,
options?: RequestOptions | undefined
): Promise<Responses["publishPromptVersion"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
versionId | Yes | string |
options | No | RequestOptions | undefined |
Returns: Responses["publishPromptVersion"].
Use the linked feature workflow for this response. Unrelated optional fields in the broad SDK declaration are not endpoint guarantees.
Behavior: Accepts an eligible draft or previously published immutable version ID. Default-branch publication updates live without rewinding saved heads; republishing the active version is a no-op. Missing versions return 404; archived states and concurrent release conflicts return 409. Management publication does not invalidate a separate managed-prompt client cache: reload or wait for expiry. Runtime activate uses a numeric version through the same release transition.
Example
const result = await nirmos.prompts.versions.publish("resource-id", "version-id");prompts.branches.list
List Prompt Branches
Control plane: GET /v1/prompts/:id/branches.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:read.
REST endpoint, security and schemas · Related guide
Types: Queries · RequestOptions · Responses
nirmos.prompts.branches.list(
id: string,
query?: Queries["listPromptBranches"] /* default: {} */,
options?: RequestOptions | undefined
): Promise<Responses["listPromptBranches"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
query | No | Queries["listPromptBranches"]; default {} |
options | No | RequestOptions | undefined |
Query fields
| Field | Required | Type |
|---|---|---|
limit | No | number | undefined |
cursor | No | string | undefined |
Returns: Responses["listPromptBranches"].
Response field table (same declared fields).
Example
const result = await nirmos.prompts.branches.list("resource-id", {});prompts.branches.create
Create Prompt Branch
Control plane: POST /v1/prompts/:id/branches.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:create.
REST endpoint, security and schemas · Related guide
Types: Requests · RequestOptions · Responses
nirmos.prompts.branches.create(
id: string,
body: Requests["createPromptBranch"],
options?: RequestOptions | undefined
): Promise<Responses["createPromptBranch"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
body | Yes | Requests["createPromptBranch"] |
options | No | RequestOptions | undefined |
Request fields
| Field | Required | Type |
|---|---|---|
name | Yes | string |
slug | Yes | string |
description | No | string | undefined |
sourceVersionId | No | string | undefined |
Returns: Responses["createPromptBranch"].
Use the linked feature workflow for this response. Unrelated optional fields in the broad SDK declaration are not endpoint guarantees.
Example
const result = await nirmos.prompts.branches.create("resource-id", {
"name": "Support",
"slug": "support"
});prompts.branches.merge
Merge Prompt Branches
Control plane: POST /v1/prompts/:id/branches/merge.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:update.
REST endpoint, security and schemas · Related guide
Types: Requests · RequestOptions · Responses
nirmos.prompts.branches.merge(
id: string,
body: Requests["mergePromptBranches"],
options?: RequestOptions | undefined
): Promise<Responses["mergePromptBranches"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
body | Yes | Requests["mergePromptBranches"] |
options | No | RequestOptions | undefined |
Request fields
| Field | Required | Type |
|---|---|---|
sourceBranchId | Yes | string |
expectedSourceVersionId | No | string | undefined |
expectedTargetVersionId | No | string | undefined |
targetBranchId | Yes | string |
commitMessage | Yes | string |
Returns: Responses["mergePromptBranches"].
Use the linked feature workflow for this response. Unrelated optional fields in the broad SDK declaration are not endpoint guarantees.
Example
const result = await nirmos.prompts.branches.merge("resource-id", {
"sourceBranchId": "source-branch-id",
"targetBranchId": "target-branch-id",
"commitMessage": "Update support instructions"
});prompts.branches.delete
Delete Prompt Branch
Control plane: DELETE /v1/prompts/:id/branches/:branchId.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:delete.
REST endpoint, security and schemas · Related guide
Types: RequestOptions · Responses
nirmos.prompts.branches.delete(
id: string,
branchId: string,
options?: RequestOptions | undefined
): Promise<Responses["deletePromptBranch"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
branchId | Yes | string |
options | No | RequestOptions | undefined |
Returns: Responses["deletePromptBranch"].
Use the linked feature workflow for this response. Unrelated optional fields in the broad SDK declaration are not endpoint guarantees.
Example
const result = await nirmos.prompts.branches.delete("resource-id", "branch-id");prompts.preview
Simulate Prompt Preview
Control plane: POST /v1/prompts/:id/preview.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:preview.
REST endpoint, security and schemas · Related guide
Types: Requests · RequestOptions · Responses
nirmos.prompts.preview(
id: string,
body: Requests["simulatePromptPreview"],
options?: RequestOptions | undefined
): Promise<Responses["simulatePromptPreview"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
body | Yes | Requests["simulatePromptPreview"] |
options | No | RequestOptions | undefined |
Request fields
| Field | Required | Type |
|---|---|---|
systemPrompt | Yes | string |
userPrompt | Yes | string |
variablesJson | Yes | string |
modelSettingsJson | Yes | string |
structuredOutputJson | No | string | undefined |
Returns: Responses["simulatePromptPreview"].
Behavior: Mocked simulation only: no external model call. variablesJson is a JSON-encoded array of { name, value } (type may be included but is ignored); modelSettingsJson encodes model, optional provider, temperature, maxTokens and topP. Success uses preview.status=success; application failures use preview.success=false. Validate both variants; see the prompt management guide. prompts.test executes real inference.
Example
import { APIError } from "@nirmos/sdk";
function previewObject(value: unknown): Record<string, unknown> {
return value !== null && typeof value === "object" && !Array.isArray(value)
? value as Record<string, unknown> : {};
}
try {
const result = await nirmos.prompts.preview("prompt-id", {
systemPrompt: "Help {{customerName}}.", userPrompt: "Write a greeting.",
variablesJson: JSON.stringify([{ name: "customerName", type: "string", value: "Asha" }]),
modelSettingsJson: JSON.stringify({ model: "configured/chat-model", temperature: 0.2, maxTokens: 100, topP: 1 }),
});
const preview = previewObject(previewObject(result).preview);
if (preview.success === false) {
throw new Error(typeof preview.error === "string" ? preview.error : "Preview application failure");
}
if (preview.status !== "success") throw new Error("Unexpected preview response");
const response = previewObject(preview.response);
console.log(response.content); // Mocked content, not a provider response.
} catch (error) {
if (error instanceof APIError) {
console.error({ status: error.status, code: error.code, requestId: error.requestId });
}
throw error; // Includes application failures and network/local failures.
}prompts.compile
Compile Prompt Preview
Control plane: POST /v1/prompts/:id/compile.
Credentials: Personal or service API key with the required grants.
Required permission: prompt:preview.
REST endpoint, security and schemas · Related guide
Types: Requests · RequestOptions · Responses
nirmos.prompts.compile(
id: string,
body: Requests["compilePromptPreview"],
options?: RequestOptions | undefined
): Promise<Responses["compilePromptPreview"]>| Parameter | Required | Type / default |
|---|---|---|
id | Yes | string |
body | Yes | Requests["compilePromptPreview"] |
options | No | RequestOptions | undefined |
Request fields
| Field | Required | Type |
|---|---|---|
messages | Yes | Requests["compilePromptPreview"]["messages"] |
variables | No | Requests["compilePromptPreview"]["variables"] |
Returns: Responses["compilePromptPreview"].
Example
const result = await nirmos.prompts.compile("resource-id", {
"messages": [
{
"role": "system",
"contentBlocks": [
{
"order": 1,
"type": "text"
}
]
}
]
});prompts.test
Execute a playground prompt with content blocks and optional variables.
Runtime: POST /v1/test/prompt.
Credentials: Personal or service API key with the required grants.
Types: PromptTestRequest · RequestOptions · PromptTestResponse
nirmos.prompts.test(
body: PromptTestRequest,
options?: RequestOptions | undefined
): Promise<PromptTestResponse>| Parameter | Required | Type / default |
|---|---|---|
body | Yes | PromptTestRequest |
options | No | RequestOptions | undefined |
Request fields
| Field | Required | Type |
|---|---|---|
privacy | No | { inputLogging?: false | undefined; outputLogging?: false | undefined; cache?: false | undefined; history?: false | undefined; } | undefined |
messages | Yes | PromptTestRequest["messages"] |
selectedModel | No | string | undefined |
temperature | No | number | undefined |
maxTokens | No | number | undefined |
topP | No | number | undefined |
variables | No | string[] | undefined |
variablesInput | No | Record<string, unknown> | undefined |
provider | No | string | undefined |
structuredOutput | No | unknown |
Returns: PromptTestResponse.
Example
const result = await nirmos.prompts.test({
"selectedModel": "configured/chat-model",
"messages": [
{
"role": "user",
"contentBlocks": [
{
"type": "text",
"text": "Hello"
}
]
}
]
});