Platform

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.

Why PromptHub?
Instead of hard-coding system prompts in your application, store them in PromptHub and attach them to proxy keys. This lets you update prompt behavior instantly without redeploying code, A/B test different prompts, and enforce consistent AI behavior across your team.

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.

POST/v1/prompt-hub/prompts
GET/v1/prompt-hub/prompts
GET/v1/prompt-hub/prompts/:id
PATCH/v1/prompt-hub/prompts/:id
DELETE/v1/prompt-hub/prompts/:id
GET/v1/prompt-hub/prompts/:id/versions
POST/v1/prompt-hub/prompts/:id/versions/:v/restore
DELETE/v1/prompt-hub/prompts/:id/versions/:v
PUT/v1/prompt-hub/prompts/:id/teams
POST/v1/proxy-keys/:key/prompt-hub
GET/v1/proxy-keys/:key/prompt-hub
DELETE/v1/proxy-keys/:key/prompt-hub/:id
GET/v1/user/agents/:key_id/prompts
POST/v1/user/agents/:key_id/prompts
DELETE/v1/user/agents/:key_id/prompts/:id

Create a Prompt

POST/v1/prompt-hub/prompts

Body Parameters

namestringrequired

Display name for the prompt

contentstringrequired

The prompt text. Supports template variables like {{language}}

descriptionstring

A short description of what the prompt does

categorystring

Category for organization

Options: general, coding, writing, analysis, customer-support, other

tagsstring[]

Tags for filtering and search

modelstring

Recommended model for this prompt (e.g. gpt-4o)

temperaturenumber

Recommended temperature (0.0 - 2.0)

201

Returns the created prompt object with id, created_at, and all fields.

cURL
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
  }'
TypeScript SDK
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);
Python SDK
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']}")
CLI
# 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.txt

List Prompts

GET/v1/prompt-hub/prompts

Returns all prompts belonging to the authenticated user. The response includes a paginated list with total count.

200
Response
{
  "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
curl https://api.metriqual.com/v1/prompt-hub/prompts \
  -H "Authorization: Bearer YOUR_JWT"
TypeScript SDK
const prompts = await mql.promptHub.list();

for (const p of prompts) {
  console.log(`${p.name} (${p.id}) — v${p.active_version}, ${p.visibility}`);
}
Python SDK
prompts = client.prompt_hub.list()

for p in prompts["prompts"]:
    print(f"{p['name']} ({p['id']}) — v{p['active_version']}, {p['visibility']}")
CLI
# List all prompts
mql prompts list

# Search prompts
mql prompts list --search "code review"

# Output as JSON for scripting
mql prompts list --json

Get a Prompt

GET/v1/prompt-hub/prompts/:prompt_id

Retrieve full details of a single prompt including its content, metadata, tags, and visibility.

cURL
curl https://api.metriqual.com/v1/prompt-hub/prompts/PROMPT_ID \
  -H "Authorization: Bearer YOUR_JWT"
TypeScript SDK
const prompt = await mql.promptHub.get('a1b2c3d4-...');
console.log(prompt.name);
console.log(prompt.content);
Python SDK
prompt = client.prompt_hub.get("a1b2c3d4-...")
print(prompt["name"])
print(prompt["content"])
CLI
# 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 --json

Update a Prompt

PATCH/v1/prompt-hub/prompts/:prompt_id

Body Parameters (all optional)

namestring

New display name

contentstring

New prompt content

descriptionstring

New description

categorystring

New category

tagsstring[]

Replace tags

modelstring

Recommended model

temperaturenumber

Recommended temperature

Only include the fields you want to change. Omitted fields remain unchanged.

cURL
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
  }'
TypeScript SDK
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);
Python SDK
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']}")
CLI
# 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

DELETE/v1/prompt-hub/prompts/:prompt_id

Permanently delete a prompt. This also detaches it from any proxy keys it was attached to. This action cannot be undone.

cURL
curl -X DELETE https://api.metriqual.com/v1/prompt-hub/prompts/PROMPT_ID \
  -H "Authorization: Bearer YOUR_JWT"
