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

# Diff Checkpoints

> Lists the paths that changed between two checkpoints of a disk, one
entry per path. Both checkpoints must be on the same branch: pass
`branch` to diff a branch's checkpoints, or omit it for the disk's
root.

Each entry says how a path changed and gives its mode and size at
each checkpoint. An added path has only `new`, and a removed path
only `old`. Directories, symlinks, and special files are listed as
well as regular files. A renamed directory is one entry, plus one for
each path under it.

Entries don't hold file contents. To read a file as it was at a
checkpoint, call `GetObject` on the
[S3 API](/protocols/s3-api#reading-from-a-checkpoint) with
`versionId` set to the checkpoint's name, in the bucket
`{disk}.{branch}` for a branch. The S3 API accepts the same API key
as a bearer token.

The diff comes in pages, in no path order. Pass `next` back as
`continuation-token` until a page has no `next`. A page can hold
fewer than `max-keys` entries, even none, and still not be the last.
Past `max-keys`, a page holds only more paths of the inode at its
end, such as a file's other hard links.

If a checkpoint's writes are still being flushed to storage, the
request fails with `503` and code `checkpoint_not_flushed`. Retry
until it succeeds.




## OpenAPI

````yaml GET /api/disks/{id}/checkpoints/{from}/diff/{to}
openapi: 3.1.0
info:
  title: Archil Control Plane API
  description: >
    The Archil Control Plane API provides programmatic access to manage disks,

    persistent sandboxes, mounts, and API keys in the Archil distributed

    filesystem platform.


    API keys authenticate requests to this control plane and are scoped to

    your account. They are distinct from *disk tokens*, which are per-disk

    credentials used by clients when mounting a disk.


    ## Authentication


    All endpoints require an API key, sent as a bearer token:


    ```

    Authorization: Bearer key-...

    ```


    Use the full key, including its `key-` prefix. The older form without the
    `Bearer` scheme is still accepted.


    Create API keys in the [Archil Console](https://console.archil.com) or via
    the API.


    ## Response Format


    All responses use a consistent envelope:


    ```json

    {
      "success": true,
      "data": { ... }
    }

    ```


    Or on error:


    ```json

    {
      "success": false,
      "error": "Error message"
    }

    ```
  version: 1.0.0
  contact:
    email: support@archil.com
    url: https://archil.com
servers:
  - url: https://control.green.us-east-1.aws.prod.archil.com
    description: AWS US East (N. Virginia) — aws-us-east-1
  - url: https://control.green.eu-west-1.aws.prod.archil.com
    description: AWS EU West (Ireland) — aws-eu-west-1
  - url: https://control.green.us-west-2.aws.prod.archil.com
    description: AWS US West (Oregon) — aws-us-west-2
  - url: https://control.blue.us-central1.gcp.prod.archil.com
    description: GCP US Central (Iowa) — gcp-us-central1
security:
  - ApiKeyAuth: []
tags:
  - name: Disks
    description: Create, read, update, and delete disks
  - name: Serverless Execution
    description: Run commands on a disk without provisioning compute
  - name: Sandboxes
    description: Manage persistent sandbox virtual machines
  - name: Disk Users
    description: Manage authorized users on disks
  - name: API Tokens
    description: >-
      Manage API keys (also called API tokens) used to authenticate Control
      Plane API requests. Distinct from disk tokens.
paths:
  /api/disks/{id}/checkpoints/{from}/diff/{to}:
    get:
      tags:
        - Disks
      summary: Diff two checkpoints
      description: |
        Lists the paths that changed between two checkpoints of a disk, one
        entry per path. Both checkpoints must be on the same branch: pass
        `branch` to diff a branch's checkpoints, or omit it for the disk's
        root.

        Each entry says how a path changed and gives its mode and size at
        each checkpoint. An added path has only `new`, and a removed path
        only `old`. Directories, symlinks, and special files are listed as
        well as regular files. A renamed directory is one entry, plus one for
        each path under it.

        Entries don't hold file contents. To read a file as it was at a
        checkpoint, call `GetObject` on the
        [S3 API](/protocols/s3-api#reading-from-a-checkpoint) with
        `versionId` set to the checkpoint's name, in the bucket
        `{disk}.{branch}` for a branch. The S3 API accepts the same API key
        as a bearer token.

        The diff comes in pages, in no path order. Pass `next` back as
        `continuation-token` until a page has no `next`. A page can hold
        fewer than `max-keys` entries, even none, and still not be the last.
        Past `max-keys`, a page holds only more paths of the inode at its
        end, such as a file's other hard links.

        If a checkpoint's writes are still being flushed to storage, the
        request fails with `503` and code `checkpoint_not_flushed`. Retry
        until it succeeds.
      operationId: getCheckpointDiff
      parameters:
        - $ref: '#/components/parameters/DiskId'
        - name: from
          in: path
          required: true
          description: The earlier checkpoint's name.
          schema:
            type: string
        - name: to
          in: path
          required: true
          description: The later checkpoint's name.
          schema:
            type: string
        - name: branch
          in: query
          required: false
          description: The branch both checkpoints are on. Omit for the disk's root.
          schema:
            type: string
        - name: continuation-token
          in: query
          required: false
          description: The `next` of the page before.
          schema:
            type: string
        - name: max-keys
          in: query
          required: false
          description: The most entries to return in a page, up to 1000.
          schema:
            type: integer
            minimum: 1
            maximum: 1000
      responses:
        '200':
          description: One page of the diff
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_CheckpointDiff'
              example:
                success: true
                data:
                  entries:
                    - change: modified
                      kind: file
                      path: config/app.yaml
                      old:
                        mode: 420
                        size: 1832
                      new:
                        mode: 420
                        size: 1907
                      changed:
                        - metadata
                        - data
                    - change: renamed
                      kind: file
                      from: schema.sql
                      path: schema/base.sql
                      old:
                        mode: 420
                        size: 5120
                      new:
                        mode: 420
                        size: 5120
                      changed:
                        - metadata
                    - change: added
                      kind: file
                      path: migrations/0042_add_index.sql
                      new:
                        mode: 420
                        size: 311
                    - change: removed
                      kind: file
                      path: tmp/lock
                      old:
                        mode: 384
                        size: 0
                  next: '4182'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Disk, branch, or checkpoint not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          description: |
            A checkpoint's writes are still being flushed to storage (code
            `checkpoint_not_flushed`), or the disk is briefly unavailable
            (code `temporarily_unavailable`). Retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckpointNotFlushedResponse'
              example:
                success: false
                error: The checkpoint's writes are still being flushed. Please retry.
                code: checkpoint_not_flushed
                data:
                  unflushedCommits: 12
                  oldestUnflushedSeconds: 3
      security:
        - ApiKeyAuth:
            - disk:read:{id}
components:
  parameters:
    DiskId:
      name: id
      in: path
      required: true
      description: Disk ID (format `dsk-{16 hex chars}`)
      schema:
        type: string
        pattern: ^dsk-[0-9a-f]{16}$
        example: dsk-0123456789abcdef
  schemas:
    ApiResponse_CheckpointDiff:
      type: object
      required:
        - success
        - data
      properties:
        success:
          type: boolean
          example: true
        data:
          $ref: '#/components/schemas/CheckpointDiffPage'
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          example: Invalid request parameters
        code:
          type: string
          description: Stable machine-readable error code.
    CheckpointNotFlushedResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
        code:
          type: string
          description: Stable machine-readable error code.
        data:
          $ref: '#/components/schemas/CheckpointFlushBacklog'
    CheckpointDiffPage:
      type: object
      required:
        - entries
      properties:
        entries:
          type: array
          items:
            $ref: '#/components/schemas/CheckpointDiffEntry'
        next:
          type: string
          description: Pass as `continuation-token` for the next page. Absent on the last.
    CheckpointFlushBacklog:
      type: object
      description: How far the disk is from flushing a checkpoint.
      required:
        - unflushedCommits
      properties:
        unflushedCommits:
          type: integer
          description: Journal commits up to the checkpoint still to flush.
        oldestUnflushedSeconds:
          type: integer
          description: How long the oldest of them has waited.
    CheckpointDiffEntry:
      type: object
      required:
        - change
        - kind
        - path
      properties:
        change:
          type: string
          enum:
            - added
            - removed
            - modified
            - renamed
            - copied
          description: |
            `copied` is a rename whose old path another file now holds.
        kind:
          type: string
          enum:
            - file
            - directory
            - symlink
            - other
          description: |
            `other` is a special file, such as a socket or device. A path
            whose kind changed is a removal and an addition.
        from:
          type: string
          description: Where a rename or copy came from.
        path:
          type: string
          description: |
            The path at `to`; for a removal, at `from`. Bytes of a name that
            aren't valid UTF-8 are replaced with U+FFFD.
        old:
          $ref: '#/components/schemas/CheckpointDiffSide'
        new:
          $ref: '#/components/schemas/CheckpointDiffSide'
        replaced:
          $ref: '#/components/schemas/CheckpointDiffSide'
        changed:
          type: array
          items:
            type: string
            enum:
              - metadata
              - data
              - xattrs
          description: |
            What may differ between `old` and `new`. Without `data`, the
            bytes differ only if the sizes do, as after a truncate. Absent
            when empty, as for added and removed paths.
    CheckpointDiffSide:
      type: object
      required:
        - mode
        - size
      description: |
        One side of a change. `old` is at the `from` checkpoint, at the
        entry's `from` if set and else at `path`. `new` is at the `to`
        checkpoint, at `path`. `replaced` is what a rename or copy
        replaced at `path`, at the `from` checkpoint.
      properties:
        mode:
          type: integer
          description: Permission bits, as `st_mode & 0o7777`.
        size:
          type: integer
          format: int64
          description: In bytes.
        target:
          type: string
          description: A symlink's target.
  responses:
    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Invalid or missing authentication credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      description: Archil API key, including its `key-` prefix

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.