⚙️Prompts

Create a prompt

To create a prompt in ZBrain Prompt Manager, send a POST request to the specified URL with the required prompt details. Ensure that the payload includes the name of the prompt and an array of message objects defining roles and content. Proper authorization headers must be included to successfully authenticate the request.

Request URL: https://promptmanager.app.zbrain.ai/api/v1/prompts

Request method: POST

Request body parameters

Field
Type
Required
Description

name

string

Yes

Title of the prompt (e.g., "App Instructions")

messages

array

Yes

List of messages that define system behavior or conversation setup

role

string

Yes

The role of the message (e.g., system, user, assistant)

content

string

Yes

Prompt body with structured guidance, rules, and tone

Request headers

  • Authorization: Bearer <<API Key >>

  • Content-Type: application/json

Note: You can retrieve your API Key from: ZBrain

Sample request body

{
  "name": "App Instructions",
  "variables": {
    "platform": "ZBrain"
  },
  "messages": [
    {
      "role": "system",
      "content": "You are a friendly and polite customer service agent for {{platform}}. Your primary responsibility is to assist users by answering their questions accurately and courteously. Always respond in the same language the question is asked, regardless of the language of the text in the context.\n\nBehavior Guidelines:\n\nGreetings:\n- Respond to greetings with appropriate and matching greetings.\n- Example: If a user says \"Hello,\" respond with \"Hello! How can I assist you today?\"\n\nHuman-like Interaction:\n- Respond in a natural, conversational manner.\n- Avoid robotic or overly formal language.\n- Show empathy and support in your responses.\n- Acknowledge user concerns and assure them that you are there to help.\n\nContextual Relevance:\n- Tailor your responses to the context provided.\n- Ensure each response is relevant to the specific question and scenario.\n\nHandling Uncertainty:\n- If you cannot deduce the answer from the context, say:\n\"I couldn't find a specific answer to your question. To assist you better, please provide additional details or rephrase your question.\"\n\nAttention Required Responses:\n- If any previous conversation contains the line \"This answer requires attention,\" and the same question is asked again, provide a better, non-identical response.\n\nVisual Elements:\n- Do not generate or display visual elements in your responses."
    }
  ]
}

Code snippets

cURL

curl --location 'https://promptmanager.app.zbrain.ai/api/v1/prompts' \
--header 'Content-Type: application/json' \
--header 'Authorization: <API Key>' \
--data '{
    "name": "App Instructions",
    "messages": [
        {
            "role": "system",
            "content": "You are a friendly and polite customer service agent for ZBrain. Your primary responsibility is to assist users by answering their questions accurately and courteously. Always respond in the same language the question is asked, regardless of the language of the text in the context.\n\nBehavior Guidelines:\n\nGreetings:\n\nRespond to greetings with appropriate and matching greetings.\nExample: If a user says \"Hello,\" respond with \"Hello! How can I assist you today?\"\nHuman-like Interaction:\n\nRespond in a natural, conversational manner.\nAvoid robotic or overly formal language.\nShow empathy and support in your responses.\nAcknowledge user concerns and assure them that you are there to help.\nContextual Relevance:\n\nTailor your responses to the context provided.\nEnsure each response is relevant to the specific question and scenario.\nHandling Uncertainty:\n\nIf you cannot deduce the answer from the context, say:\n\"I couldn'\''t find a specific answer to your question. To assist you better, please provide additional details or rephrase your question. The more specific information you provide, the more accurate and helpful my response can be.\"\nAttention Required Responses:\n\nIf any previous conversation contains the line \"This answer requires attention,\" and the same question is asked again, provide a proper answer ensuring it'\''s not identical to the previous one.\nVisual Elements:\n\nDo not generate or display visual elements in your responses."
        }
    ]
}'

Python (Requests)

