Skip to API content
Birdor API v1

API reference · v1

Diff two texts

Compare two texts line by line (LCS) and return structured hunks plus a unified diff (diff -u / git style) with correct @@ ranges and \ No newline at end of file markers. Options ignore trailing or all whitespace and letter case; with them the unified output is for review, not for patch. approximate is true when the changed region is too large for an exact diff and is reported as one replacement. Requires a credential with tools.run; every accepted call consumes one monthly unit, including business 4xx/5xx.

POST/v1/run/text/diff

Access requirements

Health, metadata, changelog and waitlist routes are public. Catalog reads (GET /v1/tools, /v1/tools/{id}, /v1/colors/*) and POST /v1/tools/query require a tools.read credential; POST /v1/run/* requires tools.run. There is no anonymous access to these routes: send an API key (Bearer OR X-API-Key) from your server, or use the HttpOnly main-site session plus workspace selection and same-origin Origin. Never combine credentials. Every admitted call is metered. Ingress and workspace/actor minute/month limits are separate; waitlist has its own policy.

Implemented interfaces and development screens do not imply public production availability, paid access or a completed payment integration. Confirm access with Birdor before connecting an application. No paid Pro service, activation or cross-device sync is currently delivered. We are validating one repeatable task before building a paid offer.

Parameters

FieldDescription
AuthorizationstringOptionalBearer API key with tools.run; alternatively X-API-Key. One of the credentials is required.
X-API-KeystringOptionalAlternative to Authorization; never send both.
X-Birdor-Workspace-IDstringOptionalRequired with the site session; optional and matching with an API key.
X-Birdor-Project-IDstringOptionalOptional owned project; a project-bound key cannot select another project.

Request body

Send JSON with Content-Type: application/json.

FieldDescription
leftstringRequiredOriginal text, at most 15000 characters.
rightstringRequiredChanged text, at most 15000 characters (the whole request body is capped at 32768 bytes).
contextintegerOptionalUnchanged lines around each change, 0–20; default 3 (like diff -u / git).
ignoreWhitespacenone | trailing | allOptionalnone (default), trailing (ignore trailing spaces and CR, i.e. CRLF vs LF) or all (ignore all whitespace, like diff -w).
ignoreCasebooleanOptionalCompare lines case-insensitively; default false.
leftLabelstringOptionalName in the --- header; default a.
rightLabelstringOptionalName in the +++ header; default b.

Request example

1. Set the base URL

Request example
curl --request POST "$BIRDOR_API_BASE_URL/v1/run/text/diff" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer $BIRDOR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "left": "name: birdor\nversion: 1.2.0\nprivate: true\n",
  "right": "name: birdor\nversion: 1.3.0\nprivate: true\nlicense: MIT\n",
  "context": 1
}'

Examples are copied only; this page does not send API requests.

Responses

Illustrative response. Values vary by environment and time.

200Success
HTTP 200
{
  "ok": true,
  "data": {
    "identical": false,
    "approximate": false,
    "stats": {
      "added": 2,
      "removed": 1,
      "unchanged": 2,
      "hunks": 1
    },
    "hunks": [
      {
        "header": "@@ -1,3 +1,4 @@",
        "oldStart": 1,
        "oldLines": 3,
        "newStart": 1,
        "newLines": 4,
        "lines": [
          {
            "op": "context",
            "text": "name: birdor",
            "oldLine": 1,
            "newLine": 1,
            "noNewlineAtEnd": false
          },
          {
            "op": "removed",
            "text": "version: 1.2.0",
            "oldLine": 2,
            "newLine": null,
            "noNewlineAtEnd": false
          },
          {
            "op": "added",
            "text": "version: 1.3.0",
            "oldLine": null,
            "newLine": 2,
            "noNewlineAtEnd": false
          },
          {
            "op": "context",
            "text": "private: true",
            "oldLine": 3,
            "newLine": 3,
            "noNewlineAtEnd": false
          },
          {
            "op": "added",
            "text": "license: MIT",
            "oldLine": null,
            "newLine": 4,
            "noNewlineAtEnd": false
          }
        ]
      }
    ],
    "unified": "--- a\n+++ b\n@@ -1,3 +1,4 @@\n name: birdor\n-version: 1.2.0\n+version: 1.3.0\n private: true\n+license: MIT\n"
  },
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
400Invalid JSON, schema validation failure (field paths/codes only, never input values) or ambiguous credentials
HTTP 400
{
  "ok": false,
  "code": "VALIDATION_ERROR",
  "message": "Invalid request parameters",
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
401Missing, expired, rotated, revoked or invalid credential; there is no anonymous access
HTTP 401
{
  "ok": false,
  "code": "UNAUTHENTICATED",
  "message": "API access denied",
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
403Key lacks tools.run, or workspace/project/member policy or site Origin denied
HTTP 403
{
  "ok": false,
  "code": "FORBIDDEN",
  "message": "API access denied",
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
405Only POST is supported; rejected before admission
HTTP 405
{
  "ok": false,
  "code": "METHOD_NOT_ALLOWED",
  "message": "Method not allowed",
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
408Body read exceeds five seconds; before admission
HTTP 408
{
  "ok": false,
  "code": "REQUEST_TIMEOUT",
  "message": "Request body timeout or aborted",
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
413Body exceeds 32768 bytes; before admission
HTTP 413
{
  "ok": false,
  "code": "PAYLOAD_TOO_LARGE",
  "message": "Request body too large",
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
415Content-Type must be application/json; before admission
HTTP 415
{
  "ok": false,
  "code": "UNSUPPORTED_MEDIA_TYPE",
  "message": "JSON content type required",
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
429Ingress, workspace/actor minute or monthly quota exceeded; inspect code and Retry-After
HTTP 429
{
  "ok": false,
  "code": "QUOTA_EXCEEDED",
  "message": "API request limit exceeded",
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
500Unexpected operation failure; details are never echoed
HTTP 500
{
  "ok": false,
  "code": "OPERATION_FAILED",
  "message": "Operation failed",
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
503Authentication/metering dependency unavailable
HTTP 503
{
  "ok": false,
  "code": "API_GATEWAY_UNAVAILABLE",
  "message": "API access denied",
  "request_id": "req_example",
  "timestamp": "2026-10-11T00:00:00.000Z"
}
Error handling

Example response fields

Fields shown in this example; optional fields can be omitted. Array rows describe the first example element.

okboolean
Application success flag.
dataobject
Endpoint-specific result.
data.identicalboolean
Endpoint-specific example value.
data.approximateboolean
Endpoint-specific example value.
data.statsobject
Endpoint-specific example value.
data.stats.addednumber
Endpoint-specific example value.
data.stats.removednumber
Endpoint-specific example value.
data.stats.unchangednumber
Endpoint-specific example value.
data.stats.hunksnumber
Endpoint-specific example value.
data.hunksarray
Endpoint-specific example value.
data.hunks[].headerstring
Endpoint-specific example value.
data.hunks[].oldStartnumber
Endpoint-specific example value.
data.hunks[].oldLinesnumber
Endpoint-specific example value.
data.hunks[].newStartnumber
Endpoint-specific example value.
data.hunks[].newLinesnumber
Endpoint-specific example value.
data.hunks[].linesarray
Endpoint-specific example value.
data.unifiedstring
Endpoint-specific example value.
request_idstring
Origin-response identifier matching X-Request-ID; a shared HTTP cache may replay the original trace.
timestampstring
Response creation timestamp.