Get prompt

Returns one of the caller org's prompts: its CURRENT template text plus the metadata of every version it has had.

GET /v1/prompt/{name}

Addresshttps://api.hanzo.ai/v1/prompt/{name}
MethodGET
Operationget_prompt_by_name
AuthAuthorization: Bearer $HANZO_API_KEY

Returns one of the caller org's prompts: its CURRENT template text plus the metadata of every version it has had. The history carries version numbers, types and timestamps only — not each version's body — so a long history cannot inflate this response. A name the caller's org does not own is 404, whoever owns it.

Request

1 field.

FieldInTypeRequiredDescription
namepathstringyesName is the prompt to act on, from the path.

Response

StatusBodyMeaning
200prompt.promptDetailok
defaultproblem-detailsrefused

200 body — 12 fields.

FieldInTypeAlwaysDescription
createdAtbodystring—CreatedAt is when version 1 was written, RFC 3339 UTC.
labelsbodystring[]—Labels is the current version's free-form taxonomy.
lastUpdatedAtbodystring—UpdatedAt is when the current version was appended, RFC 3339 UTC.
namebodystring—Name is the prompt's org-unique handle and the URL segment it is addressed by.
promptbodystring—Prompt is the CURRENT version's template body — the only content this service returns.
tagsbodystring[]—Tags is the second free-form taxonomy, same rules as Labels.
typebodystring—Type labels the current version's kind; "text" unless the creator said otherwise.
versionbodyinteger (int64)—Version is the current version number, starting at 1 and incremented by one on every create against an existing name.
versionHistorybodyprompt.versionView[]—Versions is the history METADATA, newest first, capped at the last 100 — no bodies, so a long history cannot inflate this response.
versionHistory[].createdAtbodystring—CreatedAt is when this revision was appended, RFC 3339 UTC.
versionHistory[].typebodystring—Type is the kind this revision was written with, which may differ from the current one.
versionHistory[].versionbodyinteger (int64)—Version is this revision's number, 1 for the first.

Failure carries the platform error shape — see Errors.

Examples

hanzo prompt get <name>
import { Configuration, PromptApi } from 'hanzoai';

const api = new PromptApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getPromptByName({ name: 'name' });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import PromptApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = PromptApi(client).get_prompt_by_name(name='name')
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.PromptAPI.GetPromptByName(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, prompt_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = prompt_api::get_prompt_by_name(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.PromptApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new PromptApi(client).getPromptByName();
curl https://api.hanzo.ai/v1/prompt/<name> \
  -H "Authorization: Bearer $HANZO_API_KEY"

Tool prompt, op get_prompt_by_name — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "prompt",
         "arguments": {
           "op": "get_prompt_by_name",
           "input": {
             "name": "<name>"
           }
         }
       }
     }'

Prompt API · All Hanzo APIs · Interactive reference

Was this page useful?