Endpoints
Expose deployed functions, models, and Rebase Workflows as HTTP endpoints.
Endpoints give deployed Rebase targets stable HTTP routes. A target can still be called through the SDK, while the endpoint provides a direct API surface for agents, services, webhooks, and signed-in workspace users.
Endpoints can point at:
| Target | Default endpoint mode | Use it for |
|---|---|---|
| Function | sync | Low-latency request/response compute. |
| Model | sync | Prediction, optimization, or agent calls over HTTP. |
| Workflow | async | Pipeline entrypoints that may run longer than a normal request. |
An endpoint exposes one target as one route, and Rebase handles auth and run records for it. When you need many routes, your own middleware, or your own auth scheme, deploy an ASGI app instead.
Declare an Endpoint
Attach rb.endpoint(...) to a function, workflow, or model before deploying it:
import rebase as rb
project = rb.project("forecasting")
@project.function(
name="add-numbers",
endpoint=rb.endpoint(method="POST", path="/add"),
)
def add_numbers(a: float = 0, b: float = 0) -> dict:
return {"sum": a + b}
project.deploy()The CLI prints the endpoint URL after deploy when a target has an endpoint. The URL path has this shape:
/e/{workspace_id}/{project_name}/{endpoint_path}If you omit path, Rebase derives one from the endpoint name or target name.
Decorator Form
For standalone targets, use @rb.endpoint with @rb.function or @rb.workflow. When you omit project, the target belongs to the implicit default project.
import rebase as rb
@rb.function(project="forecasting")
@rb.endpoint(method="POST", path="/forecast")
def forecast(zone: str = "SE3", horizon_hours: int = 24) -> dict:
return {"zone": zone, "horizon_hours": horizon_hours}
forecast.deploy()The endpoint decorator can also wrap the already-created Rebase handle:
@rb.endpoint(method="POST", path="/forecast")
@rb.function(project="forecasting")
def forecast(zone: str = "SE3") -> dict:
return {"zone": zone}Models
Models accept the same endpoint config at construction time:
import rebase as rb
class PricePredictor(rb.Predictor):
name = "price-predictor"
def predict(self, zone: str = "SE3") -> dict:
return {"zone": zone, "price_eur_mwh": 42.0}
model = PricePredictor(
project="forecasting",
endpoint=rb.endpoint(method="POST", path="/predict"),
)
model.deploy()Modes
Endpoint mode controls the HTTP response behavior:
| Mode | Behavior |
|---|---|
sync | Create a run, wait for completion, and return the run result or error. |
async | Create and submit a run, then return the run ID and current status immediately. |
Functions and models default to sync. Workflows default to async. Override the default with mode="sync" or mode="async":
@project.workflow(
name="daily-forecast",
endpoint=rb.endpoint(method="POST", path="/daily-forecast", mode="async"),
)
def daily_forecast(zone: str = "SE3") -> dict:
return {"zone": zone}For synchronous endpoints, timeout or timeout_seconds controls how long the API waits for completion before returning the current run state.
Authentication
Endpoint auth is configured per endpoint:
| Auth | Who can invoke it |
|---|---|
api_key | Rebase API keys with endpoints:execute. This is the default and is intended for agents and service-to-service calls. |
workspace | Signed-in workspace users or API keys with endpoints:execute. |
public | Anyone with the URL. |
For default API-key endpoints, create an API key and pass it as a bearer token:
rebase api-key create forecast-agentcurl -X POST "$ENDPOINT_URL" \
-H "Authorization: Bearer rb_..." \
-H "Content-Type: application/json" \
-d '{"zone": "SE3"}'The Toolkit client also reads REBASE_API_KEY:
export REBASE_API_KEY=rb_...
rebase endpoint invoke forecasting/forecast --json '{"zone": "SE3"}'Use auth="workspace" when you want signed-in users to invoke an endpoint through their normal rebase setup credentials:
endpoint=rb.endpoint(method="POST", path="/forecast", auth="workspace")CLI Commands
Common endpoint commands:
rebase endpoint disable forecasting/forecast
rebase endpoint get forecasting/forecast
rebase endpoint invoke forecasting/forecast --json '{"zone": "SE3"}'
rebase endpoint list --project forecasting
rebase endpoint versions forecasting/forecastYou can select endpoints by ID, endpoint name, endpoint path, full URL path, full URL, or project/name. If a selector is ambiguous, use the endpoint ID.
Versioning
Endpoint definitions are stable handles. Deploying a target with an endpoint creates or reuses an endpoint version that records the route, auth mode, target type, target ID, selected target version, and enabled state.
Disabling an endpoint prevents invocation without deleting its history.

