Get expected-vs-actual diff for a failing regression test result

GET /runs/{run_id}/samples/{sample_id}/diff

The legacy diff route is header-gated (X-Requested-With: XMLHttpRequest), not role-gated. The 403 seen on direct browser requests was a header-check artifact. This endpoint wraps the XHR logic and returns structured JSON — no HTML, no 50-line truncation.

Path parameters

  • run_id integer Required

    Numeric run ID

    Minimum value is 1.

  • sample_id integer Required

    Numeric sample or regression result ID

    Minimum value is 1.

Query parameters

  • regression_id integer Required

    Regression test definition ID

    Minimum value is 1.

  • output_id integer Required

    Output file ID within a regression test definition

    Minimum value is 1.

  • context_lines integer

    Minimum value is 0, maximum value is 50. Default value is 3.

  • format string

    Values are structured or unified. Default value is structured.

Responses

  • 200 application/json

    Structured or unified diff

    Hide response attributes Show response attributes object
    • run_id integer Required

      Minimum value is 1.

    • sample_id integer Required

      Minimum value is 1.

    • regression_id integer Required

      Minimum value is 1.

    • output_id integer Required

      Minimum value is 1.

    • status string Required

      Values are identical, different, missing_expected, or missing_actual.

    • summary object
      Hide summary attributes Show summary attributes object
      • added_lines integer Required

        Minimum value is 0.

      • removed_lines integer Required

        Minimum value is 0.

      • changed_hunks integer Required

        Minimum value is 0.

    • hunks array[object]

      Not more than 500 elements.

      Hide hunks attributes Show hunks attributes object
      • expected_start integer Required

        Minimum value is 0.

      • actual_start integer Required

        Minimum value is 0.

      • lines array[object] Required

        Not more than 500 elements.

        Hide lines attributes Show lines attributes object
        • kind string Required

          Values are context, added, or removed.

        • expected_line integer | null

          Minimum value is 0.

        • actual_line integer | null

          Minimum value is 0.

        • text string Required

          Maximum length is 1000.

  • 401 application/json

    Missing, expired, or invalid bearer token

    Hide response attributes Show response attributes object
    • code string Required

      Machine-readable error code (snake_case)

      Maximum length is 100.

    • message string Required

      Human-readable error summary

      Maximum length is 500.

    • details object Required

      Structured context for the error. Always an object, never null. Empty object {} when no additional detail is available.

      Additional properties are allowed.

  • 404 application/json

    Resource not found

    Hide response attributes Show response attributes object
    • code string Required

      Machine-readable error code (snake_case)

      Maximum length is 100.

    • message string Required

      Human-readable error summary

      Maximum length is 500.

    • details object Required

      Structured context for the error. Always an object, never null. Empty object {} when no additional detail is available.

      Additional properties are allowed.

  • 429 application/json

    Too many requests. Retry after the indicated number of seconds.

    Hide headers attributes Show headers attributes
    • Retry-After integer

      Seconds to wait before retrying

    • X-RateLimit-Limit

      Maximum requests allowed in the current window

    • X-RateLimit-Remaining

      Requests remaining in the current window

    • X-RateLimit-Reset

      Unix timestamp when the rate limit window resets

    Hide response attributes Show response attributes object
    • code string Required

      Machine-readable error code (snake_case)

      Maximum length is 100.

    • message string Required

      Human-readable error summary

      Maximum length is 500.

    • details object Required

      Structured context for the error. Always an object, never null. Empty object {} when no additional detail is available.

      Additional properties are allowed.

  • default application/json

    Unexpected server error

    Hide response attributes Show response attributes object
    • code string Required

      Machine-readable error code (snake_case)

      Maximum length is 100.

    • message string Required

      Human-readable error summary

      Maximum length is 500.

    • details object Required

      Structured context for the error. Always an object, never null. Empty object {} when no additional detail is available.

      Additional properties are allowed.

GET /runs/{run_id}/samples/{sample_id}/diff
curl \
 --request GET 'https://sampleplatform.ccextractor.org/api/v1/runs/{run_id}/samples/{sample_id}/diff?regression_id=42&output_id=42' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
{
  "run_id": 42,
  "sample_id": 42,
  "regression_id": 42,
  "output_id": 42,
  "status": "identical",
  "summary": {
    "added_lines": 42,
    "removed_lines": 42,
    "changed_hunks": 42
  },
  "hunks": [
    {
      "expected_start": 42,
      "actual_start": 42,
      "lines": [
        {
          "kind": "context",
          "expected_line": 42,
          "actual_line": 42,
          "text": "string"
        }
      ]
    }
  ]
}
Response examples (401)
{
  "code": "unauthorized",
  "message": "Bearer token is missing, expired, or invalid.",
  "details": {}
}
Response examples (404)
{
  "code": "not_found",
  "message": "Run 9317 not found.",
  "details": {
    "resource": "run",
    "id": 9317
  }
}
Response examples (429)
{
  "code": "rate_limited",
  "message": "Rate limit exceeded. Retry after 30 seconds.",
  "details": {
    "retry_after": 30,
    "limit": 120,
    "window": "60s"
  }
}
Response examples (default)
{
  "code": "not_found",
  "message": "Run 9317 not found.",
  "details": {}
}