# Creating an UbiFunction

You can create and develop UbiFunctions in two ways:

1. **Web UI** — Create and edit functions directly in your Ubidots account, as described below.
2. **CLI** — Create, test, and deploy functions locally with full runtime replication. Developing locally unlocks the power of 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) for local development workflows including push, pull, and live testing.
{% endhint %}

## Using the Web UI

1. In your Ubidots account, go to the "**Devices**" tab and select "**Functions**".

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FhC9YNnHQi8juiu0FW6jP%2Fimage.png?alt=media&#x26;token=a8aead75-45d6-4377-8de1-65b7e1296576" alt=""><figcaption></figcaption></figure>

2. Click the "+" icon to create your first UbiFunction:<br>

   <figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FnDxkB7Bmc9CwV9KXsUo5%2Fimage.png?alt=media&#x26;token=0027695d-48e0-4c00-94dc-fffd37b7f9fe" alt=""><figcaption></figcaption></figure>
3. Give the function a name.

{% hint style="warning" %}
The name of your function will become part of its URL. If you rename the function, the URL will keep the same.
{% endhint %}

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FFq39xTJIarV0ydDV2cIC%2Fimage.png?alt=media&#x26;token=1fb81b52-6a19-4707-86a4-5716b0a0219f" alt=""><figcaption></figcaption></figure>

Type the name for this ubifunction in the corresponding field:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FczpZLNfB6DkiCWXzvIFs%2Fimage.png?alt=media&#x26;token=a7ff8a36-fe6a-4b67-9fe6-5280f27b2dae" alt=""><figcaption></figcaption></figure>

4. Scroll down to the *Runtime* option and select the runtime that you require:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FeVplind9SkvXK5Zk9qQO%2Fimage.png?alt=media&#x26;token=838c6759-fe25-4d13-96dd-75846302895d" alt=""><figcaption></figcaption></figure>

5. scroll down to the *HTTP Method* section and select the HTTP method that this function will allow:

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FQNGb49ogOUqKpfHA0lz8%2Fimage.png?alt=media&#x26;token=b943349e-d967-4c0b-8746-6e1d5219af82" alt=""><figcaption></figcaption></figure>

6. Other configuration options:

* **Token**: select a token from your account to use in your function code.
* **Environmental variables**: select one or more environmental variables from the [Global Properties](https://help.ubidots.com/en/articles/9265555-ubifunctions-using-global-properties) of your account to use in the function code.
* **Max. execution time**: the maximum time your function takes to execute all the code.
* **Time-based trigger**: create a cron UbiFunction based on a time interval or a Crontab expression.
* **Raw function**: HTTP headers and URL paths will be passed to the function. "Content-Type" can be different than "application/json". Custom response codes can be returned from the function.
* **CORS Policy**: Enables calling this function from web browser's URLs different than parse.ubidots.com.

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FlEnOLYmgjInJCDJ6rbzG%2Fimage.png?alt=media&#x26;token=eaea5cf0-858a-4f83-94c0-236b613fee03" alt=""><figcaption></figcaption></figure>

7. Scroll down to the bottom of the page and hit the *SAVE* button to save these settings.

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FSy732avMvWzfKB7zxKBC%2Fimage.png?alt=media&#x26;token=85d76fa9-8614-4002-b962-cb6903672858" alt=""><figcaption></figcaption></figure>

<figure><img src="https://884329393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MhzNRg0B4ECiNXc093G%2Fuploads%2FXqSy7hLVqOj002Lzptuy%2Faaaaa.gif?alt=media&#x26;token=78f1d12e-87d0-4e00-a0a9-bb2722eae80e" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
