---
title: "Redeploy a backend function"
method: POST
path: "/api/apps/{app_id}/coding/redeploy-function/{function_name}"
---

# Redeploy a backend function

`POST /api/apps/{app_id}/coding/redeploy-function/{function_name}`

## Request

- Base URL: `https://app.base44.com`
- URL: `https://app.base44.com/api/apps/{app_id}/coding/redeploy-function/{function_name}`
- Auth: HTTP bearer

<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Deploys the code you send as one of the app's backend functions and saves it as that function's source, the same way **Save & Redeploy** does in the app editor.

The function is deployed from the `code` in the request, not from the source already stored in the app. To redeploy a function unchanged, send its current source. The deploy runs even when the code is identical, which is how you recover a function whose deployment is missing or out of date. A name that no function has yet creates a new function.

The request waits for the deploy to finish, and fails with the compiler's diagnostics when the code doesn't build. An app runs one deploy at a time. If another deploy for the app is still running after a short wait, the call is rejected and is safe to retry.

Backend functions need a Builder plan or higher on the app's workspace. If the app has no backend functions yet, the first redeploy sets them up.

The deploy always lands on the app's main line, and is rejected while main is protected.

The published app keeps running the previous version of the function until you publish the app again. Automations and workflows run the redeployed version right away.

This is limited to 50 requests a minute per caller for each app. Some workspaces have a different limit.

The response is the app document as it stands after the change, the same shape [Get app](/api-reference/get-app) returns.

<Note>This endpoint accepts a personal API key belonging to a user with editor access to the app. A read-only key is refused, and workspace API keys are not accepted.</Note>

<Warning>The response includes fields beyond the ones documented here. Don't rely on undocumented response fields, as they can change at any time. Send only the fields documented here. Other request fields are not supported and their behavior can change.</Warning>

## Path parameters

- `function_name` string, required: Name of the backend function, as a path under `functions/`. Send the bare name, the name with its file extension, or the name followed by `/entry.ts`. Nested functions have slashes in their name, and you send those as they are.
- `app_id` string, required: ID of the app whose code to change.

## Request body

- RedeployFunctionPayload
  - `code` string, required: Full source of the function to deploy and save.

## Response `200`

The app after the deploy.

