Skip to content

ptkl functions

List, inspect, create, update, run, and generate IDL signatures for platform functions from the command line.


Overview

ptkl functions manages platform functions defined in your project: read them (list/get), create and update them, invoke them directly (run), and generate the IDL signature a function resolves to in a given environment (signature).

Every subcommand supports the standard output flags (-f/--format, -o/--output, --template) plus the --env <dev|live> option. All subcommands resolve to the function payload (never a raw HTTP response), so -f json/-f jsonpath/-f template behave consistently across the whole command.


Subcommands

Subcommand Description
list List all platform functions
get <reference> Get a function by name, tag, or UUID
run <reference> Run a platform function
create Create a new function
update <uuid> Update an existing function
signature <env> <reference> Generate the IDL signature for a function in a given environment

ptkl functions list

List all platform functions in the current project.

ptkl functions list [options]

Options

Option Description
-f, --format <format> Output format — json or table (default: table)
-o, --output <file> Write output to a file instead of stdout

Example

# table output
ptkl functions list

# JSON output to a file
ptkl functions list --format json --output functions.json

ptkl functions get

Retrieve a single function by its name, tag, or UUID.

ptkl functions get <reference> [options]

Options

Option Description
-f, --format <format> Output format — json or table (default: table)
-o, --output <file> Write output to a file instead of stdout

Example

# by name
ptkl functions get calculate_vat

# JSON output
ptkl functions get calculate_vat --format json

ptkl functions run

Run (invoke) a platform function directly, passing an optional input payload and query params.

ptkl functions run <reference> [options]

Options

Option Description
-i, --input <json> Input payload as a JSON string
-q, --query <json> Query params as a JSON object string

Example

ptkl functions run calculate_vat --input '{"amount":1000,"rate":0.2}'

ptkl functions run calculate_vat \
  --input '{"amount":1000,"rate":0.2}' \
  --query '{"debug":"true"}'

ptkl functions create

Create a new function from a full create payload, supplied inline or from a file.

ptkl functions create [options]

Options

Option Description
-d, --data <data> Full create payload as a JSON string (overrides --file)
-i, --file <file> Path to a JSON file containing the full create payload

Example

ptkl functions create --file ./calculate_vat.json

ptkl functions create --data '{"name":"calculate_vat","runtime":"js","code":"..."}'

ptkl functions update

Update an existing function by UUID, supplying the fields to change inline or from a file.

ptkl functions update <uuid> [options]

Options

Option Description
-d, --data <data> Fields to update, as a JSON object string (overrides --file)
-i, --file <file> Path to a JSON file containing the fields to update

Example

ptkl functions update <function-uuid> --data '{"description":"Updated VAT calc"}'

ptkl functions update <function-uuid> --file ./patch.json

ptkl functions signature

Generate the IDL signature a function resolves to in a given environment. Useful for confirming what input/output shape ptkl validate-idl should validate against, or for feeding a typed client generator.

ptkl functions signature <env> <reference>

<env> is the environment to resolve the signature against, e.g. dev or live. <reference> is the function's name, tag, or UUID.

Example

ptkl functions signature dev calculate_vat
ptkl functions signature live calculate_vat --format json

See Also