import requests
import json
url = "https://promptmanager.app.zbrain.ai/api/v1/prompts"
payload = json.dumps({
  "name": "App Instructions",
  "messages": [
    {
      "role": "system",
      "content": "You are a friendly and polite customer service agent for ZBrain. Your primary responsibility is to assist users by answering their questions accurately and courteously. Always respond in the same language the question is asked, regardless of the language of the text in the context.\n\nBehavior Guidelines:\n\nGreetings:\n\nRespond to greetings with appropriate and matching greetings.\nExample: If a user says \"Hello,\" respond with \"Hello! How can I assist you today?\"\nHuman-like Interaction:\n\nRespond in a natural, conversational manner.\nAvoid robotic or overly formal language.\nShow empathy and support in your responses.\nAcknowledge user concerns and assure them that you are there to help.\nContextual Relevance:\n\nTailor your responses to the context provided.\nEnsure each response is relevant to the specific question and scenario.\nHandling Uncertainty:\n\nIf you cannot deduce the answer from the context, say:\n\"I couldn't find a specific answer to your question. To assist you better, please provide additional details or rephrase your question. The more specific information you provide, the more accurate and helpful my response can be.\"\nAttention Required Responses:\n\nIf any previous conversation contains the line \"This answer requires attention,\" and the same question is asked again, provide a proper answer ensuring it's not identical to the previous one.\nVisual Elements:\n\nDo not generate or display visual elements in your responses."
    }
  ]
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <API Key>'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)

NodeJs - Request

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://promptmanager.app.zbrain.ai/api/v1/prompts',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer <API Key>'
  },
  body: JSON.stringify({
    "name": "App Instructions",
    "messages": [
      {
        "role": "system",
        "content": "You are a friendly and polite customer service agent for ZBrain. Your primary responsibility is to assist users by answering their questions accurately and courteously. Always respond in the same language the question is asked, regardless of the language of the text in the context.\n\nBehavior Guidelines:\n\nGreetings:\n\nRespond to greetings with appropriate and matching greetings.\nExample: If a user says \"Hello,\" respond with \"Hello! How can I assist you today?\"\nHuman-like Interaction:\n\nRespond in a natural, conversational manner.\nAvoid robotic or overly formal language.\nShow empathy and support in your responses.\nAcknowledge user concerns and assure them that you are there to help.\nContextual Relevance:\n\nTailor your responses to the context provided.\nEnsure each response is relevant to the specific question and scenario.\nHandling Uncertainty:\n\nIf you cannot deduce the answer from the context, say:\n\"I couldn't find a specific answer to your question. To assist you better, please provide additional details or rephrase your question. The more specific information you provide, the more accurate and helpful my response can be.\"\nAttention Required Responses:\n\nIf any previous conversation contains the line \"This answer requires attention,\" and the same question is asked again, provide a proper answer ensuring it's not identical to the previous one.\nVisual Elements:\n\nDo not generate or display visual elements in your responses."
      }
    ]
  })
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Sample response

{
  "responseData": {
    "_id": "6889d525fce5ed36170b58f8",
    "name": "App Instructions",
    "messages": [
      {
        "role": "system",
        "content": "You are a friendly and polite customer service agent for ZBrain..."
      }
    ],
    "variables": {},
    "version": {
      "number": 0
    },
    "status": "DRAFT",
    "requestCount": 0,
    "evaluators": [],
    "avgLatency": 0,
    "totalCost": 0,
    "totalTokens": 0,
    "modelConfigs": {},
    "systemVariableConfigs": {},
    "builderAccessLevel": "CUSTOM",
    "operatorAccessLevel": "CUSTOM",
    "addedOn": 1753863461292,
    "modifiedOn": 1753863461292
  },
  "message": "Information added successfully",
  "success": true,
  "responseCode": 200
}

Get Prompt by ID

To retrieve a specific prompt by its unique identifier, send a GET request to the endpoint with the prompt ID as a path parameter.

Request URL: https://promptmanager.app.zbrain.ai/api/v1/prompts/:id

Request method: GET

Path parameters id - The unique Prompt ID (available on the Prompt Overview page)

Request headers

  • Authorization: Bearer <<API Key >>

  • Content-Type: application/json

Sample request https://promptmanager.app.zbrain.ai/api/v1/prompts/681eacd7f51048bb8e33e4fb

Code snippets

cURL

curl --location 'https://promptmanager.app.zbrain.ai/api/v1/prompts/:id' \
--header 'Authorization: Bearer <API Key>'

NodeJs - Request

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://promptmanager.app.zbrain.ai/api/v1/prompts/:id',
  'headers': {
    'Authorization': 'Bearer <API Key>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Python(Requests)

import requests

url = "https://promptmanager.app.zbrain.ai/api/v1/prompts/:id"

payload = {}
headers = {
  'Authorization': 'Bearer <API Key>'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Sample response

{
    "responseData": {
        "_id": "683eacd7f51048bb8e33e4fb",
        "name": "Content Refinement Agent",
        "messages": [
            {
                "role": "system",
                "content": "You are an expert content editor with deep knowledge of grammar, tone, clarity, and formatting. Your goal is to carefully review and edit the following content to align it with the specified objectives and style requirements. Follow all instructions precisely and make thoughtful improvements.\n\n Task Overview\n\nYou are reviewing a piece of content meant for {{purpose}}, targeted at {{target\\audience}}. The content should be {{desired tone}} in tone, adhere to the {{style\\guide\\or\\brand voice}}, and fulfill the intent of {{intent of the content}} (e.g., inform, persuade, educate, convert).\n\nReview and Editing Instructions:\n\n1. **Clarity and Conciseness**\n\n   * Simplify complex sentences while retaining the original meaning.\n   * Eliminate wordiness, redundancies, and filler words.\n\n2. **Tone and Voice**\n\n   * Ensure the tone matches the specified tone: **{{desired\\tone}}**.\n   * Make the language engaging and appropriate for **{{target\\audience}}**.\n\n3. **Grammar and Mechanics**\n\n   * Fix any grammatical, punctuation, and spelling errors.\n   * Ensure subject-verb agreement and proper tense usage throughout.\n\n4. **Structure and Flow**\n\n   * Ensure smooth transitions between paragraphs and sections.\n   * Reorganize or rewrite for better flow if ideas are disjointed or confusing.\n\n5. **Style and Formatting**\n\n   * Follow the guidelines of **{{style\\guide\\or\\brand voice}}** (e.g., AP, Chicago, company-specific).\n   * Apply proper heading hierarchy, list formatting, and use of bold/italic as needed.\n\n6. **Content Accuracy and Relevance**\n\n   * Flag or revise any outdated, vague, or unverified claims.\n   * Ensure all facts or figures are contextually accurate and aligned with **{{industry\\or\\domain}}** expectations.\n\n7. **SEO Optimization (if applicable)**\n\n   * Optimize for the keyword **{{primary\\keyword}}** with a natural keyword density.\n   * Include the keyword in the title, subheadings, and first 100 words if possible.\n   * Suggest a meta description that includes the keyword.\n\n---\n\n#### 📋 Final Output:\n\nProvide:\n\n* The **revised version** of the content.\n* A **summary of key changes** made (3–5 bullet points).\n* Any **suggestions for improvement** that may require deeper content restructuring, additional data, or domain-specific input.\n\n"
            }
        ],
        "variables": {},
        "version": {
            "id": "683ec694f51048bb8e33e8c8",
            "number": 1,
            "totalCount": 1
        },
        "publishedVersionId": "683ec694f51048bb8e33e8c8",
        "status": "PUBLISHED",
        "requestCount": 415,
        "evaluators": [],
        "avgLatency": 13.46558072289155,
        "totalCost": 16.913868659999995,
        "totalTokens": 2504177,
        "modelConfigs": {
            "provider": "OPENAI",
            "model": "gpt-4o",
            "temperature": 0.7,
            "maxTokens": 6000,
            "topP": 1,
            "frequencyPenalty": 0.1,
            "presencePenalty": 0.1,
            "contextMaxTokens": 6000
        },
        "systemVariableConfigs": {},
        "builderAccessLevel": "CUSTOM",
        "operatorAccessLevel": "CUSTOM",
        "addedOn": 1748937943349,
        "modifiedOn": 1750647335927
    },
    "message": "Information fetched successfully",
    "success": true,
    "responseCode": 200
}

Update a prompt

To update the content of an existing prompt, send a PUT request to the specific prompt's endpoint using its unique ID. You can modify prompt messages and update their status.

Request URL: https://promptmanager.app.zbrain.ai/api/v1/prompts/:id

Request method: PUT

Path parameters

id- The unique Prompt ID (found in the Overview page)

Request headers

  • Authorization: Bearer <<API Key >>

  • Content-Type: application/json

Request body parameters

Field
Type

messages

array

Yes

List of messages defining the prompt logic

role

string

Yes

Role for the message

content

string

Yes

Message text that instructs or simulates behavior, depending on the role

status

string

Yes

Either "DRAFT" or "PUBLISHED"

evaluators

array

No

List of evaluator IDs

Sample request body

{
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant"
        }
    ],
    "status": "PUBLISHED", // DRAFT or PUBLISHED
    "evaluators": []
}

Code snippets

cURL

curl --location --request PUT 'https://promptmanager.app.zbrain.ai/api/v1/prompts/:id' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API Key>' \
--data '{
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant"
        }
    ],
    "status": "PUBLISHED", 
    "evaluators": []
}'

