---
docId: doc_5d268ef246d74ee58d0a89138b09ba02
title: Get a function
description: "Read a function draft, verification, and secret slots."
api:
  group: herramientas/funciones-personalizadas
  auth: bearer
  operations:
    - operationId: getFunction
      method: GET
      path: '/v1/tools/functions/{functionId}'
      postmanName: Get a function
---

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

# Get a function

Read a function's current draft code, latest verification, and secret-slot states. Secret values are not returned.

## Example

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

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

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

```ts
await platic.tools.functions.get("fn_123");
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `functionId` | string | Function ID. When it is on, it is also its `toolId` | ✓ |

## Response

```json
{
  "status": "success",
  "data": {
    "id": "Hk2s9QmXc1",
    "name": "tax_id_lookup",
    "displayName": "Tax ID lookup",
    "description": "Looks up a customer's company name by tax ID. Use it when the customer gives their tax ID.",
    "status": "enabled",
    "source": "import { z } from \"zod\";\nimport { defineFunction } from \"@platica/functions\";\n\nexport default defineFunction({\n  input: z.object({\n    taxId: z.string().describe(\"Customer tax ID, 12 or 13 characters\"),\n  }),\n  async run(input, { http, secrets, log }) {\n    const res = await http.fetch(\"https://api.example.com/v1/tax-id\", {\n      method: \"POST\",\n      headers: { \"Content-Type\": \"application/json\", Authorization: `Bearer ${secrets.API_KEY}` },\n      body: JSON.stringify({ taxId: input.taxId }),\n    });\n    if (res.status !== 200) return { found: false };\n    log.info(\"response\", { status: res.status });\n    return { found: true, name: res.json().company_name };\n  },\n});\n",
    "draftChecksum": "sha256-3f1c9a…",
    "allowedDomains": ["api.example.com"],
    "timeoutSeconds": 20,
    "secretSlots": [
      { "slot": "API_KEY", "origin": "https://api.example.com" }
    ],
    "inputSchema": {
      "type": "object",
      "properties": {
        "taxId": { "type": "string", "description": "Customer tax ID, 12 or 13 characters" }
      },
      "required": ["taxId"]
    },
    "liveVersion": 1,
    "lastVerify": { "ok": true, "at": "2026-11-24T18:00:00.000Z", "issues": [] },
    "createdAt": "2026-11-24T17:50:00.000Z",
    "createdBy": "user:8sKd2LxQp0",
    "updatedAt": "2026-11-24T18:01:00.000Z",
    "updatedBy": "user:8sKd2LxQp0",
    "toolName": "fn_tax_id_lookup",
    "toolId": "Hk2s9QmXc1",
    "secrets": [
      {
        "slot": "API_KEY",
        "origin": "https://api.example.com",
        "state": "bound",
        "secretId": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
      }
    ],
    "nextStep": "Live (version 1). Connect it to an agent with PUT /v1/agents/{agentId}/tools/Hk2s9QmXc1; run it by hand with POST /v1/tools/functions/Hk2s9QmXc1/run. Changes to source stay in the draft until you publish again."
  }
}
```

## Response fields

<Collapsible summary="Show all fields">

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | Function ID |
| `name` | string | Unique name in the workspace. It cannot be changed |
| `displayName` | string | Name for people |
| `description` | string | What it does and when to use it. It is what the agent reads to decide whether to call it |
| `status` | string | `draft`, `enabled` or `paused`. See [states](/api-reference/custom-functions#states) |
| `source` | string | The draft's code. The list can leave it out |
| `draftChecksum` | string \| null | Fingerprint of the draft's last successful verification |
| `allowedDomains` | string[] | Hosts the code can call with `http.fetch` |
| `timeoutSeconds` | integer | Maximum time of each execution, from 1 to 60 |
| `secretSlots` | array | The declared slots: `{ slot, origin }` |
| `inputSchema` | object \| null | The JSON Schema the agent sees, from the last successful verification |
| `liveVersion` | integer \| null | The version agents use. `null` before the first publication |
| `lastVerify` | object \| null | The last verification: `ok`, `at` and `issues`. `null` before the first one |
| `createdAt`, `updatedAt` | string | ISO 8601 dates |
| `createdBy`, `updatedBy` | string | Who created or changed it: `api:<keyId>` with an API key or `user:<uid>` |
| `toolName` | string | `fn_<name>`, the tool name agents see |
| `toolId` | string \| null | While it is on, the ID to [connect a tool](/api-reference/agents/tools/connect). It is the same `id` as the function's |
| `secrets` | array | Each slot with `slot`, `origin`, `state` (`bound` or `missing`) and `secretId`. Never the value |
| `nextStep` | string | Text in English that says what comes next. Do not program against its wording |

</Collapsible>

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `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

- `source` is always the draft. The code of a published version is in [versions](/api-reference/custom-functions/versions).
- If `lastVerify.ok` is `false`, each problem in `lastVerify.issues` has `stage`, `line` and `message`. See [Verify a function](/api-reference/custom-functions/verify).
