UiPath Documentation
functions
latest
false
Functions user guide
  • Overview
    • About Functions
    • Licensing
  • JavaScript functions
    • Getting started
    • Building JavaScript functions
    • HTTP triggers and routing
    • Function context
    • Accessing platform services
    • Testing and debugging
  • Python functions
  • Deploy and run

HTTP triggers and routing

HTTP trigger behavior for JavaScript functions, covering input sources, path parameters, authentication scopes, payload limits, and calling a deployed trigger.

An HTTP function is a JavaScript function that declares a method and a path, in a project whose targetRuntime is javascript-server. It is the backend of a coded app: the app calls the function, and the function holds the credentials and business rules that must never reach the browser.

export default defineFunction({
  name: "get-order",
  method: "GET",
  path: "/orders/:id",
  input: defineSchema<{ id: string }>(),
  handler: async (input, ctx) => fetchOrder(input.id),
});
export default defineFunction({
  name: "get-order",
  method: "GET",
  path: "/orders/:id",
  input: defineSchema<{ id: string }>(),
  handler: async (input, ctx) => fetchOrder(input.id),
});

The supported methods are:

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE

Where the input comes from​

MethodRequest data read as input
GETThe query string
POST, PUT, PATCH, DELETEThe JSON request body

Path parameters are merged in as well, so /orders/:id supplies id alongside the rest of the input. Every path parameter must be declared in the input type: the derived schema is closed, so an undeclared one is rejected as an unknown property.

Path parameters merge underneath the body, so a body field of the same name wins. Distinct names avoid a silent override.

Path parameters​

PatternMatches
:paramExactly one segment — /users/:id matches /users/42
:param{regex}One segment, constrained — /users/:id{[0-9]+}
:param?The segment, or nothing — /list/:filter? matches /list and /list/open
*A trailing catch-all, including the bare prefix

Values are also available as strings on ctx.params, keyed by name. More specific routes win regardless of declaration order, so a literal /users/me takes precedence over /users/:id. Routing behaves identically in a local serve and when deployed.

Calling a deployed trigger​

Publishing and deploying the package creates an Orchestrator HTTP trigger for each function, at its path. The caller sends a bearer token, and the function receives the caller's identity as ctx.user.

From a coded app, call the function by name with the Functions service of the UiPath TypeScript SDK:

import { Functions } from "@uipath/uipath-typescript/functions";

const orders = await new Functions(sdk).invoke({ name: "list-orders" }, { status: "open" }, { folderId });
import { Functions } from "@uipath/uipath-typescript/functions";

const orders = await new Functions(sdk).invoke({ name: "list-orders" }, { status: "open" }, { folderId });

Functions.invoke() calls functions whose path has no parameters. Give a function that a coded app calls a fixed path, and pass the values as input.

Authentication​

Callers authenticate with a bearer token from an External Application. Register a coded app's External Application with OR.Jobs, which lets the app find and call the function, plus the scopes of anything else the app calls:

uip admin external-apps create "My App" \
  --non-confidential \
  --redirect-uri "https://<org>.uipath.host/my-app" \
  --user-scope "OR.Execution,OR.Folders.Read,OR.Jobs"
uip admin external-apps create "My App" \
  --non-confidential \
  --redirect-uri "https://<org>.uipath.host/my-app" \
  --user-scope "OR.Execution,OR.Folders.Read,OR.Jobs"

Request the same scopes in the coded app's uipath.json.

Each user of the app also needs two permissions in the function's folder: Triggers View (Schedules.View), to find the function, and Jobs Create (Jobs.Create), to call it.

Payload limits​

The request and the response of an HTTP function are both limited.

DirectionLimitPast the limit
Request10,000 characters of serialized input500, with errorCode 4801 and the message JobArguments length should be less than 10000 characters
ResponseAbout 512 KBThe call fails

When a payload can exceed either limit, make the function a job function. A job carries large input and output as attachments. See Invoking functions.

Tip:

Returning a reference rather than the data itself — a storage bucket path, or an identifier the caller fetches separately — keeps the limits from constraining the design.

Next steps​

Was this page helpful?

Connect

Need help? Support(opens in new window)

Want to learn? UiPath Academy(opens in new window)

Have questions? UiPath Forum(opens in new window)

Stay updated