# List invocations

URL: https://docs.hanzo.ai/docs/openapi/function/get-function-by-name-invocations

> One function's past runs, newest first — each with its status, HTTP code, method, time and duration.

`GET /v1/function/{name}/invocations`

> [Function →](https://docs.hanzo.ai/docs/openapi/function) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                                       |
| ------------- | ----------------------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/function/{name}/invocations` |
| **Method**    | `GET`                                                 |
| **Operation** | `get_function_by_name_invocations`                    |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`                |

One function's past runs, newest first — each with its status,
HTTP code, method, time and duration.

These are real recorded rows, not a projection: an invocation appears here only
once it actually ran. Requires a validated principal; the read is scoped to its
org.

## Request

2 fields.

| Field   | In    | Type    | Required | Description                             |
| ------- | ----- | ------- | -------- | --------------------------------------- |
| `name`  | path  | string  | yes      | Name is the function the URL names.     |
| `limit` | query | integer | —        | Limit caps the page, defaulting to 100. |

## Response

| Status    | Body                    | Meaning |
| --------- | ----------------------- | ------- |
| `200`     | function.invocationList | ok      |
| `default` | problem-details         | refused |

`200` body — 7 fields.

| Field                      | In   | Type                       | Always | Description                                                                                                                                          |
| -------------------------- | ---- | -------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `invocations`              | body | function.invocationView\[] | —      | Invocations is one row per past run, newest first.                                                                                                   |
| `invocations[].durationMs` | body | integer (int64)            | —      | how long it took                                                                                                                                     |
| `invocations[].id`         | body | string                     | —      | the invocation's handle                                                                                                                              |
| `invocations[].method`     | body | string                     | —      | the HTTP method that triggered it                                                                                                                    |
| `invocations[].status`     | body | string                     | —      | how the run ended: ok, error or timeout                                                                                                              |
| `invocations[].statusCode` | body | integer (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. |
| `invocations[].time`       | body | string                     | —      | when it ran, RFC3339                                                                                                                                 |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo function invocations <name>
```

**SDK**

**.ts**

```ts
import { Configuration, FunctionApi } from 'hanzoai';

const api = new FunctionApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getFunctionByNameInvocations({ name: 'name' });
```

**.py**

```python
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_invocations(name='name')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.FunctionAPI.GetFunctionByNameInvocations(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
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_invocations(&cfg, Default::default()).await?;
```

**.java**

```java
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).getFunctionByNameInvocations();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/function/<name>/invocations \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

MCP reaches **function** through the `function` tool, which names its 10 operations with its own verbs — this one among them, under a name only MCP declares. `describe` explains any of them:

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_functions"
         }
       }
     }'
```

---

[Function API](https://docs.hanzo.ai/docs/openapi/function) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
