---
docId: doc_277852509206451ebfb8fd647991ef48
title: Verify a function
description: "Review and compile a function without running or deploying it."
api:
  group: herramientas/funciones-personalizadas
  auth: bearer
  operations:
    - operationId: verifyFunction
      method: POST
      path: '/v1/tools/functions/{functionId}/verify'
      postmanName: Verify a function
---

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

# Verify a function

Compile and review the code without running it. Check size, syntax, types, allowed packages, forbidden APIs, bundling, input schema, and declared domains. The result is saved in `lastVerify`.

## Example

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

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

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

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

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `functionId` | string | Function ID | ✓ |

## Request body

Optional.

```json
{
  "source": "import { z } from \"zod\";\nimport { defineFunction } from \"@platica/functions\";\n\nexport default defineFunction({ … });\n"
}
```

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `source` | string | Verifies this code instead of the saved draft, without saving it | — |

## Response

Check `ok`: a failed verification returns HTTP `200` with `ok: false`.

```json
{
  "status": "success",
  "data": {
    "ok": false,
    "issues": [
      {
        "stage": "deny",
        "code": "FORBIDDEN_GLOBAL",
        "message": "No se permite usar process",
        "line": 7
      }
    ],
    "nextStep": "Fix each issue (stage, line, message) in source with PATCH /v1/tools/functions/Hk2s9QmXc1, or send the fixed source to POST /v1/tools/functions/Hk2s9QmXc1/verify first, and verify again."
  }
}
```

When it passes:

```json
{
  "status": "success",
  "data": {
    "ok": true,
    "issues": [],
    "inputSchema": {
      "type": "object",
      "properties": {
        "taxId": { "type": "string", "description": "Customer tax ID, 12 or 13 characters" }
      },
      "required": ["taxId"]
    },
    "checksum": "sha256-3f1c9a…",
    "nextStep": "Verified. Try it with POST /v1/tools/functions/Hk2s9QmXc1/test and a sample input, then publish it with POST /v1/tools/functions/Hk2s9QmXc1/publish."
  }
}
```

## Response fields

<Collapsible summary="Show all fields">

| Field | Type | Description |
|-------|------|-------------|
| `ok` | boolean | Whether the code passed |
| `issues` | array | Each problem with `stage`, `code`, `message` (in Spanish) and, when it applies, `line` and `column` |
| `inputSchema` | object | The JSON Schema the agent will see, taken from the `input` schema |
| `checksum` | string | Fingerprint of the verified code |
| `nextStep` | string | Text in English that says what comes next. Do not program against its wording |

### Stages

Stages run in this order; `stage` says which one found the problem.

| `stage` | What it reviews |
|---------|-----------------|
| `size` | That the code is not over 100 KB |
| `parse` | That the syntax is valid |
| `typecheck` | The TypeScript types |
| `imports` | That it only imports [allowed packages](/api-reference/custom-functions#code-format) |
| `deny` | That it does not use forbidden APIs, such as `process`, `eval` or the global `fetch` |
| `bundle` | That it can be bundled in 1 MB or less |
| `schema` | That `input` is a `zod` schema that can be converted to JSON Schema |
| `domains` | That the domains and the secrets' origins are valid |

</Collapsible>

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | The body fails validation. `details.issues` has the list of problems |
| `403` | `FORBIDDEN` or `INSUFFICIENT_SCOPE` | The credential does not have write access to Integrations |
| `404` | `NOT_FOUND` | The function does not exist in this workspace |

## Notes

- Verifying does not run anything or call any domain, and does not count against calls or deployments.
- [Test](/api-reference/custom-functions/test) and [publish](/api-reference/custom-functions/publish) verify again before deploying.
