---
title: "Create binding"
method: POST
path: "/api/v1/functions/{function_id}/bindings"
tags: ["Functions"]
---

# Create binding

`POST /api/v1/functions/{function_id}/bindings`

Wire a Raff-managed resource into the function. A binding mints a
scoped credential (its own database role / S3 key — independent of the
resource's main credentials) and injects it as read-only system env
vars (`{PREFIX}_URL`, `{PREFIX}_HOST`, … for databases;
`{PREFIX}_ENDPOINT`, `{PREFIX}_ACCESS_KEY`, … for buckets). Database
bindings connect over Raff's private service fabric — traffic never
leaves the platform network. Live functions roll a zero-downtime
config redeploy.

## Path parameters

- `function_id` string, required

## Request body

- CreateFunctionBindingRequest
  - `binding_type` 'database' | 'bucket', required
  - `resource_id` string, uuid, required — A managed database or Object Storage bucket you own
  - `env_prefix` string — Env key prefix (default DATABASE / STORAGE)

## Response `200`

Binding created

- object
  - `success` boolean
  - `data` object
    - `binding` FunctionBinding
      - `id` string, uuid
      - `binding_type` 'database' | 'bucket'
      - `resource_id` string, uuid
      - `resource_name` string
      - `env_prefix` string
      - `injected_keys` string[]
      - `status` 'provisioning' | 'active' | 'rotating' | 'error' | 'deleting'
      - `status_message` string
      - `created_at` string, date-time

## Other responses

- `400` — Invalid request parameters
- `401` — Authentication required

## Changes

> 28 revisions in range; 18 could not be searched.

- **2026-08-20** `efd3c11c5c92` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/rafftechnologies/apis/raff-api/changes/api/v1/functions/:function_id/bindings/post.md)

---

[API](https://skmtc.dev/rafftechnologies/apis/raff-api.md) · [All operations](https://skmtc.dev/rafftechnologies/apis/raff-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/rafftechnologies/raff-api/revisions/2f4df56be77c/schema)
