Prompts
Prompts
@toothfairyai/sdk@latest…Prompt Management Module Handles prompt CRUD operations for AI agent prompts.
Accessed via client.prompts.
Methods
| Method | HTTP | Endpoint |
|---|---|---|
create | POST | POST /prompt/create |
get | GET | GET /prompt/get/{id} |
update | POST | POST /prompt/update |
delete | DELETE | DELETE /prompt/delete/{id} |
list | GET | GET /prompt/list |
getByType | — | derived |
getByAgent | — | derived |
getByScope | — | derived |
search | — | derived |
clone | — | derived |
create
Create a new prompt interpolationString is at least 128 characters.
async create(
label: string,
interpolationString: string,
options: {
scope?: string;
style?: string;
domain?: string;
promptPlaceholder?: string;
availableToAgents?: string[];
} = {}
)
Endpoint: POST /prompt/create · API service
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | no | Unique identifier for the prompt |
workspaceid | string | yes | Your workspace ID (UUID v4). Auto-injected by the SDK client from your configuration; you do not need to set it manually. |
type | string | no | Prompt type classification |
scope | string | no | OAuth scope |
style | string | no | Generation style: default, short, long, funny, informal, formal, interview, academic, business, creative, scientific, poetry, or news |
domain | string | no | Generation domain: editorial, customerService, sales, marketing, hr, finance, legal, medical, science, technology, or default |
label | string | yes | Human-readable display name |
promptLength | integer | yes | Length of the prompt in characters (32-2048) |
promptPlaceholder | string | no | Prompt placeholder text |
interpolationString | string | yes | Prompt interpolation string |
availableToAgents | string | no | List of agent IDs this prompt is available to |
createdBy | string | no | User ID who created the prompt |
updatedBy | string | no | User ID who last updated the prompt |
Response fields
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the prompt |
type | string | Prompt type classification |
scope | string | OAuth scope |
style | string | Generation style: default, short, long, funny, informal, formal, interview, academic, business, creative, scientific, poetry, or news |
domain | string | Generation domain: editorial, customerService, sales, marketing, hr, finance, legal, medical, science, technology, or default |
label | string | Human-readable display name |
promptLength | number | Length of the prompt in characters (32-2048) |
promptPlaceholder | string | Prompt placeholder text |
interpolationString | string | Prompt interpolation string |
availableToAgents | array<string> | List of agent IDs this prompt is available to |
workspaceID | string | Unique workspace identifier (UUID v4) |
createdBy | string | User ID who created the prompt |
updatedBy | string | User ID who last updated the prompt |
createdAt | string | Timestamp when this resource was created |
updatedAt | string | Timestamp when this resource was last updated |
Example
const result = await client.prompts.create('…', '…');
get
Get a prompt by ID
async get(promptId: string)
Endpoint: GET /prompt/get/{id} · API service
Response
Returns the Prompt object — fields documented in the create section above.
Example
const result = await client.prompts.get('agent-id');
update
Update an existing prompt
async update(
promptId: string,
options: {
label?: string;
interpolationString?: string;
scope?: string;
style?: string;
domain?: string;
promptPlaceholder?: string;
availableToAgents?: string[];
} = {}
)
Endpoint: POST /prompt/update · API service
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | Unique identifier for the prompt |
workspaceid | string | no | Your workspace ID (UUID v4). Auto-injected by the SDK client from your configuration; you do not need to set it manually. |
type | string | no | Prompt type classification |
scope | string | no | OAuth scope |
style | string | no | Generation style: default, short, long, funny, informal, formal, interview, academic, business, creative, scientific, poetry, or news |
domain | string | no | Generation domain: editorial, customerService, sales, marketing, hr, finance, legal, medical, science, technology, or default |
label | string | no | Human-readable display name |
promptLength | integer | no | Length of the prompt in characters (32-2048) |
promptPlaceholder | string | no | Prompt placeholder text |
interpolationString | string | no | Prompt interpolation string |
availableToAgents | string | no | List of agent IDs this prompt is available to |
createdBy | string | no | User ID who created the prompt |
updatedBy | string | no | User ID who last updated the prompt |
Response
Returns the Prompt object — fields documented in the create section above.
Example
const result = await client.prompts.update('agent-id');
delete
Delete a prompt
async delete(promptId: string): Promise<
Endpoint: DELETE /prompt/delete/{id} · API service
Response fields
| Field | Type | Description |
|---|---|---|
success | boolean | Operation success status |
data | object | Response data |
message | string | Optional success message |
Example
const result = await client.prompts.delete('agent-id');
list
List prompts in the workspace
async list(promptType?: string, limit?: number, offset?: number)
Endpoint: GET /prompt/list · API service
Example
const result = await client.prompts.list();
getByType
Get prompts by type
async getByType(promptType: string, limit?: number)
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.prompts.getByType('…');
getByAgent
Get prompts available to a specific agent
async getByAgent(agentId: string)
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.prompts.getByAgent('agent-id');
getByScope
Get prompts by scope
async getByScope(scope: string)
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.prompts.getByScope('…');
search
Search prompts by label or content
async search(searchTerm: string, promptType?: string)
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.prompts.search('…');
clone
Clone an existing prompt with modifications
async clone(
promptId: string,
options: {
label?: string;
interpolationString?: string;
scope?: string;
style?: string;
domain?: string;
promptPlaceholder?: string;
availableToAgents?: string[];
} = {}
)
Derived method — delegates to another SDK call and performs no direct HTTP request.
Example
const result = await client.prompts.clone('agent-id');