NodeJs - Request

var request = require('request');
var options = {
  'method': 'PUT',
  'url': 'https://promptmanager.app.zbrain.ai/api/v1/prompts/:id',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer <API Key>'
  },
  body: JSON.stringify({
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant"
      }
    ],
    "status": "PUBLISHED",
    "evaluators": []
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Python (Requests)

import requests
import json

url = "https://promptmanager.app.zbrain.ai/api/v1/prompts/:id"

payload = json.dumps({
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant"
    }
  ],
  "status": "PUBLISHED",
  "evaluators": []
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <API Key>'
}

response = requests.request("PUT", url, headers=headers, data=payload)

print(response.text)

Sample response

{
    "responseData": {
        "_id": "688700ca4208cfa7329d0e95",
        "name": "App Instructions",
        "messages": [
            {
                "role": "system",
                "content": "You are a helpful assistant"
            }
        ],
        "variables": {},
        "version": {
            "id": "688701514208cfa7329d0ea1",
            "number": 1
        },
        "publishedVersionId": "688701514208cfa7329d0ea1",
        "status": "PUBLISHED",
        "requestCount": 0,
        "evaluators": [],
        "avgLatency": 0,
        "totalCost": 0,
        "totalTokens": 0,
        "modelConfigs": {},
        "systemVariableConfigs": {},
        "builderAccessLevel": "CUSTOM",
        "operatorAccessLevel": "CUSTOM",
        "addedOn": 1753678026474,
        "modifiedOn": 1753678161757
    },
    "message": "Information updated successfully",
    "success": true,
    "responseCode": 200
}

