Console
Platform
Markdown

Bindings & Mounts

Call Databases, Buckets, Queues, Topics, and Email from Workers and Sandboxes over localhost without storing API keys in code.

Bindings let code running inside a Worker instance or a Sandbox call your organization's resources over plain HTTP on localhost (SKOPIK_BINDINGS_URL, also exposed as MH_BINDINGS_URL, at http://127.0.0.1:8090).

A lightweight forwarder inside the guest tunnels connections over the sandbox's private vsock to the host bindings gateway. The host identifies the caller strictly by its sandbox socket — no API keys ever enter the workload.

#Required Header

Every request to SKOPIK_BINDINGS_URL must include the header:

text
mh-bindings: 1

Requests without it are rejected with 400 invalid_request to prevent SSRF attacks against localhost.

#Binding Endpoints

KindAllowed requests under SKOPIK_BINDINGS_URLWith "access": "read"
Database (sql)POST /databases/{binding}/execute, /batch, /queryquery only
Database (documents)PUT, GET, DELETE /databases/{binding}/documents/{id}, POST .../documents, .../documents/bulk, .../documents/queryGET, query only
BucketPUT, GET, HEAD, DELETE /buckets/{binding}/objects/{key}, GET /buckets/{binding}/objectsGET, HEAD, list only
QueuePOST /queues/{binding}/messages, .../messages/batchNot allowed
TopicPOST /topics/{binding}/publish/{topic}, POST /topics/{binding}/credentialsNot allowed
EmailPOST /email/{binding}/sendNot allowed

#Example: Calling Bindings in Code

js
const base = process.env.SKOPIK_BINDINGS_URL
const headers = { 'mh-bindings': '1', 'content-type': 'application/json' }

// Query a SQL database
const dbRes = await fetch(`${base}/databases/DB/query`, {
  method: 'POST',
  headers,
  body: JSON.stringify({ sql: 'SELECT * FROM notes LIMIT 10' }),
})

// Send an email from the declared sender
await fetch(`${base}/email/EMAIL/send`, {
  method: 'POST',
  headers,
  body: JSON.stringify({
    to: 'user@example.com',
    subject: 'Welcome',
    text: 'Your workspace is ready.',
  }),
})

#Bindings & Mounts in Sandboxes

Pass bindings and mounts when creating a Sandbox (they are immutable for the Sandbox's lifetime):

bash
curl -X POST https://api.platform.skopik.com/v1/sandboxes \
  -H "Authorization: Bearer $SKOPIK_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "vcpus": 1,
    "memory_mib": 512,
    "bindings": { "FILES": { "bucket": "datasets", "access": "read" } },
    "mounts": { "/mnt/datasets": { "binding": "FILES" } }
  }'