Skip to main content

UDFs

A UDF record holds the Python source (udf_body), a slug, and its placement on a canvas. These endpoints manage the records; to execute a UDF see Running UDFs.

The UDF object

FieldTypeDescription
idstringUDF id
slugstringURL-safe name, unique within a canvas
udf_bodystringThe UDF source and metadata
collection_idstring | nullCanvas the UDF belongs to
collection_namestring | nullCanvas name
is_visiblebooleanWhether the UDF is shown on its canvas
positionintegerOrdering on the canvas
udf_body_hashstringHash of udf_body, for change detection
last_updatedstringLast modification timestamp
owning_userobject | nullOwner summary

List your UDFs

GET /udf/self

Scope: user

Query parameters

ParameterTypeDescription
skipintegerOffset. Default 0.
limitintegerPage size. Default 300.

List your team's UDFs

GET /udf/exec-env/self

Scope: environment

Every UDF in your execution environment. Accepts the same query parameters. This is the listing to use with a service account token.

Get a UDF

GET /udf/by-id/{udf_id}

Scope: public or authorized — public UDFs are readable with no credentials; private ones require access.

Returns the UDF object.

By name

Several addressing schemes resolve a UDF without knowing its id:

EndpointScopeResolves
GET /udf/exec-env/self/by-collection/{canvas_name}/by-slug/{slug}environmentA UDF on one of your team's canvases
GET /udf/by-user-handle/{handle}/by-collection/{canvas_name}/by-slug/{slug}user or environmentA UDF owned by a user, addressed by handle
GET /udf/by-user-email/{email}/by-collection/{canvas_name}/by-slug/{slug}user or environmentThe same, addressed by email

Each has a variant without /by-collection/{canvas_name} that resolves the slug on the owner's default canvas.

By shared token

GET /udf/shared/by-token/{token}

Scope: by token.

Returns the UDF a shared token points at. This is how fused.load("fsh_…") resolves a token to code.

Create a UDF

POST /udf/new

Scope: user

Body

FieldTypeRequiredDescription
slugstringYesURL-safe name
udf_bodystringYesThe UDF source and metadata
udf_typestringYesUse auto
collection_idstringNoCanvas to add the UDF to
create_shared_tokenbooleanNoAlso mint a shared token. Default false.
shared_token_access_scopestringNopublic or team. Default team.

Returns the created UDF object; when create_shared_token is true it also includes shared_token.

Update a UDF

POST /udf/by-id/{udf_id}

Scope: user

Send only the fields you want to change: slug, udf_body, or collection_id. Returns the updated UDF object.

Delete a UDF

DELETE /udf/by-id/{udf_id}

Scope: user

warning

Deleting a UDF breaks any shared token or URL pointing at it. Cached results are not served after deletion.

See also