API REFERENCE
Upload Files
On this page
/api/sandboxes/filesUpload one or more files to the authenticated account's sandbox GitHub repository. Accepts an array of file URLs and commits each file to the specified directory path within the repository. Supports submodule resolution — if the target path falls within a git submodule, the file is committed to the submodule's repository. Authentication is handled via the x-api-key header or Authorization Bearer token.
Authentication
See the authentication guide for API key and account access requirements.
Request
curl --request POST \
--url 'https://api.recoupable.dev/api/sandboxes/files' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"files": [
{
"url": "https://example.com/files/album-cover.png",
"name": "album-cover.png"
}
]
}'Request body required
JSON body containing file URLs and target path
application/json
pathstringThe target directory path within the repository to upload files to. Defaults to the repository root if omitted.
filesarray<object>requiredArray of files to upload, each with a URL and target filename
Item properties for files
urlstringrequiredThe URL of the file to upload
format: uri
namestringrequiredThe filename to use when committing to the repository
messagestringOptional commit message. Defaults to 'Upload files via API'.
Responses
200Files uploaded successfully+
application/json
statusstring · enumrequiredStatus of the operation
Values: "success"
uploadedarray<object>requiredArray of uploaded file details
Item properties for uploaded
pathstringThe full path of the uploaded file in the repository
shastringThe git SHA of the created/updated file
400Bad request - missing files or invalid path+
application/json
errorstringrequiredError message describing what went wrong
401Unauthorized - invalid or missing API key+
application/json
errorstringrequiredError message describing what went wrong
403Forbidden - account does not have access+
application/json
errorstringrequiredError message describing what went wrong
404Not found - no snapshot or no github_repo configured+
application/json
errorstringrequiredError message describing what went wrong
Full specification
Download the OpenAPI file for complete schemas, constraints, and examples.
Download content.jsonView operation source
{
"description": "Upload one or more files to the authenticated account's sandbox GitHub repository. Accepts an array of file URLs and commits each file to the specified directory path within the repository. Supports submodule resolution — if the target path falls within a git submodule, the file is committed to the submodule's repository. Authentication is handled via the x-api-key header or Authorization Bearer token.",
"requestBody": {
"description": "JSON body containing file URLs and target path",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadSandboxFilesRequest"
}
}
}
},
"responses": {
"200": {
"description": "Files uploaded successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadSandboxFilesResponse"
}
}
}
},
"400": {
"description": "Bad request - missing files or invalid path",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SandboxErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized - invalid or missing API key",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SandboxErrorResponse"
}
}
}
},
"403": {
"description": "Forbidden - account does not have access",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SandboxErrorResponse"
}
}
}
},
"404": {
"description": "Not found - no snapshot or no github_repo configured",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SandboxErrorResponse"
}
}
}
}
}
}