Skip to main content

REST API Reference

Bossa exposes a REST API for all filesystem operations. Use it when MCP isn’t available or when building custom integrations. Base URL: https://bossamemory.com/api/v1 Authentication: Authorization: Bearer YOUR_API_KEY or X-API-Key: YOUR_API_KEY

Endpoints

Create or Overwrite a File

POST /api/v1/files
Content-Type: application/json
Body:
{
  "path": "/docs/readme.md",
  "content": "# Hello\n\nThis is the content."
}
Response: 200{"path": "/docs/readme.md", "content": "..."}

Bulk Create/Overwrite Files

POST /api/v1/files/bulk
Content-Type: application/json
Body:
{
  "files": [
    {"path": "/a.txt", "content": "content a"},
    {"path": "/b.txt", "content": "content b"}
  ]
}
  • Max 100 files per request.
  • Parent folders are created automatically.
Response: 200{"created": 2, "updated": 0, "failed": []}

Read a File

GET /api/v1/files?path=/docs/readme.md
Response: 200{"path": "/docs/readme.md", "content": "..."} Errors: 404 if file not found

List Directory

GET /api/v1/files/list?path=/&metadata=false
Query:
ParamDefaultDescription
path/Directory path
metadatafalseIf true, return {name, type, size?, modified?} per item
Response: 200 — Without metadata: {"items": ["customers/", "docs/", "readme.txt"]}. With metadata=true: {"items": [{"name": "docs/", "type": "directory"}, {"name": "readme.txt", "type": "file", "size": 1024, "modified": "2026-03-06T10:00:00Z"}]}. Directories end with /.

Stat (File Metadata)

GET /api/v1/files/stat?path=/docs/readme.md
Response: 200{"path": "/docs/readme.md", "size": 1024, "modified": "2026-03-06T10:00:00Z", "created": "2026-03-01T08:00:00Z"}. 404 if not found.

Tree

GET /api/v1/files/tree?path=/&depth=2
Query: path (default /), depth (optional, limits recursion). Response: 200{"tree": " a/\n b/\n file.txt"}

Disk Usage

GET /api/v1/files/du?path=/
Response: 200{"usage": [{"path": "/", "size": 4096}, {"path": "/docs", "size": 2048}]}

Batch Operations

POST /api/v1/files/batch
Content-Type: application/json
Body:
{
  "ops": [
    {"op": "read", "path": "/docs/api.md"},
    {"op": "write", "path": "/output/summary.md", "content": "..."},
    {"op": "delete", "path": "/temp.txt"}
  ]
}
Max 100 ops per request. Response: 200{"results": [{"op": "read", "path": "...", "content": "..."}, ...]}

Search (Grep)

POST /api/v1/files/search
Content-Type: application/json
Body:
{
  "pattern": "Enterprise",
  "path": "/customers",
  "regex": false,
  "case_sensitive": false,
  "whole_word": false,
  "max_matches": 100,
  "offset": 0,
  "output_mode": "matches",
  "all_of": [],
  "any_of": [],
  "none_of": [],
  "context_before": 0,
  "context_after": 0
}
FieldTypeDefaultDescription
patternstringLiteral or regex pattern
pathstring/Scope to subtree
regexboolfalseTreat pattern as regex
case_sensitiveboolfalseCase-sensitive match
whole_wordboolfalseMatch whole words only
max_matchesint100Max results to return
offsetint0Pagination offset
output_modestringmatchesmatches | files_with_matches | count
all_ofstring[][]All must appear on same line (AND)
any_ofstring[][]Any must appear (OR)
none_ofstring[][]None may appear (exclude)
context_beforeint0Lines before each match
context_afterint0Lines after each match
At least one of pattern, all_of, any_of, or none_of is required. Response: 200 — Depends on output_mode:
  • matches: {matches: [{path, line_number, line, context_before, context_after}], has_more, next_offset}
  • files_with_matches: {files: ["/path/a.md", "/path/b.md"]}
  • count: {count: 42, total_matches: 42}

GET /api/v1/files/glob?pattern=*.md&path=/
Query:
ParamDefaultDescription
patternGlob pattern (e.g. *.md, **/*.py)
path/Directory to scope search
Response: 200{"paths": ["/docs/a.md", "/docs/b.md"]}

Edit a File

PATCH /api/v1/files
Content-Type: application/json
Body:
{
  "path": "/config.json",
  "old_string": "\"debug\": false",
  "new_string": "\"debug\": true",
  "replace_all": false
}
FieldTypeDefaultDescription
pathstringFile path
old_stringstringSubstring to replace
new_stringstringReplacement
replace_allboolfalseIf true, replace all occurrences; else first only
Replaces the first occurrence of old_string with new_string. Response: 200{"path": "/config.json", "edited": true} Errors: 404 if file not found or old_string not in file

Delete a File

DELETE /api/v1/files?path=/docs/old.txt
Response: 200{"path": "/docs/old.txt", "deleted": true} Errors: 404 if file not found

Usage

GET /api/v1/usage
Returns current usage and limits for the account associated with the API key. Response: 200{"storage_mb": 12.5, "files_count": 42, "requests_today": 156, "tier": "free", "limits": {"storage_mb": 100, "files": 500, "requests_per_day": 1000}} See Pricing & Limits for tier details.

Billing

Create Checkout Session

POST /api/v1/billing/checkout?interval=month
Authorization: Bearer <JWT>
Creates a Stripe Checkout session for Pro subscription. Requires JWT (from bossa login), not API key. Query: intervalmonth (default) or year Response: 200{"checkout_url": "https://checkout.stripe.com/..."} Redirect the user to checkout_url to complete payment. See Pricing & Limits.

Create Portal Session

POST /api/v1/billing/portal
Authorization: Bearer <JWT>
Creates a Stripe Customer Portal session for managing subscription (update payment, view invoices, cancel). Requires JWT (from bossa login), not API key. Response: 200{"url": "https://billing.stripe.com/..."} Redirect the user to url to manage their subscription. Returns 400 with "No billing account. Run 'bossa billing upgrade' first." if the user has no Stripe customer. Returns 503 if billing is not configured.

Public Endpoint

Health Check

GET /health
No authentication required. Returns 200 with {"status": "ok"}.

Error Responses

CodeMeaning
401Missing or invalid API key
402Usage limit exceeded (storage, files, requests, or workspaces). Upgrade for higher limits.
404File or path not found
400Invalid request (e.g. empty body, validation error)
413Batch size exceeds 100 files
Last modified on March 13, 2026