Get function

One function with everything a detail page needs in one round-trip: its definition, its 7-day rollup, its trigger, its twenty most recent invocations and the NAMES of the secrets it mounts.

GET /v1/function/{name}

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

One function with everything a detail page needs in one round-trip: its definition, its 7-day rollup, its trigger, its twenty most recent invocations and the NAMES of the secrets it mounts.

Secret values are never read or returned. A name the caller's org does not hold is 404, which is also what another tenant's function looks like from here.

Request

1 field.

FieldInTypeRequiredDescription
namepathstringyesName is the function the URL names.

Response

StatusBodyMeaning
200function.functionDetailok
defaultproblem-detailsrefused

200 body — 31 fields.

FieldInTypeAlwaysDescription
avgDurationMsbodynumber (double)—mean wall-clock of those runs
createdAtbodystring—when it was first published
endpointbodystring—the path that invokes it
envCountbodyinteger (int64)—how many secret NAMES it mounts; values are never carried
environmentbodystring—the language it runs under
errors7dbodyinteger (int64)—how many of those runs failed
imagebodystring—the prebuilt image it runs, when it runs one instead of source
invocations7dbodyinteger (int64)—runs in the last 7 days; ABSENT, never 0, when it has not run
lastDeployedAtbodystring—when its code last changed
memoryLimitbodystring—the memory it runs with, and the multiplier on its compute charge
namebodystring—the function's org-unique handle
namespacebodystring—the display group it belongs to; the org is the isolation key
recentInvocationsbodyfunction.invocationView[]—RecentInvocations is its twenty most recent runs, newest first.
recentInvocations[].durationMsbodyinteger (int64)—how long it took
recentInvocations[].idbodystring—the invocation's handle
recentInvocations[].methodbodystring—the HTTP method that triggered it
recentInvocations[].statusbodystring—how the run ended: ok, error or timeout
recentInvocations[].statusCodebodyinteger (int64)—Code is the status the function's OWN code answered with, which is not the status of the reply — a program can answer 500 through a healthy sandbox.
recentInvocations[].timebodystring—when it ran, RFC3339
secretsbodystring[]—Secrets are the NAMES it mounts.
statusbodystring—whether it is ready to serve
successRatebodynumber (double)—share of those runs that succeeded, 0..1
targetbodystring—where it runs: empty for the sandbox, "fleet" for the org's GPU fleet
timeoutSecbodyinteger (int64)—its per-invocation deadline
triggersbodyfunction.triggerView[]—Triggers is how this function is reached.
triggers[].enabledbodyboolean—whether it currently fires
triggers[].functionNamebodystring—the function it calls
triggers[].idbodystring—the trigger's handle
triggers[].namebodystring—a human label for it
triggers[].targetbodystring—the path it calls
triggers[].typebodystring—what kind of trigger it is; HTTP is the only one today

Failure carries the platform error shape — see Errors.

Examples

hanzo function get <name>
import { Configuration, FunctionApi } from 'hanzoai';

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

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

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

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

let result = function_api::get_function_by_name(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.FunctionApi;

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

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

Tool function, op get_function_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": "function",
         "arguments": {
           "op": "get_function_by_name",
           "input": {
             "name": "<name>"
           }
         }
       }
     }'

Function API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.