Skip to main content
GET
/
api
/
v1
/
tasks
/
{runId}
/
files
/
diff
curl 'https://agent.blackbox.ai/api/v1/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890/files/diff' \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "diff": "diff --git a/README.fr.md b/README.fr.md\nnew file mode 100644\nindex 0000000..a1b2c3d\n--- /dev/null\n+++ b/README.fr.md\n@@ -0,0 +1,10 @@\n+# Bienvenue\n+\n+Ceci est le README en français.\n+\n+## Installation\n+\n+```bash\n+npm install\n+```\n",
  "path": "/vercel/sandbox",
  "hasGit": true,
  "base": "initial"
}
This endpoint returns a unified git diff of all changes made by the agent in the sandbox workspace. If the workspace is a git repository, it produces a proper git diff output. For non-git workspaces, it falls back to a pseudo-diff listing all file contents.

Authentication

To use this API, you need a BLACKBOX API Key. Follow these steps to get your API key:
  1. Go to app.blackbox.ai/agent-api and click Get an API Key (requires a Pro subscription)
  2. Once provisioning completes, you will be redirected to your Dashboard
  3. From the Dashboard, create an API key to use with all Agent API requests
Your API key will be in the format: sk-xxxxxxxxxxxxxxxxxxxxxx

Headers

Authorization
string
required
API Key of the form Bearer <api_key>.Example: Bearer sk_b41b647ffbfed27f616560

Path Parameters

runId
string
required
The unique run identifier returned when the task was created.

Query Parameters

path
string
default:"/vercel/sandbox"
Workspace path to diff.Default: /vercel/sandbox
base
string
default:"HEAD"
Git ref to diff against.
  • "HEAD" — diff staged + unstaged changes against HEAD (default)
  • "initial" — diff from the very first commit to current working tree
Example: base=initial

Response Fields

diff
string
Unified diff output. Empty string if no changes.
path
string
The workspace path that was diffed.
hasGit
boolean
Whether the workspace is a git repository.
base
string | null
The git ref used as the diff base. null for non-git workspaces.
curl 'https://agent.blackbox.ai/api/v1/tasks/a1b2c3d4-e5f6-7890-abcd-ef1234567890/files/diff' \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "diff": "diff --git a/README.fr.md b/README.fr.md\nnew file mode 100644\nindex 0000000..a1b2c3d\n--- /dev/null\n+++ b/README.fr.md\n@@ -0,0 +1,10 @@\n+# Bienvenue\n+\n+Ceci est le README en français.\n+\n+## Installation\n+\n+```bash\n+npm install\n+```\n",
  "path": "/vercel/sandbox",
  "hasGit": true,
  "base": "initial"
}

Error Codes

Status CodeErrorDescription
200SuccessDiff returned
401UnauthorizedInvalid or missing API key
403ForbiddenTask belongs to a different user
404Not FoundTask not found or no sandbox available
500Internal Server ErrorFailed to get diff