> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mesa.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get diff

> Retrieve the diff between two change ids. In the JSON response, conflicted paths are excluded from `entries[]` and surface only in `conflicted_entries[]` (with per-side target/base/source content); the two arrays are mutually exclusive. When the client requests `Accept: text/plain`, the response is a full unified patch that includes every changed path, with conflicted paths rendered inline using JJ-style `<<<<<<<` / `>>>>>>>` markers.

<Note>**Required scope:** `read`</Note>


## OpenAPI

````yaml /openapi.json get /{org}/{repo}/diff
openapi: 3.1.0
info:
  title: Depot API
  description: Depot HTTP API v1
  version: 1.0.0
servers:
  - url: https://api.mesa.dev/v1
security:
  - apiKey: []
paths:
  /{org}/{repo}/diff:
    get:
      tags:
        - Change
      summary: Get diff
      description: >-
        Retrieve the diff between two change ids. In the JSON response,
        conflicted paths are excluded from `entries[]` and surface only in
        `conflicted_entries[]` (with per-side target/base/source content); the
        two arrays are mutually exclusive. When the client requests `Accept:
        text/plain`, the response is a full unified patch that includes every
        changed path, with conflicted paths rendered inline using JJ-style
        `<<<<<<<` / `>>>>>>>` markers.
      operationId: getDiff
      parameters:
        - in: path
          name: org
          schema:
            type: string
            minLength: 1
          required: true
          description: Organization slug
        - in: path
          name: repo
          schema:
            type: string
            minLength: 1
          required: true
          description: Repository name
        - in: query
          name: base_change_id
          schema:
            type: string
            pattern: ^[zyxwvutsrqponmlk]{32}$
          required: true
          description: >-
            Base change id for the diff. Use the virtual root change id
            (zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) to diff from the empty tree.
        - in: query
          name: head_change_id
          schema:
            type: string
            pattern: ^[zyxwvutsrqponmlk]{32}$
          required: true
          description: >-
            Head change id for the diff. Use the virtual root change id
            (zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz) to diff against the empty tree.
        - in: query
          name: conflicts
          schema:
            default: include
            type: string
            enum:
              - include
              - only
              - exclude
      responses:
        '200':
          description: Diff response
          content:
            application/json:
              schema:
                type: object
                properties:
                  base_change_id:
                    type: string
                    pattern: ^[zyxwvutsrqponmlk]{32}$
                  head_change_id:
                    type: string
                    pattern: ^[zyxwvutsrqponmlk]{32}$
                  stats:
                    type: object
                    properties:
                      entries:
                        type: number
                      additions:
                        type: number
                      deletions:
                        type: number
                      changes:
                        type: number
                      conflicted_entries:
                        type: number
                      conflicted_hunks:
                        type: number
                    required:
                      - entries
                      - additions
                      - deletions
                      - changes
                      - conflicted_entries
                      - conflicted_hunks
                  truncated:
                    type: boolean
                    description: >-
                      True when the response hit the server entry limit and is
                      incomplete
                  entries:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                        status:
                          type: string
                          enum:
                            - added
                            - modified
                            - deleted
                            - renamed
                          description: >-
                            How the entry changed between the base and head
                            changes
                        old_path:
                          anyOf:
                            - type: string
                            - type: 'null'
                        size_bytes:
                          description: >-
                            Approximate size in bytes of the changed entry
                            content, not the textual diff
                          type: number
                        is_conflicted:
                          type: boolean
                          description: >-
                            True when either side of the diff for this entry is
                            still conflicted
                        omitted_reason:
                          anyOf:
                            - type: string
                              enum:
                                - binary
                                - too_large
                                - file_limit
                            - type: 'null'
                          description: >-
                            Why textual hunk data is unavailable for this
                            changed entry: binary content, entry too large, or
                            omitted because the diff hit file limits
                        hunks:
                          anyOf:
                            - type: array
                              items:
                                type: object
                                properties:
                                  old_start:
                                    type: number
                                  old_lines:
                                    type: number
                                  new_start:
                                    type: number
                                  new_lines:
                                    type: number
                                  lines:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        kind:
                                          type: string
                                          enum:
                                            - context
                                            - added
                                            - deleted
                                            - annotation
                                        text:
                                          type: string
                                      required:
                                        - kind
                                        - text
                                required:
                                  - old_start
                                  - old_lines
                                  - new_start
                                  - new_lines
                                  - lines
                            - type: 'null'
                          description: >-
                            Structured textual diff hunks, or null when
                            omitted_reason is set
                        conflict_hunks:
                          anyOf:
                            - type: array
                              items:
                                type: object
                                properties:
                                  hunk_id:
                                    type: string
                                  old_start:
                                    type: number
                                  old_lines:
                                    type: number
                                  new_start:
                                    type: number
                                  new_lines:
                                    type: number
                                  target:
                                    anyOf:
                                      - type: object
                                        properties:
                                          content:
                                            type: string
                                            description: >-
                                              Base64-encoded raw bytes for this side
                                              of the conflicted hunk
                                        required:
                                          - content
                                      - type: 'null'
                                  base:
                                    anyOf:
                                      - type: object
                                        properties:
                                          content:
                                            type: string
                                            description: >-
                                              Base64-encoded raw bytes for this side
                                              of the conflicted hunk
                                        required:
                                          - content
                                      - type: 'null'
                                  source:
                                    anyOf:
                                      - type: object
                                        properties:
                                          content:
                                            type: string
                                            description: >-
                                              Base64-encoded raw bytes for this side
                                              of the conflicted hunk
                                        required:
                                          - content
                                      - type: 'null'
                                required:
                                  - hunk_id
                                  - old_start
                                  - old_lines
                                  - new_start
                                  - new_lines
                                  - target
                                  - base
                                  - source
                            - type: 'null'
                      required:
                        - path
                        - status
                        - old_path
                        - is_conflicted
                        - omitted_reason
                        - hunks
                        - conflict_hunks
                    description: >-
                      Changed entries only. Unchanged paths are omitted from
                      this list
                  conflicted_entries:
                    type: array
                    items:
                      type: object
                      properties:
                        path:
                          type: string
                        hunks:
                          type: array
                          items:
                            type: object
                            properties:
                              hunk_id:
                                type: string
                              old_start:
                                type: number
                              old_lines:
                                type: number
                              new_start:
                                type: number
                              new_lines:
                                type: number
                              target:
                                anyOf:
                                  - type: object
                                    properties:
                                      content:
                                        type: string
                                        description: >-
                                          Base64-encoded raw bytes for this side
                                          of the conflicted hunk
                                    required:
                                      - content
                                  - type: 'null'
                              base:
                                anyOf:
                                  - type: object
                                    properties:
                                      content:
                                        type: string
                                        description: >-
                                          Base64-encoded raw bytes for this side
                                          of the conflicted hunk
                                    required:
                                      - content
                                  - type: 'null'
                              source:
                                anyOf:
                                  - type: object
                                    properties:
                                      content:
                                        type: string
                                        description: >-
                                          Base64-encoded raw bytes for this side
                                          of the conflicted hunk
                                    required:
                                      - content
                                  - type: 'null'
                            required:
                              - hunk_id
                              - old_start
                              - old_lines
                              - new_start
                              - new_lines
                              - target
                              - base
                              - source
                          description: >-
                            Per-hunk conflict detail. Empty when omitted_reason
                            is set or the conflict is non-textual (add/delete).
                        size_bytes:
                          description: >-
                            Approximate size in bytes of the largest side of the
                            conflict. Informational when omitted_reason is set.
                          type: number
                        omitted_reason:
                          description: >-
                            Why hunks are unavailable for this conflicted entry:
                            binary content or per-side content exceeded the
                            response size budget. When set, fetch file bytes via
                            GET /content against the target or source change to
                            compose a whole-file resolution.
                          anyOf:
                            - type: string
                              enum:
                                - binary
                                - too_large
                            - type: 'null'
                      required:
                        - path
                        - hunks
                required:
                  - base_change_id
                  - head_change_id
                  - stats
                  - truncated
                  - entries
                  - conflicted_entries
            text/plain:
              schema:
                type: string
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                      trace_id:
                        description: >-
                          Support correlation id attached to 5xx responses;
                          quote it when reporting an issue
                        type: string
                    required:
                      - code
                      - message
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                      trace_id:
                        description: >-
                          Support correlation id attached to 5xx responses;
                          quote it when reporting an issue
                        type: string
                    required:
                      - code
                      - message
                required:
                  - error
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                      trace_id:
                        description: >-
                          Support correlation id attached to 5xx responses;
                          quote it when reporting an issue
                        type: string
                    required:
                      - code
                      - message
                required:
                  - error
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                      trace_id:
                        description: >-
                          Support correlation id attached to 5xx responses;
                          quote it when reporting an issue
                        type: string
                    required:
                      - code
                      - message
                required:
                  - error
        '406':
          description: Not acceptable
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                      trace_id:
                        description: >-
                          Support correlation id attached to 5xx responses;
                          quote it when reporting an issue
                        type: string
                    required:
                      - code
                      - message
                required:
                  - error
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                      trace_id:
                        description: >-
                          Support correlation id attached to 5xx responses;
                          quote it when reporting an issue
                        type: string
                    required:
                      - code
                      - message
                required:
                  - error
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                      trace_id:
                        description: >-
                          Support correlation id attached to 5xx responses;
                          quote it when reporting an issue
                        type: string
                    required:
                      - code
                      - message
                required:
                  - error
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: API Key

````