---
docId: doc_21ca0ee811a34d119ceca3e944a933fa
title: Executions
description: "Read execution results, logs, and HTTP calls."
api:
  group: herramientas/funciones-personalizadas
  auth: bearer
  operations:
    - operationId: listWorkspaceFunctionRuns
      method: GET
      path: /v1/tools/functions/runs
      postmanName: List function executions
    - operationId: listFunctionRuns
      method: GET
      path: '/v1/tools/functions/{functionId}/runs'
      postmanName: List function executions
---

<script>
  import { Ways, Collapsible } from '$lib/components';
</script>

# Executions

Each agent call, [manual run](/api-reference/custom-functions/run), or [test](/api-reference/custom-functions/test) records an execution. It includes the result, logs, and HTTP calls, without secret values.

The first request lists the executions of all functions; the second, those of a single function. Both go from newest to oldest.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl "https://api.platic.ai/v1/tools/functions/runs?limit=20" \
  -H "Authorization: Bearer $PLATIC_API_KEY"

curl "https://api.platic.ai/v1/tools/functions/$FUNCTION_ID/runs" \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.tools.functions.runs({ limit: 20 });

await platic.tools.functions.runs({ functionId: "fn_123" });
```

</Ways.Way>
</Ways>

## Parameters

| Parameter | In | Type | Description | Required |
|-----------|----|------|-------------|----------|
| `functionId` | path | string | Function ID. Only on the second route | ✓ |
| `limit` | query | integer | How many to return, from 1 to 100. Default, 50 | — |
| `pageToken` | query | string | The previous page's `nextPageToken` | — |
| `workspace` | query | string | Only if the credential covers several workspaces: the workspace to act in | — |

## Response

```json
{
  "status": "success",
  "data": [
    {
      "id": "run_8d1f",
      "functionId": "Hk2s9QmXc1",
      "functionName": "tax_id_lookup",
      "version": 1,
      "trigger": "agent",
      "ok": true,
      "durationMs": 412,
      "inputPreview": "{\"taxId\":\"XAXX010101000\"}",
      "outputPreview": "{\"found\":true,\"name\":\"EXAMPLE COMPANY INC\"}",
      "logs": ["info response {\"status\":200}"],
      "httpCalls": [
        { "method": "POST", "host": "api.example.com", "status": 200, "durationMs": 380 }
      ],
      "agentId": "Qm3vT8yLp2",
      "conversationId": "c1F9aZr7Kd",
      "at": "2026-11-24T18:05:00.000Z"
    },
    {
      "id": "run_7a02",
      "functionId": "Hk2s9QmXc1",
      "functionName": "tax_id_lookup",
      "version": "draft",
      "trigger": "test",
      "ok": false,
      "errorCode": "EGRESS_DENIED",
      "errorMessage": "La función intentó llamar a un dominio que no está permitido.",
      "durationMs": 95,
      "logs": [],
      "httpCalls": [],
      "actor": "user:8sKd2LxQp0",
      "at": "2026-11-24T17:58:00.000Z"
    }
  ],
  "nextPageToken": "eyJhdCI6IjIwMjYtMTEtMjRUMTg6MDU6MDAuMDAwWiJ9"
}
```

## Response fields

<Collapsible summary="Show all fields">

| Field | Type | Description |
|-------|------|-------------|
| `nextPageToken` | string \| null | For the next page: send it as `pageToken`. `null` when there are no more |
| `data[].id` | string | Execution ID |
| `data[].functionId`, `functionName` | string | The function that ran |
| `data[].version` | integer \| string | The version that ran, or `"draft"` in a test |
| `data[].trigger` | string | Who ran it: `agent`, `manual` or `test` |
| `data[].ok` | boolean | Whether it finished well |
| `data[].errorCode`, `errorMessage` | string | When it failed. See [errors inside an execution](/api-reference/custom-functions#errors-inside-an-execution) |
| `data[].durationMs` | integer | Duration |
| `data[].inputPreview`, `outputPreview` | string | Excerpt of the input and the output, up to 4 KB each |
| `data[].logs` | string[] | What the code wrote with `log` |
| `data[].httpCalls` | array | Each call with `method`, `host`, `status` and `durationMs` |
| `data[].agentId`, `conversationId` | string | The agent and the conversation, when an agent called it |
| `data[].actor` | string | Who ran it by hand or tested it |
| `data[].at` | string | ISO 8601 date |

</Collapsible>

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | `limit` out of range, invalid `pageToken`, or the credential covers several workspaces and `workspace` is missing |
| `403` | `FORBIDDEN` | The person behind the token does not have access to Integrations |
| `404` | `NOT_FOUND` | The function does not exist in this workspace |

## Notes

- The executions of a deleted function are kept for 30 days.
- For the next page, send `nextPageToken` as `pageToken`. `cursor` is also accepted as an alias for `pageToken`.
- Secret values never appear: Platica removes them before storing.
