Verify a function
SDK platic.tools.functions.verify()
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
curl -X POST "https://api.platic.ai/v1/tools/functions/$FUNCTION_ID/verify" \
-H "Authorization: Bearer $PLATIC_API_KEY" await platic.tools.functions.verify("fn_123"); Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
functionId | string | Function ID | ✓ |
Request body
Optional.
{
"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.
{
"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:
{
"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
| 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 |
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 |
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 |