# `GET /v1/workspace/domain/commit` — Get a commit's changes

Part of the [Bkper Managed Agent API](https://bkper.com/docs/api/managed-agent.md). Read its guide for authentication, conventions, and examples.

What one of the latest 20 published commits changed: each file before and after. 404 not_found for any other commit. The user's verified domain's, for everyone in it; changes only for the domain's admin (403 workspace_forbidden), and none without a domain.

## Operation contract

```json
{
  "operationId": "getDomainContextCommit",
  "tags": [
    "Workspace"
  ],
  "summary": "Get a commit's changes",
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "commit",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string",
        "pattern": "^[0-9a-f]{40}$"
      }
    }
  ],
  "description": "What one of the latest 20 published commits changed: each file before and after. 404 not_found for any other commit. The user's verified domain's, for everyone in it; changes only for the domain's admin (403 workspace_forbidden), and none without a domain.",
  "responses": {
    "200": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/WorkspaceCommitDiff"
          }
        }
      }
    },
    "400": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "401": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "403": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "404": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "409": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "410": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "411": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "413": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "422": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    },
    "503": {
      "description": "Rejected; never contains credentials or upstream payloads.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Error"
          }
        }
      }
    }
  }
}
```

## Schemas

### WorkspaceCommitDiff

```json
{
  "type": "object",
  "properties": {
    "commit": {
      "type": "string"
    },
    "message": {
      "type": "string",
      "description": "Its first line, written by whoever published it; automatic for changes from this API."
    },
    "author": {
      "type": "string",
      "description": "Who published it, by name."
    },
    "at": {
      "type": "string",
      "description": "ISO 8601."
    },
    "agent": {
      "type": "boolean",
      "description": "Whether it was made with the agent's help: its message ends with the trailer `Assisted-by: Bkper Agent`."
    },
    "files": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string"
          },
          "before": {
            "description": "Absent when the commit added it.",
            "type": "object",
            "properties": {
              "size": {
                "type": "number",
                "description": "Bytes."
              },
              "text": {
                "description": "UTF-8 text up to 256 KiB, while the answer's text stays within 1 MiB; else only the size.",
                "type": "string"
              }
            },
            "required": [
              "size"
            ]
          },
          "after": {
            "description": "Absent when the commit removed it.",
            "type": "object",
            "properties": {
              "size": {
                "type": "number",
                "description": "Bytes."
              },
              "text": {
                "description": "UTF-8 text up to 256 KiB, while the answer's text stays within 1 MiB; else only the size.",
                "type": "string"
              }
            },
            "required": [
              "size"
            ]
          }
        },
        "required": [
          "path"
        ]
      },
      "description": "Each file it changed, in path order: at most 100."
    },
    "truncated": {
      "description": "true when it changed more files than `files` lists.",
      "type": "boolean"
    }
  },
  "required": [
    "commit",
    "message",
    "author",
    "at",
    "agent",
    "files"
  ],
  "description": "One of the latest 20 commits and what it changed, compared with its parent."
}
```

### Error

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "description": "Stable code, e.g. not_found, idempotency_conflict, session_working, usage_limit_exceeded. Open."
        },
        "type": {
          "description": "Category, e.g. invalid_request_error, authentication_error, usage_limit_error. Open.",
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "host": {
          "description": "host_in_use: the host another service holds.",
          "type": "string"
        },
        "service": {
          "description": "host_in_use: the id of the service that holds the host.",
          "type": "string"
        },
        "reason": {
          "description": "file_invalid: why the change, or a picture, was refused. Open: path | text | size | skill | skills | count | type.",
          "type": "string"
        },
        "paths": {
          "description": "file_exists from an add: every path of the request where a file is and `replace` was not set, all at once, so the person can be asked once. publish_conflict: the files someone published changes to the same lines of.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "publishers": {
          "description": "publish_conflict: who published those changes, by name.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "code"
      ]
    }
  },
  "required": [
    "error"
  ]
}
```

## Authentication

```json
{
  "bearerAuth": {
    "type": "http",
    "scheme": "bearer"
  }
}
```