TypeScript SDK
await mql.promptHub.delete('PROMPT_ID');
Python SDK
client.prompt_hub.delete("PROMPT_ID")
CLI
# With confirmation prompt
mql prompts delete PROMPT_ID

# Skip confirmation
mql prompts delete PROMPT_ID --yes

Visibility

PUT/v1/prompt-hub/prompts/:prompt_id/teams

A 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 — scope to two teams
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"]}'
TypeScript SDK
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' });
Python SDK
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

POST/v1/proxy-keys/:proxy_key/prompt-hub

Body Parameters

prompt_idstringrequired

The ID of the prompt to attach

How prompt injection works
When a prompt is attached to a proxy key, every chat completion request made through that key will automatically have the prompt content injected as a system message. This happens server-side — your client code doesn't need to change at all.
cURL
# 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-..."}'
TypeScript SDK
// 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
Python SDK
# 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-side

List Prompts on a Key

GET/v1/proxy-keys/:proxy_key/prompt-hub

List all prompts currently attached to a proxy key. Useful for auditing which system prompts are active on a given key.

cURL
curl https://api.metriqual.com/v1/proxy-keys/mql_abc123/prompt-hub \
  -H "Authorization: Bearer YOUR_JWT"
TypeScript SDK
const keyPrompts = await mql.promptHub.listKeyPrompts('mql_abc123');

for (const p of keyPrompts) {
  console.log(`Attached: ${p.name} (${p.id})`);
}
Python SDK
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

DELETE/v1/proxy-keys/:proxy_key/prompt-hub/:prompt_id

Remove a prompt from a proxy key. Requests through the key will no longer include this system prompt.

cURL
curl -X DELETE https://api.metriqual.com/v1/proxy-keys/mql_abc123/prompt-hub/PROMPT_ID \
  -H "Authorization: Bearer YOUR_JWT"
TypeScript SDK
await mql.promptHub.detachFromKey('PROMPT_ID', 'mql_abc123');
Python SDK
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.

TypeScript
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 requests

SDK 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)Dict

Create a new prompt

list()List[Dict]

List all your prompts

get(prompt_id)Dict

Get a prompt by ID

update(prompt_id, **data)Dict

Update a prompt

delete(prompt_id)Dict

Delete a prompt

set_teams(prompt_id, team_ids)Dict

Replace the teams a prompt is scoped to

versions(prompt_id)List[Dict]

List every version, active one marked

activate(prompt_id, version)Dict

Make a version active

attach_to_key(prompt_id, proxy_key)Dict

Attach prompt to a proxy key

detach_from_key(prompt_id, proxy_key)Dict

Detach 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, --json

List your prompts

mql prompts get <id>--json, --content

Get prompt details or content

mql prompts create--name, --content, --file, --category, --tags

Create a prompt (interactive or flags)

mql prompts update <id>--name, --content, --file, --category, --tags

Update a prompt

mql prompts delete <id>--yes

Delete a prompt

mql prompts teams <id>--set, --clear

Scope a prompt to teams, or back to the org

mql prompts activate <id>--version

Make a version active

mql prompts share <id>--permission, --expires

Generate a share link

Prompt Object Schema

PromptHubPrompt

idstring (UUID)

Unique identifier

user_idstring

Owner user ID

org_idstring | null

Organization ID if org-scoped

namestring

Display name

descriptionstring | null

Description

contentstring

The prompt text content

categorystring

Category (general, coding, writing, analysis, customer-support, other)

tagsstring[] | null

Tags for categorization

modelstring | null

Recommended model

temperaturenumber | null

Recommended temperature

visibilitystring

org (everyone in the organization) or team

Options: org, team

team_idsstring[]

Teams the prompt is scoped to when visibility is team

versionnumber

The version currently served

active_versionnumber

The version the prompt points at

can_editboolean

Whether the caller may edit, delete or re-scope this prompt

attached_agentsobject[]

Agents serving this prompt: key_id, name, key_preview, enabled

star_countnumber

Number of stars (likes)

fork_countnumber

Number of forks

forked_fromstring | null

ID of the original prompt if forked

created_atstring (ISO 8601)

Creation timestamp

updated_atstring (ISO 8601)

Last update timestamp