Files
Write files
Batch-write up to 200 files into a running session. `encoding` controls how `content` is interpreted: `text` (default): `content` is a UTF-8 string. The server base64-encodes it before forwarding. The gate measures the base64 string size (12 MB limit), so UTF-8 content is capped at approximately 9 MB (its base64 form must fit within 12 MB). `base64`: `content` is standard-padded base64, up to 12 MB. The 12 MB base64 string represents approximately 9 MB of decoded data. Both modes cap file content at roughly 9 MB. Split larger files across multiple writes.
/projects/{projectId}/sessions/{sessionId}/filesHTTP client
Set up your HTTP client with the auth header before calling the API. Match the authentication type shown above.
const BASE_URL = 'https://api.mudbase.dev/api/sandboxes';
const HEADERS = {
'x-api-key': 'sk_YOUR_API_KEY',
'Content-Type': 'application/json',
};const BASE_URL = 'https://api.mudbase.dev/api/sandboxes';
const HEADERS = {
'x-api-key': 'sk_YOUR_API_KEY',
'Content-Type': 'application/json',
};Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const res = await fetch('https://api.mudbase.dev/api/sandboxes/projects/YOUR_PROJECT_ID/sessions/YOUR_SESSION_ID/files', {
method: 'POST',
headers: HEADERS,
body: JSON.stringify({
"files": [
{
"path": "capacitor calculate",
"content": "interface input",
"encoding": "base64"
}
]
}),
});
const data = await res.json();const res = await fetch('https://api.mudbase.dev/api/sandboxes/projects/YOUR_PROJECT_ID/sessions/YOUR_SESSION_ID/files', {
method: 'POST',
headers: HEADERS,
body: JSON.stringify({
"files": [
{
"path": "capacitor calculate",
"content": "interface input",
"encoding": "base64"
}
]
}),
});
const data = await res.json();Playground
liveTest this endpoint with your own credentials. Your requests will be sent to the live API.
No Request Yet
Send a request to see the full inspector
Authentication
X-API-Key: YOUR_KEY header (server-to-server, SDKs). View authentication guide →Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | - |
sessionId | string | Yes | - |
Request Body
{
"files": [
{
"path": "capacitor calculate",
"content": "interface input",
"encoding": "base64"
}
]
}{
"files": [
{
"path": "capacitor calculate",
"content": "interface input",
"encoding": "base64"
}
]
}