> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.meshapi.ai/llms.txt.
> For full documentation content, see https://developers.meshapi.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.meshapi.ai/_mcp/server.

# Prompt Templates

> Manage and use prompt templates with the Node.js SDK.

# Prompt Templates

Templates let you define reusable prompts with `{{variable}}` slots.

```ts
// Create a template with your API key
const client = new MeshAPI({
  baseUrl: "https://api.yourdomain.com",
  token: "rsk_...",
});

const template = await client.templates.create({
  name: "support-agent",
  system: "You are a helpful customer support agent for {{company}}. Be concise and friendly.",
  model: "openai/gpt-4o-mini",
  variables: ["company"],
});

console.log("Created template:", template.id);

// Use the template in a chat completion (data-plane key)
const response = await client.chat.completions.create({
  messages: [{ role: "user", content: "How do I reset my password?" }],
  template: "support-agent",         // template name or UUID
  variables: { company: "Acme Corp" },
});

console.log(response.choices[0]?.message.content);
```

## Template CRUD

```ts
// List all templates
const templates = await client.templates.list();

// Get a specific template
const t = await client.templates.get("uuid-here");

// Update a template
const updated = await client.templates.update("uuid-here", {
  system: "You are a concise assistant for {{company}}.",
  model: "openai/gpt-4o",
});

// Delete a template
await client.templates.delete("uuid-here");
```