Documentation

Git

Every project has a Git repository. Push files, download the repo and read its history over HTTPS with your API key. No git credentials to manage.

Push files

# Single file
curl -X POST $API/{slug}/git/files \
  -H "X-API-Key: $KEY" \
  -d '{"path": "src/app.js", "content": "console.log(\"hello\")", "message": "Add app.js"}'

# Batch: up to 500 files in one atomic commit, deployed after the push
curl -X POST $API/{slug}/git/files/batch \
  -H "X-API-Key: $KEY" \
  -d '{
    "files": [
      {"path": "index.html", "content": "<h1>Hello</h1>"},
      {"path": "style.css",  "content": "body { margin: 0; }"}
    ],
    "message": "Initial commit",
    "deploy": true
  }'

Plain-text content is base64-encoded for you. "deploy": true starts a deploy once the commit lands; see Deployment.

Download the repo

Working on a project you don't have on disk? Download it with your key instead of cloning:

curl -L "$API/{slug}/git/archive" -H "X-API-Key: $KEY" -o {slug}.zip
unzip {slug}.zip
# unpacks into ./{slug}-main/
# options: ?ref=<branch, tag or sha> (default main), &format=tar.gz (default zip)

Edit locally, then push the changes back with POST /{slug}/git/files/batch.

Read history, files and diffs

Every read takes an optional ref: a branch, tag or commit SHA, main by default.

# Commit history, newest first (limit up to 50; add &path=src/app.js for one file)
curl "$API/{slug}/git/commits?limit=20&page=1" -H "X-API-Key: $KEY"

# One commit: changed files and line stats; diff=true adds the unified diff (up to 1 MB)
curl "$API/{slug}/git/commits/{sha}?diff=true" -H "X-API-Key: $KEY"

# A file, or a directory listing, at any ref
curl "$API/{slug}/git/files?path=src/app.js&ref={sha}" -H "X-API-Key: $KEY"

# Every path in the repo in one call (up to 10,000 entries)
curl "$API/{slug}/git/tree?ref=main" -H "X-API-Key: $KEY"

Collaborators

curl -X POST $API/{slug}/collaborators \
  -H "X-API-Key: $KEY" \
  -d '{"email": "teammate@company.com", "permission": "write"}'

curl $API/{slug}/collaborators -H "X-API-Key: $KEY"
curl -X DELETE $API/{slug}/collaborators/teammate@company.com -H "X-API-Key: $KEY"

Collaborators push code to the repository. Domains stay with the project's owner: see Domains.

Push with git

If your git.mosaic.site account has a password, the usual workflow works too. With auto_deploy on, each push deploys.

git clone https://git.mosaic.site/{username}/{slug}.git
cd {slug}
git add . && git commit -m "My app" && git push

Endpoints

EndpointMethodDescription
/{slug}/git/filesPOSTPush one file
/{slug}/git/files/batchPOSTPush up to 500 files ("deploy": true to deploy)
/{slug}/git/archiveGETThe whole repo as one download (ref, format=zip|tar.gz)
/{slug}/git/commitsGETCommit history (ref, path, limit up to 50, page)
/{slug}/git/commits/{sha}GETOne commit and its changed files (diff=true for the diff)
/{slug}/git/filesGETRead a file or list a directory at any ref
/{slug}/git/treeGETEvery path in the repo at a ref
/{slug}/collaboratorsGET POSTList or add collaborators
/{slug}/collaborators/{email}DELRemove a collaborator