Delete a prompt

To remove a prompt from the system, send a DELETE request to the endpoint using the prompt’s unique ID. This action is irreversible and will permanently remove the prompt from your workspace.

Request URL: https://promptmanager.app.zbrain.ai/api/v1/prompts/:id

Request method: DELETE

Path parameters

id- The unique Prompt ID (available on the overview page)

Request headers

  • Authorization: Bearer <<API Key >>

  • Content-Type: application/json

Sample request https://promptmanager.app.zbrain.ai/api/v1/prompts/681eacd7f51048bb8e33e4fb

Code snippets

cURL

curl --location --request DELETE 'https://promptmanager.app.zbrain.ai/api/v1/prompts/:id' \
--header 'Authorization: Bearer <API Key>'

NodeJs- Request

var request = require('request');
var options = {
  'method': 'DELETE',
  'url': 'https://promptmanager.app.zbrain.ai/api/v1/prompts/:id',
  'headers': {
    'Authorization': 'Bearer <API Key>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Python (Requests)

import requests
url = "https://promptmanager.app.zbrain.ai/api/v1/prompts/:id"
payload = {}
headers = {
  'Authorization': 'Bearer <API Key>'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)

Sample response

{
    "responseData": "Prompt Deleted Successfully",
    "message": "Information deleted successfully",
    "success": true,
    "responseCode": 200
} 

Get all prompts

Fetch a list of all prompts created in Prompt Manager. You can optionally filter, sort, or paginate the results using query parameters.

Request URL: https://promptmanager.app.zbrain.ai/api/v1/prompts

Request method: GET

Request headers

  • Authorization: Bearer <<API Key >>

  • Content-Type: application/json

Query parameters

Parameter
Type
Description

key

string

Search by prompt ID

searchQuery

string

Filter prompts by name or message content

sortKey

string

Sort by a specific field, e.g., addedOn, modifiedOn

order

string

asc or desc order of sorting

status

string

Filter prompts by status: DRAFT or PUBLISHED

skip

number

Number of records to skip (for pagination)

limit

number

Max number of records to return

Code snippets

cURL

curl --location 'https://promptmanager.app.zbrain.ai/api/v1/prompts' \
--header 'Authorization: Bearer <<API key>>'

NodeJs - Request

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://promptmanager.app.zbrain.ai/api/v1/prompts',
  'headers': {
    'Authorization': 'Bearer <<API key>>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Python(Requests)

import requests
url = "https://promptmanager.app.zbrain.ai/api/v1/prompts"
payload = {}
headers = {
  'Authorization': 'Bearer <<API key>>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)

Sample response

{
    "responseData": {
        "data": [
            {
                "_id": "6889d525fce5ed36170b58f8",
                "name": "App Instructions",
                "messages": [
                    {
                        "role": "system",
                        "content": "You are a friendly and polite customer service agent for ZBrain. Your primary responsibility is to assist users by answering their questions accurately and courteously. Always respond in the same language the question is asked, regardless of the language of the text in the context.\n\nBehavior Guidelines:\n\nGreetings:\n\nRespond to greetings with appropriate and matching greetings.\nExample: If a user says \"Hello,\" respond with \"Hello! How can I assist you today?\"\nHuman-like Interaction:\n\nRespond in a natural, conversational manner.\nAvoid robotic or overly formal language.\nShow empathy and support in your responses.\nAcknowledge user concerns and assure them that you are there to help.\nContextual Relevance:\n\nTailor your responses to the context provided.\nEnsure each response is relevant to the specific question and scenario.\nHandling Uncertainty:\n\nIf you cannot deduce the answer from the context, say:\n\"I couldn't find a specific answer to your question. To assist you better, please provide additional details or rephrase your question. The more specific information you provide, the more accurate and helpful my response can be.\"\nAttention Required Responses:\n\nIf any previous conversation contains the line \"This answer requires attention,\" and the same question is asked again, provide a proper answer ensuring it's not identical to the previous one.\nVisual Elements:\n\nDo not generate or display visual elements in your responses."
                    }
                ],
                "status": "DRAFT",
                "requestCount": 0,
                "avgLatency": 0,
                "totalCost": 0,
                "totalCredits": 0,
                "totalTokens": 0,
                "addedOn": 1753863461292,
                "modifiedOn": 1753863461292
            },
            {
                "_id": "6889d357fce5ed36170b584c",
                "name": "App Instructions",
                "messages": [
                    {
                        "role": "system",
                        "content": "You are a friendly and polite customer service agent for ZBrain. Your primary responsibility is to assist users by answering their questions accurately and courteously. Always respond in the same language the question is asked, regardless of the language of the text in the context.\n\nBehavior Guidelines:\n\nGreetings:\n\nRespond to greetings with appropriate and matching greetings.\nExample: If a user says \"Hello,\" respond with \"Hello! How can I assist you today?\"\nHuman-like Interaction:\n\nRespond in a natural, conversational manner.\nAvoid robotic or overly formal language.\nShow empathy and support in your responses.\nAcknowledge user concerns and assure them that you are there to help.\nContextual Relevance:\n\nTailor your responses to the context provided.\nEnsure each response is relevant to the specific question and scenario.\nHandling Uncertainty:\n\nIf you cannot deduce the answer from the context, say:\n\"I couldn't find a specific answer to your question. To assist you better, please provide additional details or rephrase your question. The more specific information you provide, the more accurate and helpful my response can be.\"\nAttention Required Responses:\n\nIf any previous conversation contains the line \"This answer requires attention,\" and the same question is asked again, provide a proper answer ensuring it's not identical to the previous one.\nVisual Elements:\n\nDo not generate or display visual elements in your responses."
                    }
                ],
                "status": "DRAFT",
                "requestCount": 0,
                "avgLatency": 0,
                "totalCost": 0,
                "totalCredits": 0,
                "totalTokens": 0,
                "addedOn": 1753862999421,
                "modifiedOn": 1753862999421
            },
            {
                "_id": "6889a22bfce5ed36170b5197",
                "name": "App Instructions",
                "messages": [
                    {
                        "role": "system",
                        "content": "You are a friendly and polite customer service agent for ZBrain. Your primary responsibility is to assist users by answering their questions accurately and courteously. Always respond in the same language the question is asked, regardless of the language of the text in the context.\n\nBehavior Guidelines:\n\nGreetings:\n\nRespond to greetings with appropriate and matching greetings.\nExample: If a user says \"Hello,\" respond with \"Hello! How can I assist you today?\"\nHuman-like Interaction:\n\nRespond in a natural, conversational manner.\nAvoid robotic or overly formal language.\nShow empathy and support in your responses.\nAcknowledge user concerns and assure them that you are there to help.\nContextual Relevance:\n\nTailor your responses to the context provided.\nEnsure each response is relevant to the specific question and scenario.\nHandling Uncertainty:\n\nIf you cannot deduce the answer from the context, say:\n\"I couldn't find a specific answer to your question. To assist you better, please provide additional details or rephrase your question. The more specific information you provide, the more accurate and helpful my response can be.\"\nAttention Required Responses:\n\nIf any previous conversation contains the line \"This answer requires attention,\" and the same question is asked again, provide a proper answer ensuring it's not identical to the previous one.\nVisual Elements:\n\nDo not generate or display visual elements in your responses."
                    }
                ],
                "status": "DRAFT",
                "requestCount": 0,
                "avgLatency": 0,
                "totalCost": 0,
                "totalCredits": 0,
                "totalTokens": 0,
                "addedOn": 1753850411406,
                "modifiedOn": 1753850411406
            },
            {
                "_id": "6888bdf7fce5ed36170b3666",
                "name": "App Instructions",
                "messages": [
                    {
                        "role": "system",
                        "content": "You are a friendly and polite customer service agent for ZBrain. Your primary responsibility is to assist users by answering their questions accurately and courteously. Always respond in the same language the question is asked, regardless of the language of the text in the context.\n\nBehavior Guidelines:\n\nGreetings:\n\nRespond to greetings with appropriate and matching greetings.\nExample: If a user says \"Hello,\" respond with \"Hello! How can I assist you today?\"\nHuman-like Interaction:\n\nRespond in a natural, conversational manner.\nAvoid robotic or overly formal language.\nShow empathy and support in your responses.\nAcknowledge user concerns and assure them that you are there to help.\nContextual Relevance:\n\nTailor your responses to the context provided.\nEnsure each response is relevant to the specific question and scenario.\nHandling Uncertainty:\n\nIf you cannot deduce the answer from the context, say:\n\"I couldn't find a specific answer to your question. To assist you better, please provide additional details or rephrase your question. The more specific information you provide, the more accurate and helpful my response can be.\"\nAttention Required Responses:\n\nIf any previous conversation contains the line \"This answer requires attention,\" and the same question is asked again, provide a proper answer ensuring it's not identical to the previous one.\nVisual Elements:\n\nDo not generate or display visual elements in your responses."
                    }
                ],
                "status": "DRAFT",
                "requestCount": 0,
                "avgLatency": 0,
                "totalCost": 0,
                "totalCredits": 0,
                "totalTokens": 0,
                "addedOn": 1753791991551,
                "modifiedOn": 1753791991551
            },
            {
                "_id": "687ddfbe4208cfa7329bf1c1",
                "name": "Untitled Prompt",
                "messages": [
                    {
                        "role": "system",
                        "content": "Respond to queries by leveraging information from the {{system.knowledgeBase}} , while incorporating the current date and time information as needed.\n\n- Access the system's knowledge base to retrieve the most relevant and accurate information concerning the query.\n- Utilize {{system.currentDateAndTime}} to enhance clarity and relevance in your response.\n\n# Steps\n\n1. Access the {{system.knowledgeBase}}.\n2. Identify the information relevant to the user's query.\n3. Integrate pertinent details from {{system.currentDateAndTime}} to provide temporal context.\n4. Craft a clear, concise, and accurate response that directly addresses the query.\n\n# Output Format\n\n- A well-structured paragraph or a set of sentences directly addressing the query.\n- Incorporate current date and time for context where applicable, ensuring it enhances the response.\n\n# Examples\n\n**Example 1**\n\n**Query:** \"What is the current status of the Mars Rover mission?\"\n\n**Response:**\n\"As of [current date and time], the Mars Rover mission is progressing smoothly. The latest data from the rover, available until yesterday, indicates that it has successfully completed its recent geological survey. This positions the mission well for the next phase, focused on sample collection expected to begin next month.\"\n\n**Example 2**\n\n**Query:** \"Can you provide today's weather forecast for New York City?\"\n\n**Response:**\n\"According to our system's knowledge base and as of [current date and time], today's weather forecast for New York City predicts partly cloudy skies with a high of 75°F, and a low of 60°F. Moderate winds are expected throughout the afternoon, transitioning into a clear evening.\"\n\n# Notes\n\n- Verify that the knowledge base information is both current and relevant at the time of your response.\n- Keep the language straightforward to ensure the information is easily understood.\n- The inclusion of the date and time should be relevant and improve the response, not obfuscate or clutter the information."
                    }
                ],
                "status": "DRAFT",
                "requestCount": 3,
                "avgLatency": 67.30633333333333,
                "totalCost": 0.22769999999999999,
                "totalCredits": 45.53999999999999,
                "totalTokens": 34834,
                "addedOn": 1753079742197,
                "modifiedOn": 1753441309737,
                "modelConfigs": {
                    "provider": "OPENAI",
                    "model": "gpt-4o",
                    "temperature": 0.7,
                    "maxTokens": 6000,
                    "topP": 1,
                    "frequencyPenalty": 0.1,
                    "presencePenalty": 0.1,
                    "contextMaxTokens": 6000
                }
            },
            {
                "_id": "68636cf2c7f40fd8e6e9f93e",
                "name": "Summary Generation",
                "messages": [
                    {
                        "role": "system",
                        "content": "Summarize long documents into concise bullet points.\n\n- Focus on key ideas, major arguments, and any data or evidence presented.\n- Ensure the bullet points are clear and capture the essence of the original content.\n- Condense information to its essence, leaving out trivial details.\n- Maintain the original meaning and intent of the document.\n\n Steps\n\n1. Review the document thoroughly to understand the overall topic and main arguments.\n2. Identify and highlight significant points, findings, theories, and any supporting data.\n3. Condense each highlighted section into a brief bullet point, maintaining clarity and logic.\n4. Arrange bullet points in the order they appear or logically flow in the document.\n\n# Output Format\n\n- Present the summary in bullet-point format.\n- Ensure each bullet point is a single, clear sentence.\n- Use no more than 10 bullet points, unless the document is exceptionally long or complex.\n\n# Examples\n\n**Example Input:**\nA long document discussing the impact of climate change on polar bear habitats.\n\n**Example Output:**\n\n- Climate change is significantly impacting polar bear habitats.\n- Melting ice caps reduce the hunting ground for polar bears.\n- Polar bear populations are decreasing due to habitat loss.\n- Conservation efforts are being implemented to protect polar bears. \n\n(Real outputs should include more bullet points if necessary for clarity and follow the length guidelines above.)"
                    }
                ],
                "status": "PUBLISHED",
                "requestCount": 0,
                "avgLatency": 0,
                "totalCost": 0,
                "totalCredits": 0,
                "totalTokens": 0,
                "addedOn": 1751346418313,
                "modifiedOn": 1754063944688,
                "modelConfigs": {
                    "provider": "OPENAI",
                    "model": "gpt-4o",
                    "temperature": 0.7,
                    "maxTokens": 6000,
                    "topP": 1,
                    "frequencyPenalty": 0.1,
                    "presencePenalty": 0.1,
                    "contextMaxTokens": 6000
                },
                "publishedVersionId": "686381b5c7f40fd8e6e9fd91"
            },
            {
                "_id": "683eacd7f51048bb8e33e4fb",
                "name": "Content Refinement Agent",
                "messages": [
                    {
                        "role": "system",
                        "content": "You are a helpful assistant"
                    }
                ],
                "status": "PUBLISHED",
                "requestCount": 415,
                "avgLatency": 13.46558072289155,
                "totalCost": 16.913868659999995,
                "totalCredits": 0,
                "totalTokens": 2504177,
                "addedOn": 1748937943349,
                "modifiedOn": 1753875577269,
                "modelConfigs": {
                    "provider": "OPENAI",
                    "model": "gpt-4o",
                    "temperature": 0.7,
                    "maxTokens": 6000,
                    "topP": 1,
                    "frequencyPenalty": 0.1,
                    "presencePenalty": 0.1,
                    "contextMaxTokens": 6000
                },
                "publishedVersionId": "688a0479fce5ed36170b61ff"
            },
            {
                "_id": "681c8bf5de834d603e7986eb",
                "name": "Employee Query Management",
                "messages": [
                    {
                        "role": "system",
                        "content": "Your task is to guide the AI in addressing employees' questions related to HR policies, including various types of leaves, benefits, equal employment opportunities, workplace conduct, and other HR-related inquiries. The AI should provide clear, accurate, and concise information based on the company's policy handbook.\n \nSteps\n\n1. *Understand the Inquiry**: Interpret the employee's question and identify the main topic, such as types of leave, work-from-home policies, or ethical conduct.\n2. **Search Policy Handbook**: Look for relevant information in the company's HR policy handbook or other provided resources.\n3. **Provide Clear Information**: Offer a clear and concise answer that directly addresses the employee's question, ensuring the information is accurate and in line with company policies.\n4. **Additional Resources**: If applicable, suggest where the employee can find more detailed information or assistance, such as a specific document, HR contact, or website link.\n\n# Output Format\n\nRespond with a comprehensive yet concise text paragraph that includes:\n- A direct answer to the query\n- Reference or summary of specific policies if applicable\n- Suggestions for additional resources or contacts if the query cannot be fully resolved with the given information\n\n# Examples\n\n**Example 1:**\n- **Input**: \"What is the policy for maternity leave?\"\n- **Reasoning**: Identify maternity leave as the topic and locate it in the HR policy document.\n- **Output**: \"According to our policy, employees are entitled to [X] weeks of maternity leave. This includes [details on paid/unpaid status, extensions, etc.]. For more information, you can refer to [section name] in the employee handbook or contact HR at [HR contact information].\"\n\n**Example 2:**\n- **Input**: \"Can I work from home occasionally?\"\n- **Reasoning**: Recognize the work-from-home policy as the main focus and check the relevant section in the policy handbook.\n- **Output**: \"Our work-from-home policy allows employees to work remotely up to [X] days per month with manager approval. Please refer to [section name] for more details or discuss with your manager if you have specific needs.\"\n\n# Notes\n\n- Ensure all information is up-to-date and reflects the current policy standards.\n- Maintain confidentiality and professionalism in responses.\n- Redirect to human resources professionals when necessary for complex issues or cases not covered by automated responses."
                    }
                ],
                "status": "PUBLISHED",
                "requestCount": 192,
                "avgLatency": 8.173406249999998,
                "totalCost": 14.248810716000001,
                "totalCredits": 0,
                "totalTokens": 363528,
                "addedOn": 1746701301450,
                "modifiedOn": 1753765251912,
                "publishedVersionId": "683ecf0af51048bb8e33eb30",
                "modelConfigs": {
                    "provider": "OPENAI",
                    "model": "gpt-4",
                    "temperature": 0.7,
                    "maxTokens": 500,
                    "topP": 1,
                    "frequencyPenalty": 0.1,
                    "presencePenalty": 0.1,
                    "contextMaxTokens": 2000
                }
            },
            {
                "_id": "681c736ede834d603e7983aa",
                "name": "Summary generation",
                "messages": [
                    {
                        "role": "system",
                        "content": "Generate a concise and accurate summary of a given text.\n\nExtract key information and main points from the provided text, capturing the essence while omitting unnecessary details. Ensure the summary is clear and maintains the original meaning and context of the source material.\n\nSteps:\n\n1. Read the entire text to understand the main concepts and essential details.\n2. Identify the thesis or main argument, supporting points, and any conclusions.\n3. Note any significant details or data points that contribute to understanding the text.\n4. Ensure that all relevant points are documented and unnecessary or redundant information is removed.\n5. Construct a concise summary that encapsulates the main ideas accurately.\n\n# Output Format\n\n- Provide a summary in a paragraph.\n- Focus on clear and concise language, generally not exceeding [X] sentences or [Y] words (depending on user requirements).\n\n# Examples \n\n**Input:**\n\n\"Machine learning is a branch of artificial intelligence (AI) that enables computers to learn from data and improve over time without being explicitly programmed. It involves algorithms that identify patterns within data, allowing systems to make predictions or decisions based on new data. Machine learning is used in various applications, including speech recognition, image analysis, and autonomous vehicles.\"\n\n**Output:**\n\n\"Machine learning is a subset of AI focused on developing algorithms that enable systems to learn from data and improve their performance in tasks like speech recognition, image analysis, and autonomous driving.\"\n\n# Notes\n\n- Summaries should prioritize clarity and should aim to be as complete as possible while remaining succinct.\n- Avoid adding personal interpretations or information that doesn’t exist in the original text.\n- Consider the intended audience and ensure technical jargon is simplified if needed."
                    }
                ],
                "status": "PUBLISHED",
                "requestCount": 0,
                "avgLatency": 0,
                "totalCost": 0,
                "totalCredits": 0,
                "totalTokens": 0,
                "addedOn": 1746695022164,
                "modifiedOn": 1753079735816,
                "publishedVersionId": "683ec8cef51048bb8e33e919",
                "modelConfigs": {
                    "provider": "OPENAI",
                    "model": "gpt-4o",
                    "temperature": 0.7,
                    "maxTokens": 6000,
                    "topP": 1,
                    "frequencyPenalty": 0.1,
                    "presencePenalty": 0.1,
                    "contextMaxTokens": 6000
                }
            }
        ],
        "total": 9
    },
    "message": "Information fetched successfully",
    "success": true,
    "responseCode": 200
}

Get prompt stats

This API provides detailed usage and performance analytics for a specific prompt, including token usage, latency, cost, and usage trends over time. You must supply the prompt ID and, optionally, its version ID.

Request URL: https://promptmanager.app.zbrain.ai/api/v1/prompts/:id/stats

Request method: GET

Path parameters

id- The unique Prompt ID (available on the overview page)

Request headers

  • Authorization: Bearer <<API Key >>

  • Content-Type: application/json

Query parameters (Optional)Get prompt stats

This API provides detailed usage and performance analytics for a specific prompt, including token usage, latency, cost, and usage trends over time. You must supply the prompt ID and, optionally, its version ID.

Request URL: https://promptmanager.app.zbrain.ai/api/v1/prompts/:id/stats

Request method: GET

Path parameters

id- The unique Prompt ID (available on the overview page)

Request headers

  • Authorization: Bearer <<API Key >>

  • Content-Type: application/json

Query parameters (Optional)

versionId

string

ID of the specific prompt version to get stats for

Code snippets

cURL

curl --location 'https://promptmanager.app.zbrain.ai/api/v1/prompts/id/stats' \
--header 'Authorization: Bearer <<API key>>'

NodeJs- Request

var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://promptmanager.app.zbrain.ai/api/v1/prompts/id/stats',
  'headers': {
    'Authorization': 'Bearer <<API key>>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

Python(Requests)

import requests
url = "https://promptmanager.app.zbrain.ai/api/v1/prompts/id/stats"
payload = {}
headers = {
  'Authorization': 'Bearer <<API key>>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)

Sample response

{
    "responseData": {
        "totalLogs": 193,
        "totalTokens": 364129,
        "totalCost": 14.253544716000002,
        "averageCost": 0.07385256329533679,
        "medianCost": 0.08985880800000001,
        "averageTime": 8141.378238341969,
        "medianTime": 3610,
        "runsOverTime": [
            {
                "date": 1746662400000,
                "value": 4
            },
            {
                "date": 1746748800000,
                "value": 1
            },
            {
                "date": 1747180800000,
                "value": 3
            },
            {
                "date": 1748908800000,
                "value": 17
            },
            {
                "date": 1748995200000,
                "value": 24
            },
            {
                "date": 1749081600000,
                "value": 24
            },
            {
                "date": 1749168000000,
                "value": 23
            },
            {
                "date": 1749254400000,
                "value": 24
            },
            {
                "date": 1749340800000,
                "value": 9
            },
            {
                "date": 1750377600000,
                "value": 14
            },
            {
                "date": 1750464000000,
                "value": 23
            },
            {
                "date": 1750550400000,
                "value": 24
            },
            {
                "date": 1750636800000,
                "value": 2
            },
            {
                "date": 1750982400000,
                "value": 1
            }
        ]
    },
    "message": "Information fetched successfully",
    "success": true,
    "responseCode": 200
}

Last updated