---
title: "Deploy function"
method: POST
path: "/functions/{function_id}/deploy"
tags: ["Functions"]
---

# Deploy function

`POST /functions/{function_id}/deploy`

Deploy a function to the serverless runtime platform asynchronously. Deployment happens in the background and may take 10-60 seconds.

You'll receive a 202 Accepted response immediately. To check deployment status:
1. Poll GET /functions/{id} to monitor status field
2. Wait for status to change from 'draft' to 'deployed' (success) or 'error' (failure)
3. Check last_deployed_at timestamp to confirm deployment completion

Deployment process:
- For `cloudflare_worker`: Code is deployed to Cloudflare's global edge network
- For `supabase_function`: Code is deployed to Supabase Edge Functions with Deno runtime

Deployment will fail (status='error') if:
- Function code has syntax errors
- Function type is 'supabase_function' but no Supabase project is configured
- Runtime platform API is unavailable

After successful deployment, the function is immediately available for invocation via POST /functions/{id}/invoke.

## Response `202`

Deployment initiated successfully (processing in background)

- FunctionDeployResponse — Async deployment response (HTTP 202 Accepted). Deployment happens in the background and may take 10-60 seconds. Poll GET /functions/{id} to check when status changes from 'draft' to 'deployed' (or 'error' if deployment fails).
  - `message` string, required — Deployment confirmation message
  - `function_id` string, uuid, required — ID of the function being deployed
  - `status` string, required — Deployment status indicator

## Other responses

- `401` — Missing or invalid API key
- `404` — Resource not found
- `422` — Function cannot be deployed

---

[API](https://skmtc.net/kapso/apis/kapso-platform-api.md) · [All operations](https://skmtc.net/kapso/apis/kapso-platform-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kapso/kapso-platform-api/versions/18ff5548a33f/schema)
