---
title: Compare two revisions.
slug: web-experimentation/api/compare-two-revisions
docTags: 
createdAt: 2026-10-14T09:45:27.065Z
---

{
  "id": "49isK-bGhveI9_aEoj1FP",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.optimizely.com/v2/revisions/compare",
    "servers": [
      {
        "url": "https://api.optimizely.com/v2/revisions/compare"
      }
    ],
    "name": "Compare two revisions.",
    "description": "Compare two revisions of the same entity. Returns the full revision records including snapshots for both the current and target revisions.",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [
        {
          "kind": "required",
          "name": "current",
          "type": "integer<int64>",
          "description": "<p>Revision ID for the current/latest state.</p>",
          "format": "int64"
        },
        {
          "kind": "required",
          "name": "target",
          "type": "integer<int64>",
          "description": "Revision ID for the version to compare against.",
          "format": "int64"
        },
        {
          "kind": "required",
          "name": "project_id",
          "type": "integer<int64>",
          "description": "ID of the Project for authorization.",
          "format": "int64"
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "apiKey",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        },
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "description": "<p>Write applications that authenticate with the REST API via OAuth 2.0. Or, to authenticate using a personal token, see <a href=\"https://docs.developers.optimizely.com/web/docs/personal-token\" target=\"_blank\">https://docs.developers.optimizely.com/web/docs/personal-token</a></p>",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://app.optimizely.com/oauth2/authorize",
              "tokenUrl": "https://app.optimizely.com/oauth2/token",
              "scopes": {
                "all": "Full access to your account"
              }
            }
          },
          "requiredScopes": [
            "read",
            "write"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Returns the two revision records for comparison.",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "CompareRevisionResponse",
            "schema": [
              {
                "name": "current",
                "kind": "optional",
                "type": "object",
                "description": "<p>The current/latest revision.</p>",
                "modelRef": "#/components/schemas/FullRevision",
                "customType": "FullRevision",
                "schema": [
                  {
                    "name": "account_id",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "ID of the account.",
                    "format": "int64"
                  },
                  {
                    "name": "change_type",
                    "kind": "optional",
                    "type": "string<archive | create | update | delete | publish | unarchive | migration | archive_related_entity | unarchive_related_entity | flag_status_update>",
                    "description": "Action performed on the entity.",
                    "enum": [
                      "archive",
                      "create",
                      "update",
                      "delete",
                      "publish",
                      "unarchive",
                      "migration",
                      "archive_related_entity",
                      "unarchive_related_entity",
                      "flag_status_update"
                    ]
                  },
                  {
                    "name": "entity_id",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "ID of the entity.",
                    "format": "int64"
                  },
                  {
                    "name": "entity_type",
                    "kind": "optional",
                    "type": "string",
                    "description": "The entity type as defined by public API."
                  },
                  {
                    "name": "id",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "ID of the revision.",
                    "format": "int64"
                  },
                  {
                    "name": "project_id",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "ID of the project related to the entity.",
                    "format": "int64"
                  },
                  {
                    "name": "sequence_number",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "<p>Auto-generated number assigned to the revision when the entity was modified.</p>",
                    "format": "int64"
                  },
                  {
                    "name": "snapshot",
                    "kind": "optional",
                    "type": "object",
                    "description": "The full state of the entity at this revision.",
                    "example": "",
                    "schema": []
                  },
                  {
                    "name": "source",
                    "kind": "optional",
                    "type": "string<ui | api | migration | mcp>",
                    "description": "Origin of the revision.",
                    "enum": [
                      "ui",
                      "api",
                      "migration",
                      "mcp"
                    ]
                  },
                  {
                    "name": "update_time",
                    "kind": "optional",
                    "type": "string<date-time>",
                    "description": "The time when the entity was modified. Format is ISO 8601.",
                    "format": "date-time"
                  },
                  {
                    "name": "user",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "modelRef": "#/components/schemas/User",
                    "customType": "User",
                    "schema": [
                      {
                        "name": "display_name",
                        "kind": "optional",
                        "type": "string",
                        "nullable": true,
                        "description": "<p>Display name of the user, most commonly the Optimizely user's email.</p>"
                      },
                      {
                        "name": "email",
                        "kind": "required",
                        "type": "string",
                        "description": "Email of the user."
                      },
                      {
                        "name": "first_name",
                        "kind": "optional",
                        "type": "string",
                        "nullable": true,
                        "description": "First name of the user."
                      },
                      {
                        "name": "id",
                        "kind": "required",
                        "type": "string",
                        "description": "ID of the user."
                      },
                      {
                        "name": "last_name",
                        "kind": "optional",
                        "type": "string",
                        "nullable": true,
                        "description": "Last name of the user."
                      },
                      {
                        "name": "profile_image_url",
                        "kind": "optional",
                        "type": "string",
                        "nullable": true,
                        "description": "URL to the user profile image."
                      }
                    ]
                  },
                  {
                    "name": "user_showable",
                    "kind": "optional",
                    "type": "boolean",
                    "description": "Indicates if the revision should be exposed to the user."
                  }
                ]
              },
              {
                "name": "target",
                "kind": "optional",
                "type": "object",
                "description": "The target revision to compare against.",
                "modelRef": "#/components/schemas/FullRevision",
                "customType": "FullRevision",
                "schema": [
                  {
                    "name": "account_id",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "ID of the account.",
                    "format": "int64"
                  },
                  {
                    "name": "change_type",
                    "kind": "optional",
                    "type": "string<archive | create | update | delete | publish | unarchive | migration | archive_related_entity | unarchive_related_entity | flag_status_update>",
                    "description": "Action performed on the entity.",
                    "enum": [
                      "archive",
                      "create",
                      "update",
                      "delete",
                      "publish",
                      "unarchive",
                      "migration",
                      "archive_related_entity",
                      "unarchive_related_entity",
                      "flag_status_update"
                    ]
                  },
                  {
                    "name": "entity_id",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "ID of the entity.",
                    "format": "int64"
                  },
                  {
                    "name": "entity_type",
                    "kind": "optional",
                    "type": "string",
                    "description": "The entity type as defined by public API."
                  },
                  {
                    "name": "id",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "ID of the revision.",
                    "format": "int64"
                  },
                  {
                    "name": "project_id",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "ID of the project related to the entity.",
                    "format": "int64"
                  },
                  {
                    "name": "sequence_number",
                    "kind": "optional",
                    "type": "integer<int64>",
                    "description": "<p>Auto-generated number assigned to the revision when the entity was modified.</p>",
                    "format": "int64"
                  },
                  {
                    "name": "snapshot",
                    "kind": "optional",
                    "type": "object",
                    "description": "The full state of the entity at this revision.",
                    "example": "",
                    "schema": []
                  },
                  {
                    "name": "source",
                    "kind": "optional",
                    "type": "string<ui | api | migration | mcp>",
                    "description": "Origin of the revision.",
                    "enum": [
                      "ui",
                      "api",
                      "migration",
                      "mcp"
                    ]
                  },
                  {
                    "name": "update_time",
                    "kind": "optional",
                    "type": "string<date-time>",
                    "description": "The time when the entity was modified. Format is ISO 8601.",
                    "format": "date-time"
                  },
                  {
                    "name": "user",
                    "kind": "optional",
                    "type": "object",
                    "description": "",
                    "modelRef": "#/components/schemas/User",
                    "customType": "User",
                    "schema": [
                      {
                        "name": "display_name",
                        "kind": "optional",
                        "type": "string",
                        "nullable": true,
                        "description": "<p>Display name of the user, most commonly the Optimizely user's email.</p>"
                      },
                      {
                        "name": "email",
                        "kind": "required",
                        "type": "string",
                        "description": "Email of the user."
                      },
                      {
                        "name": "first_name",
                        "kind": "optional",
                        "type": "string",
                        "nullable": true,
                        "description": "First name of the user."
                      },
                      {
                        "name": "id",
                        "kind": "required",
                        "type": "string",
                        "description": "ID of the user."
                      },
                      {
                        "name": "last_name",
                        "kind": "optional",
                        "type": "string",
                        "nullable": true,
                        "description": "Last name of the user."
                      },
                      {
                        "name": "profile_image_url",
                        "kind": "optional",
                        "type": "string",
                        "nullable": true,
                        "description": "URL to the user profile image."
                      }
                    ]
                  },
                  {
                    "name": "user_showable",
                    "kind": "optional",
                    "type": "boolean",
                    "description": "Indicates if the revision should be exposed to the user."
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/CompareRevisionResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "Revisions do not belong to the same entity.",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "<p>One or both revisions not found, or do not belong to the specified project.</p>",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "Boe6KLtcgiCFLHqUGSSBZ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url 'https://api.optimizely.com/v2/revisions/compare?current=integer%3Cint64%3E&target=integer%3Cint64%3E&project_id=integer%3Cint64%3E' \\\n     --header 'accept: application/json'"
        },
        {
          "id": "oZmCISCPychdTYQtyCIEy",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.optimizely.com/v2/revisions/compare?current=integer<int64>&target=integer<int64>&project_id=integer<int64>\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "jSeRSkqj0HP_TX4pt1GXU",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/v2/revisions/compare?current=integer<int64>&target=integer<int64>&project_id=integer<int64>\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "yyORUlATtJzGwdySAng-L",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/v2/revisions/compare?current=integer<int64>&target=integer<int64>&project_id=integer<int64>\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "Boe6KLtcgiCFLHqUGSSBZ"
    },
    "results": {
      "languages": [
        {
          "id": "IV4MUGHYDb9sRd_rZ3Clc",
          "language": "200",
          "code": "// Returns the two revision records for comparison.\n{\n  \"current\": {\n    \"account_id\": \"\",\n    \"change_type\": \"\",\n    \"entity_id\": \"\",\n    \"entity_type\": \"\",\n    \"id\": \"\",\n    \"project_id\": \"\",\n    \"sequence_number\": \"\",\n    \"snapshot\": {},\n    \"source\": \"\",\n    \"update_time\": \"\",\n    \"user\": {\n      \"display_name\": \"\",\n      \"email\": \"\",\n      \"first_name\": \"\",\n      \"id\": \"\",\n      \"last_name\": \"\",\n      \"profile_image_url\": \"\"\n    },\n    \"user_showable\": false\n  },\n  \"target\": {\n    \"account_id\": \"\",\n    \"change_type\": \"\",\n    \"entity_id\": \"\",\n    \"entity_type\": \"\",\n    \"id\": \"\",\n    \"project_id\": \"\",\n    \"sequence_number\": \"\",\n    \"snapshot\": {},\n    \"source\": \"\",\n    \"update_time\": \"\",\n    \"user\": {\n      \"display_name\": \"\",\n      \"email\": \"\",\n      \"first_name\": \"\",\n      \"id\": \"\",\n      \"last_name\": \"\",\n      \"profile_image_url\": \"\"\n    },\n    \"user_showable\": false\n  }\n}"
        },
        {
          "id": "DXB3yZCr7IknEFSZ4ogyJ",
          "language": "400",
          "code": "// Revisions do not belong to the same entity.\n"
        },
        {
          "id": "WVm3mskkcJQfk0xbOjXxs",
          "language": "404",
          "code": "// One or both revisions not found, or do not belong to the specified project.\n"
        }
      ],
      "selectedLanguageId": "IV4MUGHYDb9sRd_rZ3Clc"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}