Update a function

SDK platic.tools.functions.update()

Update the draft fields you send. Agents keep using the published version until you publish again.

Example

await platic.tools.functions.update("fn_123", { timeoutSeconds: 30 });

Path parameters

ParameterTypeDescriptionRequired
functionIdstringFunction ID✓

Request body

{
  "timeoutSeconds": 30,
  "allowedDomains": ["api.example.com", "auth.example.com"]
}

Send at least one. Lists are replaced whole.

FieldTypeDescriptionRequired
displayNamestringName for people, up to 80 characters—
descriptionstring10 to 1,000 characters—
sourcestringThe complete TypeScript code, up to 100 KB—
allowedDomainsstring[]Exact hosts, HTTPS only. Up to 10—
timeoutSecondsintegerFrom 1 to 60—
secretSlotsarray{ slot, origin } slots, up to 10. See secretSlots—

name cannot be changed.

Response

data has the complete function, with the fields of Get a function.

{
  "status": "success",
  "message": "Function updated",
  "data": {
    "id": "Hk2s9QmXc1",
    "name": "tax_id_lookup",
    "status": "enabled",
    "allowedDomains": ["api.example.com", "auth.example.com"],
    "timeoutSeconds": 30,
    "liveVersion": 1,
    "toolName": "fn_tax_id_lookup",
    "toolId": "Hk2s9QmXc1",
    "secrets": [
      {
        "slot": "API_KEY",
        "origin": "https://api.example.com",
        "state": "bound",
        "secretId": "5d0c7a1e9b3f4a6c8e2d1f0b7a9c3e5d6f8a0b2c4d6e8f1a3b5c7d9e0f2a4b6c"
      }
    ],
    "nextStep": "Draft changed. Verify it with POST /v1/tools/functions/Hk2s9QmXc1/verify and publish it to make it live; agents keep using version 1."
  }
}

Some fields are left out of the example.

Errors

Statusdetails.codeWhen
400INVALID_REQUESTThe body is empty or fails validation. details.issues has the list of problems
403FORBIDDEN or INSUFFICIENT_SCOPEThe credential does not have write access to Integrations
404NOT_FOUNDThe function does not exist in this workspace

Notes

  • Changing allowedDomains or secretSlots requires binding the secrets again: a secret is authorized for a destination.
  • After changing source, verify the code.
  • For agents to use the change, publish a new version.