> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notte.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Get started

<Tip>
  Read [the Notte skill](https://notte.cc/skill.md) and follow its setup instructions when setting up Notte or building browser automation. This is the shared source for CLI setup, authentication, and the browser-to-code workflow.
</Tip>

[Source: node-sdk/src/functions.ts](https://github.com/nottelabs/notte/blob/main/node-sdk/src/functions.ts)

Cloud function saved in the Notte console, the counterpart of
`notte.Function` in Python.

```ts theme={null}
const fn = client.NotteFunction({ function_id: '<your-function-id>' });
const result = await fn.run({ url: 'https://example.com' });

const created = client.NotteFunction({ path: './scraper.py', name: 'Scraper' });
await created.run(); // uploads scraper.py first
```

## Create NotteFunction

Use [NotteClient.NotteFunction](/typescript-sdk-reference/client/nottefunction) to create this object from your configured client.

```typescript theme={null}
client.NotteFunction(options: FunctionConstructor): NotteFunction;
```

<ParamField body="options" type={"FunctionConstructor"} required />

## Related types

* [FunctionConstructor](/typescript-sdk-reference/types/functionconstructor)

## Usage

* [createRun](/typescript-sdk-reference/function/createrun): Create a cloud run record without starting execution, like `function.create_run()` in Python. Use this only when you need the ID before execution, then pass it to `run(variables, { functionRunId })`. `run()` otherwise creates a new run on its own.
* [run](/typescript-sdk-reference/function/run): Run the function on the cloud and wait for its result, streaming logs by default like `function.run(**variables)` in Python.
* [getRun](/typescript-sdk-reference/function/getrun): Get metadata for a specific function run.
* [download](/typescript-sdk-reference/function/download): Download the function code as a python file. Returns the code, and writes it to `path` when one is provided.
* [getUrl](/typescript-sdk-reference/function/geturl): Get the download URL of the function code, decrypting it when the API returns an encrypted one (Notte managed functions).
* [get](/typescript-sdk-reference/function/get): Get the function metadata together with its download URL, the counterpart of `client.functions.get()` in Python.
* [update](/typescript-sdk-reference/function/update): Upload a new version of the code, mirroring `function.update(path=...)`.
* [updateMetadata](/typescript-sdk-reference/function/updatemetadata): Update the function metadata (name, description, default runtime, ...).
* [delete](/typescript-sdk-reference/function/delete): Delete the function from the Notte console.
* [setSchedule](/typescript-sdk-reference/function/setschedule): Schedule the function to run on a cron expression.
* [deleteSchedule](/typescript-sdk-reference/function/deleteschedule): Remove the function schedule.
* [rollback](/typescript-sdk-reference/function/rollback): Roll the function back to a previous version.
* [updateRun](/typescript-sdk-reference/function/updaterun): Update a run, uploading fields above 1 MiB directly to private storage.
* [runs](/typescript-sdk-reference/function/runs): List the runs of this function.

<Accordion title="Direct constructor reference">
  ```typescript theme={null}
  new NotteFunction(client: NotteClient, options: FunctionConstructor): NotteFunction;
  ```

  <ParamField body="client" type={"NotteClient"} required />

  <ParamField body="options" type={"FunctionConstructor"} required />

  ## Related types

  * [FunctionConstructor](/typescript-sdk-reference/types/functionconstructor)
</Accordion>

<Accordion title="Properties">
  ### decryptionKey

  ```typescript theme={null}
  decryptionKey?: string | undefined
  ```

  ### functionId

  ```typescript theme={null}
  functionId: string
  ```

  The function ID. Throws before a `path`-constructed function has been uploaded.
</Accordion>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.