> For the complete documentation index, see [llms.txt](https://dev.ubidots.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.ubidots.com/ubifunctions/getting-started/creating-an-ubifunction.md). Agents can also search and read this documentation through its [MCP server](https://dev.ubidots.com/~gitbook/mcp).

# Creating an UbiFunction

Create an UbiFunction from the web UI or the Ubidots CLI, and configure it in the General, Invocation and Auth & Environment settings tabs.

You can create and develop UbiFunctions in two ways:

1. **Web UI**: create and edit functions directly in your Ubidots account.
2. **CLI**: create, test and deploy functions locally with full runtime replication. Local development unlocks your preferred IDE and AI-powered tools like Claude Code.

```bash
ubidots functions new --name my-function --runtime python3.11:base
ubidots functions start --methods POST
```

{% hint style="info" %}
See the full [CLI reference for UbiFunctions](https://dev.ubidots.com/sdks/cli/ubifunctions.md) for local development workflows, including push, pull and live testing.
{% endhint %}

## Using the web UI

1. In your Ubidots account, go to **Dev Center > Functions**.
2. Click the **+** button to create a function. The function editor opens.
3. In **Settings > General**, give the function a name, pick a runtime and, if needed, change the max execution time. See [General settings](https://dev.ubidots.com/ubifunctions/getting-started.md#general-settings).

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2Fgit-blob-3a37c3b623d28b75cf0ab7ff503530f14532be47%2Fubifunctions-settings-general.png?alt=media" alt="General tab with the Name, Runtime and Max execution time fields"><figcaption></figcaption></figure>

{% hint style="warning" %}
The name becomes part of the function's URL. If you rename the function later, the URL stays the same.
{% endhint %}

4. In **Settings > Invocation**, choose how the function is called:
   * **Call it from a device or app**: [HTTPS](https://dev.ubidots.com/ubifunctions/invocation/https.md) (pick GET, POST or both, and optionally turn on [Raw function](https://dev.ubidots.com/ubifunctions/invocation/https/raw-functions.md) or [CORS Policy](https://dev.ubidots.com/ubifunctions/invocation/https/cors-policy.md)), [MQTT](https://dev.ubidots.com/ubifunctions/invocation/mqtt.md) or [CoAP](https://dev.ubidots.com/ubifunctions/invocation/coap.md).
   * **Run it automatically**: a [Schedule](https://dev.ubidots.com/ubifunctions/invocation/time-based-trigger.md) or a [Ubidots event](https://dev.ubidots.com/ubifunctions/invocation/ubidots-event.md).
5. In **Settings > Auth & Environment**, choose:
   * the [Token](https://dev.ubidots.com/ubifunctions/auth-and-environment/account-token.md) your code uses to call the Ubidots API;
   * whether callers must send a [Function secret](https://dev.ubidots.com/ubifunctions/auth-and-environment/function-secret.md);
   * the [Environment variables](https://dev.ubidots.com/ubifunctions/auth-and-environment/environment-variables.md) your code can read.
6. Save the function.
7. Open **Code** to write the function. See [Coding an UbiFunction](https://dev.ubidots.com/ubifunctions/getting-started/coding-an-ubifunction.md).

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2Fgit-blob-a29d9760d6110f18892e5288788edcace6008b83%2Fubifunctions-editor-map.png?alt=media" alt="Function editor rail with Code, Settings, Logs and MCP server; Settings has three tabs: General, Invocation and Auth &#x26; Environment"><figcaption></figcaption></figure>

Once the function is saved, you can also expose it to AI agents from the **MCP server** section. See [AI agents tools (MCP)](https://dev.ubidots.com/ubifunctions/ai-agents-tools.md).

## Next steps

{% content-ref url="/pages/-MiTH9aMIyEOH8xcsmfY" %}
[Coding an UbiFunction](https://dev.ubidots.com/ubifunctions/getting-started/coding-an-ubifunction.md)
{% endcontent-ref %}

{% content-ref url="/pages/gGvWTDKqo3b1EAiBbRQL" %}
[Testing an UbiFunction](https://dev.ubidots.com/ubifunctions/getting-started/testing-an-ubifunction.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://dev.ubidots.com/ubifunctions/getting-started/creating-an-ubifunction.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
