PromptHub
Create, version, and manage reusable prompts. Attach prompts to proxy keys so every request through that key automatically includes your system prompt — no client-side changes needed.
Available Operations
PromptHub provides a full prompt lifecycle — create, read, update, delete, version, scope to your organization or a team, and attach prompts to proxy keys for automatic injection.
/v1/prompt-hub/prompts/v1/prompt-hub/prompts/v1/prompt-hub/prompts/:id/v1/prompt-hub/prompts/:id/v1/prompt-hub/prompts/:id/v1/prompt-hub/prompts/:id/versions/v1/prompt-hub/prompts/:id/versions/:v/restore/v1/prompt-hub/prompts/:id/versions/:v/v1/prompt-hub/prompts/:id/teams/v1/proxy-keys/:key/prompt-hub/v1/proxy-keys/:key/prompt-hub/v1/proxy-keys/:key/prompt-hub/:id/v1/user/agents/:key_id/prompts/v1/user/agents/:key_id/prompts/v1/user/agents/:key_id/prompts/:idCreate a Prompt
/v1/prompt-hub/promptsBody Parameters
namestringrequiredDisplay name for the prompt
contentstringrequiredThe prompt text. Supports template variables like {{language}}
descriptionstringA short description of what the prompt does
categorystringCategory for organization
Options: general, coding, writing, analysis, customer-support, other
tagsstring[]Tags for filtering and search
modelstringRecommended model for this prompt (e.g. gpt-4o)
temperaturenumberRecommended temperature (0.0 - 2.0)
Returns the created prompt object with id, created_at, and all fields.
curl -X POST https:
-H "Authorization: Bearer YOUR_JWT" \
-H "Content-Type: application/json" \
-d '{
"name": "Code Reviewer",
"content": "You are an expert code reviewer. Analyze the following code for bugs, security vulnerabilities, performance issues, and style. Provide actionable feedback with severity levels.",
"description": "Reviews code and provides structured feedback",
"category": "coding",
"tags": ["code-review", "security", "best-practices"],
"model": "gpt-4o",
"temperature": 0.3
}'import Metriqual from '@metriqual/sdk';
const mql = new Metriqual({ apiKey: process.env.MQL_API_KEY! });
const prompt = await mql.promptHub.create({
name: 'Code Reviewer',
content: 'You are an expert code reviewer. Analyze the following code for bugs, security vulnerabilities, performance issues, and style. Provide actionable feedback with severity levels.',
description: 'Reviews code and provides structured feedback',
category: 'coding',
tags: ['code-review', 'security', 'best-practices'],
model: 'gpt-4o',
temperature: 0.3,
});
console.log('Created:', prompt.id, prompt.name);from metriqual import MQL
client = MQL(api_key="mql_...")
prompt = client.prompt_hub.create(
name="Code Reviewer",
content="You are an expert code reviewer. Analyze the following code for bugs, security vulnerabilities, performance issues, and style. Provide actionable feedback with severity levels.",
description="Reviews code and provides structured feedback",
category="coding",
tags=["code-review", "security", "best-practices"],
model="gpt-4o",
temperature=0.3,
)
print(f"Created: {prompt['id']} — {prompt['name']}")# Interactive mode (opens editor for content)
mql prompts create
# One-liner
mql prompts create \
--name "Code Reviewer" \
--content "You are an expert code reviewer..." \
--category coding \
--tags "code-review,security"
# From a file
mql prompts create \
--name "Code Reviewer" \
--file ./prompts/code-reviewer.txtList Prompts
/v1/prompt-hub/promptsReturns all prompts belonging to the authenticated user. The response includes a paginated list with total count.
{
"prompts": [
{
"id": "a1b2c3d4-...",
"name": "Code Reviewer",
"description": "Reviews code and provides structured feedback",
"content": "You are an expert code reviewer...",
"category": "coding",
"tags": ["code-review", "security"],
"model": "gpt-4o",
"temperature": 0.3,
"visibility": "org",
"team_ids": [],
"version": 3,
"active_version": 3,
"can_edit": true,
"star_count": 0,
"fork_count": 0,
"created_at": "2026-03-09T10:00:00Z",
"updated_at": "2026-03-09T10:00:00Z"
}
],
"total": 1,
"has_more": false
}curl https://api.metriqual.com/v1/prompt-hub/prompts \
-H "Authorization: Bearer YOUR_JWT"const prompts = await mql.promptHub.list();
for (const p of prompts) {
console.log(`${p.name} (${p.id}) — v${p.active_version}, ${p.visibility}`);
}prompts = client.prompt_hub.list()
for p in prompts["prompts"]:
print(f"{p['name']} ({p['id']}) — v{p['active_version']}, {p['visibility']}")# List all prompts
mql prompts list
# Search prompts
mql prompts list --search "code review"
# Output as JSON for scripting
mql prompts list --jsonGet a Prompt
/v1/prompt-hub/prompts/:prompt_idRetrieve full details of a single prompt including its content, metadata, tags, and visibility.
curl https://api.metriqual.com/v1/prompt-hub/prompts/PROMPT_ID \
-H "Authorization: Bearer YOUR_JWT"const prompt = await mql.promptHub.get('a1b2c3d4-...');
console.log(prompt.name);
console.log(prompt.content);prompt = client.prompt_hub.get("a1b2c3d4-...")
print(prompt["name"])
print(prompt["content"])# Full details
mql prompts get PROMPT_ID
# Show only the prompt content (useful for piping)
mql prompts get PROMPT_ID --content
# JSON output
mql prompts get PROMPT_ID --jsonUpdate a Prompt
/v1/prompt-hub/prompts/:prompt_idBody Parameters (all optional)
namestringNew display name
contentstringNew prompt content
descriptionstringNew description
categorystringNew category
tagsstring[]Replace tags
modelstringRecommended model
temperaturenumberRecommended temperature
Only include the fields you want to change. Omitted fields remain unchanged.
curl -X PATCH https://api.metriqual.com/v1/prompt-hub/prompts/PROMPT_ID \
-H "Authorization: Bearer YOUR_JWT" \
-H "Content-Type: application/json" \
-d '{
"content": "You are a senior code reviewer with 15 years of experience. Focus on: 1) Security vulnerabilities, 2) Performance bottlenecks, 3) Code maintainability. Rate each issue as Critical, Warning, or Info.",
"temperature": 0.2
}'const updated = await mql.promptHub.update('PROMPT_ID', {
content: 'You are a senior code reviewer with 15 years of experience...',
temperature: 0.2,
});
console.log('Updated at:', updated.updated_at);updated = client.prompt_hub.update("PROMPT_ID",
content="You are a senior code reviewer with 15 years of experience...",
temperature=0.2,
)
print(f"Updated at: {updated['updated_at']}")# Update specific fields
mql prompts update PROMPT_ID --name "Senior Code Reviewer"
# Update content from file
mql prompts update PROMPT_ID --file ./prompts/v2.txt
# Update multiple fields
mql prompts update PROMPT_ID \
--name "Senior Reviewer" \
--category coding \
--tags "security,performance"Delete a Prompt
/v1/prompt-hub/prompts/:prompt_idPermanently delete a prompt. This also detaches it from any proxy keys it was attached to. This action cannot be undone.
curl -X DELETE https://api.metriqual.com/v1/prompt-hub/prompts/PROMPT_ID \
-H "Authorization: Bearer YOUR_JWT"await mql.promptHub.delete('PROMPT_ID');client.prompt_hub.delete("PROMPT_ID")# With confirmation prompt
mql prompts delete PROMPT_ID
# Skip confirmation
mql prompts delete PROMPT_ID --yesVisibility
/v1/prompt-hub/prompts/:prompt_id/teamsA prompt is visible to your organization or to specific teams inside it. There is no public marketplace and no per-user private scope.
visibility: "org", the default, means every member of the owner’s organization can read the prompt. visibility: "team" narrows it to the teams in team_ids, which must belong to that same organization and cannot be empty.
Editing, deleting and version changes stay with the prompt’s owner and the organization’s owners and admins. Every prompt carries can_edit for the caller.
curl -X PATCH https://api.metriqual.com/v1/prompt-hub/prompts/PROMPT_ID \
-H "Authorization: Bearer YOUR_JWT" \
-H "Content-Type: application/json" \
-d '{"visibility": "team", "team_ids": ["TEAM_A", "TEAM_B"]}'await mql.promptHub.update('PROMPT_ID', {
visibility: 'team',
team_ids: ['TEAM_A'],
});
await mql.promptHub.setTeams('PROMPT_ID', ['TEAM_A', 'TEAM_B']);
await mql.promptHub.update('PROMPT_ID', { visibility: 'org' });client.prompt_hub.update("PROMPT_ID", visibility="team", team_ids=["TEAM_A"])
client.prompt_hub.set_teams("PROMPT_ID", ["TEAM_A", "TEAM_B"])
client.prompt_hub.update("PROMPT_ID", visibility="org")Attach Prompt to Proxy Key
/v1/proxy-keys/:proxy_key/prompt-hubBody Parameters
prompt_idstringrequiredThe ID of the prompt to attach
# Attach a prompt to a proxy key
curl -X POST https://api.metriqual.com/v1/proxy-keys/mql_abc123/prompt-hub \
-H "Authorization: Bearer YOUR_JWT" \
-H "Content-Type: application/json" \
-d '{"prompt_id": "a1b2c3d4-..."}'// Attach prompt to key
await mql.promptHub.attachToKey('PROMPT_ID', 'mql_abc123');
// Now any chat request using this key gets the prompt injected
const mqlWithKey = new Metriqual({ apiKey: 'mql_abc123' });
const res = await mqlWithKey.chat.create({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'Review this code: ...' }]
});
// The system prompt "You are an expert code reviewer..." is
// automatically prepended — no need to include it in messages# Attach prompt to key
client.prompt_hub.attach_to_key("PROMPT_ID", "mql_abc123")
# Now use the key — prompt is injected automatically
keyed = MQL(api_key="mql_abc123")
response = keyed.chat.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Review this code: ..."}]
)
# System prompt is injected server-sideList Prompts on a Key
/v1/proxy-keys/:proxy_key/prompt-hubList all prompts currently attached to a proxy key. Useful for auditing which system prompts are active on a given key.
curl https://api.metriqual.com/v1/proxy-keys/mql_abc123/prompt-hub \
-H "Authorization: Bearer YOUR_JWT"const keyPrompts = await mql.promptHub.listKeyPrompts('mql_abc123');
for (const p of keyPrompts) {
console.log(`Attached: ${p.name} (${p.id})`);
}key_prompts = client.prompt_hub.list_key_prompts("mql_abc123")
for p in key_prompts:
print(f"Attached: {p['name']} ({p['id']})")Detach Prompt from Key
/v1/proxy-keys/:proxy_key/prompt-hub/:prompt_idRemove a prompt from a proxy key. Requests through the key will no longer include this system prompt.
curl -X DELETE https://api.metriqual.com/v1/proxy-keys/mql_abc123/prompt-hub/PROMPT_ID \
-H "Authorization: Bearer YOUR_JWT"await mql.promptHub.detachFromKey('PROMPT_ID', 'mql_abc123');client.prompt_hub.detach_from_key("PROMPT_ID", "mql_abc123")Full Workflow Example
Here's a complete example showing how to create a prompt, attach it to a proxy key, and use it — all via the SDK.
import Metriqual from '@metriqual/sdk';
// 1. Initialize with your JWT (for management operations)
const admin = new Metriqual({
apiKey: process.env.MQL_API_KEY!,
bearerToken: process.env.MQL_JWT!,
});
// 2. Create a system prompt
const prompt = await admin.promptHub.create({
name: 'Customer Support Agent',
content: `You are a helpful customer support agent for Acme Corp.
Rules:
- Always be polite and professional
- Never share internal pricing or roadmap details
- Escalate billing issues to a human agent
- Respond in the customer's language`,
category: 'customer-support',
tags: ['support', 'acme-corp'],
temperature: 0.7,
});
console.log('Created prompt:', prompt.id);
// 3. Attach it to a proxy key
await admin.promptHub.attachToKey(prompt.id, 'mql_support_key');
// 4. Now your support app just sends user messages — the system
// prompt is injected automatically by the proxy
const support = new Metriqual({ apiKey: 'mql_support_key' });
const reply = await support.chat.complete({
model: 'gpt-4o',
messages: [{ role: 'user', content: 'I need help with my invoice' }]
});
// reply already has the customer support personality baked in
// 5. Later, update the prompt without touching the support app
await admin.promptHub.update(prompt.id, {
content: `You are a helpful customer support agent for Acme Corp.
Rules:
- Always be polite and professional
- Never share internal pricing or roadmap details
- Escalate billing issues to a human agent
- Respond in the customer's language
- Always ask for the order number first`,
});
// The change takes effect immediately for all new requestsSDK Method Reference
TypeScript — mql.promptHub
create(data)Promise<PromptHubPrompt>Create a new prompt
list()Promise<PromptHubPrompt[]>List all your prompts
get(id)Promise<PromptHubPrompt>Get a prompt by ID
update(id, data)Promise<PromptHubPrompt>Update a prompt
delete(id)Promise<{ message }>Delete a prompt
setTeams(id, teamIds)Promise<PromptHubPrompt>Replace the teams a prompt is scoped to
versions(id)Promise<PromptVersion[]>List every version, active one marked
activate(id, version)Promise<{ active_version }>Make a version active
attachToKey(promptId, proxyKey)Promise<{ message }>Attach prompt to a proxy key
detachFromKey(promptId, proxyKey)Promise<{ message }>Detach prompt from a proxy key
listKeyPrompts(proxyKey)Promise<PromptHubPrompt[]>List prompts attached to a key
Python — client.prompt_hub
create(**data)DictCreate a new prompt
list()List[Dict]List all your prompts
get(prompt_id)DictGet a prompt by ID
update(prompt_id, **data)DictUpdate a prompt
delete(prompt_id)DictDelete a prompt
set_teams(prompt_id, team_ids)DictReplace the teams a prompt is scoped to
versions(prompt_id)List[Dict]List every version, active one marked
activate(prompt_id, version)DictMake a version active
attach_to_key(prompt_id, proxy_key)DictAttach prompt to a proxy key
detach_from_key(prompt_id, proxy_key)DictDetach prompt from a proxy key
list_key_prompts(proxy_key)List[Dict]List prompts attached to a key
CLI — mql prompts
mql prompts list--limit, --search, --jsonList your prompts
mql prompts get <id>--json, --contentGet prompt details or content
mql prompts create--name, --content, --file, --category, --tagsCreate a prompt (interactive or flags)
mql prompts update <id>--name, --content, --file, --category, --tagsUpdate a prompt
mql prompts delete <id>--yesDelete a prompt
mql prompts teams <id>--set, --clearScope a prompt to teams, or back to the org
mql prompts activate <id>--versionMake a version active
mql prompts share <id>--permission, --expiresGenerate a share link
Prompt Object Schema
PromptHubPrompt
idstring (UUID)Unique identifier
user_idstringOwner user ID
org_idstring | nullOrganization ID if org-scoped
namestringDisplay name
descriptionstring | nullDescription
contentstringThe prompt text content
categorystringCategory (general, coding, writing, analysis, customer-support, other)
tagsstring[] | nullTags for categorization
modelstring | nullRecommended model
temperaturenumber | nullRecommended temperature
visibilitystringorg (everyone in the organization) or team
Options: org, team
team_idsstring[]Teams the prompt is scoped to when visibility is team
versionnumberThe version currently served
active_versionnumberThe version the prompt points at
can_editbooleanWhether the caller may edit, delete or re-scope this prompt
attached_agentsobject[]Agents serving this prompt: key_id, name, key_preview, enabled
star_countnumberNumber of stars (likes)
fork_countnumberNumber of forks
forked_fromstring | nullID of the original prompt if forked
created_atstring (ISO 8601)Creation timestamp
updated_atstring (ISO 8601)Last update timestamp