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

# Quickstart

> Sign in, run a Python function, and deploy a web API

This guide shows how to run a Python function on Beam and deploy it as an API.

## Install and Sign In

In your project directory:

```bash theme={null}
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade beam-client
beam login
```

Finish signing in through your browser. Run `beam whoami` to check your workspace.

## Run a Function in the Cloud

Save this as `app.py`:

```python app.py theme={null}
from beam import function


@function(cpu=1, memory="1Gi")
def square(x: int):
    return {"result": x**2}


if __name__ == "__main__":
    print(square.remote(x=12))
```

Run it from the same Python environment:

```bash theme={null}
python app.py
```

Beam runs the function in the cloud and returns `{'result': 144}`.

## Deploy a Web Endpoint

Replace `app.py` with:

```python app.py theme={null}
from beam import endpoint


@endpoint(name="quickstart", cpu=1, memory="1Gi")
def predict(x: int = 12):
    return {"result": x**2}
```

Deploy it and inspect its status:

```bash theme={null}
beam deploy app.py:predict
beam deployment list
```

The command prints a URL and deployment ID. Wait for it to be ready:

```bash theme={null}
beam deployment wait YOUR_DEPLOYMENT_ID --timeout 300
```

## Call the API

Use the URL printed by the deploy command and an API token from [Settings → API Keys](https://platform.beam.cloud/settings/api-keys):

```bash theme={null}
export BEAM_ENDPOINT_URL='YOUR_DEPLOYMENT_URL'
# Set BEAM_TOKEN through your shell or secret manager.
curl -X POST "$BEAM_ENDPOINT_URL" \
  -H "Authorization: Bearer $BEAM_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"x": 12}'
```

The response is `{"result":144}`. Use `beam logs quickstart --follow` to stream logs, or `beam deployment stop YOUR_DEPLOYMENT_ID` to stop it.

<Tip>
  Using a coding agent? Run `beam setup agent` to connect it to your workspace. See [agent setup](/v2/getting-started/add-to-cursor-claude).
</Tip>

## Next Steps

* [Deploy a Dockerfile or container image](/v2/hosting/containers)
* [Add a managed database](/v2/data/databases)
* [Customize your image](/v2/environment/custom-images)
* [Run code in a sandbox](/v2/sandbox/overview)
* [Run a scheduled job](/v2/function/scheduled-job)


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