Skip to main content

Import Files

POST /api/v1/workspaces/{workspaceId}/storage/import
Content type: multipart/form-data. Max 500 MB per file.
kind
string
default:"folder"
folder · zip · files
file
File
A single zip archive — required when kind is zip.
file[]
File[]
Multiple files (with webkitRelativePath for folder structure) — required when kind is folder or files.
pathPrefix
string
Destination path prefix, e.g. /my-docs/.
imported
number
skipped
number
errors
object[]
{ path, error } for any files that failed to import
fileIds
string[]
curl -X POST https://suite.sundaypyjamas.com/api/v1/workspaces/ws_123/storage/import \
  -H "Authorization: Bearer spj_ai_your_api_key_here" \
  -F "kind=zip" \
  -F "pathPrefix=/imports/" \
  -F "[email protected]"
{ "imported": 12, "skipped": 1, "errors": [], "fileIds": ["file_1", "file_2"] }

Import from GitHub

POST /api/v1/workspaces/{workspaceId}/storage/import/github
Downloads a repository (as a zip) directly from GitHub and imports it into the workspace tree — no local download required.
repoUrl
string
required
https://github.com/owner/repo (.git suffix accepted). Append ?branch=develop to the URL, or use the branch field.
branch
string
Defaults to the repo’s default branch.
pathPrefix
string
Destination path prefix.
imported
number
skipped
number
errors
object[]
fileIds
string[]
repo
string
owner/repo
branch
string
curl -X POST https://suite.sundaypyjamas.com/api/v1/workspaces/ws_123/storage/import/github \
  -H "Authorization: Bearer spj_ai_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{ "repoUrl": "https://github.com/acme/handbook", "branch": "main", "pathPrefix": "/handbook/" }'
{
  "imported": 84,
  "skipped": 0,
  "errors": [],
  "fileIds": ["file_10", "file_11"],
  "repo": "acme/handbook",
  "branch": "main"
}
For private repositories, configure a GitHub token on the workspace (GITHUB_TOKEN / GITHUB_IMPORT_TOKEN) — reach out if you need this enabled for your workspace.

Errors

StatusErrorApplies to
400Zip file is required / No files to importImport
413File "{name}" exceeds the 500 MB upload limitImport
400repoUrl is required / Invalid GitHub repository URLGitHub Import
502GitHub archive fetch failed: {status} {statusText}GitHub Import
401UnauthorizedBoth