- UserApp
  - `id` string: ID of the app.
  - `created_date` string, date-time: Time the app was created, as a UTC timestamp in ISO 8601 format.
  - `updated_date` string, date-time: Time the app document was last written, as a UTC timestamp in ISO 8601 format.
  - `created_by` string, nullable: Email of the user who created the app.
  - `organization_id` string, nullable: ID of the workspace the app belongs to.
  - `app_type` string: Kind of app, set when it's created. One of `user_app` (a web app), `user_agent` (an AI agent), `mobile_app` (a native mobile app), `user_game` (a game), `slide` (a presentation), or `imported_app` (an app imported from an existing code repository). List apps returns it as stored, so an older agent app can report `agent` instead of `user_agent`, and some older apps don't include it. Get app always returns one of the values above.
  - `name` string: Display name of the app.
  - `user_description` string, nullable: Description of the app, or `null` if none was set. An app created without a `name` gets a generated description once a build turn changes it.
  - `logo_url` string, nullable: URL of the app's logo, or `null` if it has none. Set it with [Set app logo](/api-reference/set-app-logo) or [Generate app logo](/api-reference/generate-app-logo).
  - `social_image_url` string, nullable: URL of the image shown when the app is shared on social platforms, or `null` if none was set, in which case the logo is shown instead. Set it with [Set social image](/api-reference/set-social-image).
  - `public_settings` 'private_with_login' | 'public_with_login' | 'public_without_login' | 'workspace_with_login': Who can open the published app. Each value is described under [Update app](/api-reference/update-app), which also changes it.
  - `auth_config` AuthConfiguration: Authentication configuration for user applications
    - `enable_username_password` boolean: Whether people can sign in to the app with an email and password.
    - `enable_google_login` boolean: Whether people can sign in to the app with a Google account.
    - `enable_microsoft_login` boolean: Whether people can sign in to the app with a Microsoft account.
    - `enable_facebook_login` boolean: Whether people can sign in to the app with a Facebook account.
    - `enable_apple_login` boolean: Whether people can sign in to the app with an Apple account.
  - `hide_entity_created_by` boolean: Whether the app's entity records leave out the email of the user who created each one (`created_by`). Newer apps always leave the email out, whatever this is set to.
  - `is_remixable` boolean: Whether others can remix the app. While it's `true`, the published app also shows the Base44 badge if `public_settings` is `public_with_login` or `public_without_login`.
  - `main_branch_protected` boolean: Whether the app's main branch is protected, so changes to main must go through a branch that's merged back. Always `true` for imported apps. Change it with [Set main branch protection](/api-reference/set-main-branch-protection).
  - `slug` string, nullable: URL slug for the app, auto generated from the name and app ID or set to a custom value, or `null` if the app has no slug yet. The published URL is built from it.
  - `is_unpublished` boolean: Whether the app was taken offline with [Unpublish app](/api-reference/unpublish-app) and hasn't been published again since. While it's `true`, the published URL is offline and `last_deployed_at` still shows the last publish.
  - `last_deployed_at` string, date-time, nullable: Time the app was last published, as a UTC timestamp in ISO 8601 format, or `null` if it has never been published.
  - `screenshot_url` string, nullable: URL of a screenshot of the published app. Captured shortly after each publish, so it can briefly lag or be `null` right after publishing.
  - `preview_screenshot_url` string, nullable: URL of a preview screenshot taken before publishing, distinct from `screenshot_url`, or `null` if none has been captured.
  - `owner_id` string, nullable: ID of the user who owns the app. It starts as the creator and changes when ownership is transferred.
  - `status` StatusObject: The app's current build status.
    - `state` 'ready' | 'processing' | 'error', required: Where the app is in its build lifecycle. Ready means idle with no build in progress, processing means the app is being generated or modified, and error means the last build failed. This tracks building, not publishing.
    - `details` string, nullable: Human readable note about the current state, such as what is being processed or why it failed, or `null` when there is nothing to report.
    - `request_id` string, nullable: ID of the request that last changed the status, or `null` if the status has never changed. Useful when reporting an issue.
    - `last_updated_date` string, date-time, nullable: Time the status was last updated, as a UTC timestamp in ISO 8601 format.
    - `error_source` string, nullable: Where the failure originated when `state` is `error`, or `null` otherwise. A value of `paywall` means the work was blocked because the app's workspace has no credits left.
    - `paywall_context` PaywallStatusContext
      - `billing_organization_id` string, required: ID of the billing organization the paywall was evaluated against.
      - `user_id` string, required: ID of the user the paywall was evaluated for.
      - `evaluated_at` string, date-time, required: Time the paywall condition was evaluated, as a UTC timestamp in ISO 8601 format.
  - `dev_environment_enabled` boolean: Whether test data is on, which gives the app a test database next to its live one.

## Other responses

- `400`: `function_name` is empty, isn't a valid function name, or points at one of the app's frontend files instead of a backend function.
- `401`: Missing or invalid credentials.
- `403`: You don't have editor access to this app, your API key is read-only, or you used a workspace API key. Backend functions also need a Builder plan or higher on the app's workspace.
- `404`: App not found.
- `409`: The app's main line is protected, the app moved to another workspace during the deploy, or another deploy for the app is still running.
- `422`: The body has no `code`, or the code was rejected or failed to build. A build failure carries the compiler diagnostics in the detail.
- `429`: Too many redeploys for this app from you in the last minute.
- `503`: `deployment_temporarily_unavailable`: the app's backend functions are being upgraded to a new runtime and the upgrade didn't finish. Nothing was deployed. Retry after a few minutes.

## Changes

> 58 revisions in range; 1 not diffed.

- **2026-10-12** `5e139db2e643`: 1 info
  - the endpoint scheme security `PersonalAccessTokenAuth` was added to the API
- **2026-10-09** `fc604cdcc3a2`: 2 breaking, 4 warning, 32 info
  - the `auth_config` response's property type changed from no type to `object` for status `200`
  - the `status` response's property type changed from no type to `object` for status `200`
  - added the new `private_with_login` enum value to the `public_settings` response property for the response status `200`
  - added the new `public_with_login` enum value to the `public_settings` response property for the response status `200`
  - …34 more
- **2026-10-08** `e88c0b4186ed`: 1 info
  - added the non-success response with the status `503`
- **2026-09-30** `cbaf216bfb03`: 1 warning
  - removed the optional property `first_prompt_model_comparison` from the response with the `200` status
- **2026-09-28** `347e2afcf94a`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/adexad/apis/base44-app-management-api/changes/api/apps/:app_id/coding/redeploy-function/:function_name/post.md)

---

[API](https://skmtc.dev/adexad/apis/base44-app-management-api.md) · [All operations](https://skmtc.dev/adexad/apis/base44-app-management-api/llms.txt) · [OpenAPI document](https://skmtc.dev/adexad/apis/base44-app-management-api/revisions/fa29e915c226?raw)
