---
title: POST /content-graphs/{instance_id}/query
slug: content-marketing-platform/api/post-content-graphsinstanceidquery
docTags: 
createdAt: 2026-10-13T13:35:30.349Z
---

{
  "id": "GDZ3zuuIcUaBHzlY0fNhE",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://api.cmp.optimizely.com/v3/content-graphs/{instance_id}/query",
    "servers": [
      {
        "url": "https://api.cmp.optimizely.com/v3/content-graphs/{instance_id}/query",
        "description": "v3 version of Optimizely CMP Open API"
      }
    ],
    "name": "POST /content-graphs/{instance_id}/query",
    "description": "<p>Experimental Run a GraphQL query against a content graph instance. Get the <code>instance_id</code> from <code>GET /content-graphs</code>.</p>\n<p>Use this to check whether a given asset has synced to the graph, by querying for its identifier and seeing whether the graph returns it.</p>\n<p><strong>Reading the response.</strong> A <code>200</code> carries the graph's JSON payload (<code>data</code>, and <code>extensions</code> when present) passed through unchanged. If the graph rejects a well-formed query, the endpoint returns the graph's own <code>4xx</code> status with its GraphQL <code>errors</code> body (for example <code>429</code> when the graph rate-limits). A <code>502</code> means the content graph is unavailable or returned a server error, and a <code>504</code> means it could not be reached in time — both are transient, so retry. A <code>500</code> is a server-side failure on our end and, unlike <code>502</code>/<code>504</code>, will not be resolved by retrying.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "instance_id",
          "type": "string",
          "example": "00e3d1f85ceb41408b3e323a6b3b188d",
          "description": "Unique identifier of the content graph instance"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "body",
          "type": "object",
          "description": "GraphQL query to run against the content graph instance",
          "customType": "ContentGraphQueryRequest",
          "schema": [
            {
              "name": "query",
              "kind": "required",
              "type": "string",
              "description": "GraphQL query to execute against the content graph instance",
              "example": "query MyQuery($after: String) { cmp_PublicImageAsset(limit: 50, cursor: $after) { total items { Id } cursor } }",
              "minLength": 1
            },
            {
              "name": "variables",
              "kind": "optional",
              "type": "map",
              "description": "<p>Values for the variables declared by <code>query</code></p>",
              "example": "{\"after\":null}",
              "customType": "map<string, string>",
              "schema": []
            }
          ],
          "modelRef": "#/components/schemas/ContentGraphQueryRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "oauth2Flows": {
            "clientCredentials": {
              "tokenUrl": "https://accounts.cmp.optimizely.com/o/oauth2/v1/token",
              "scopes": {}
            },
            "authorizationCode": {
              "authorizationUrl": "https://accounts.cmp.optimizely.com/o/oauth2/v1/auth",
              "tokenUrl": "https://accounts.cmp.optimizely.com/o/oauth2/v1/token",
              "scopes": {
                "openid": "Grants the ability to receive a unique identifier for the user.",
                "profile": "Grants access to user profile information.",
                "offline_access": "Grants the ability to refresh access_token using the refresh token even when user is not present (not logged in)."
              }
            }
          },
          "requiredScopes": [
            "openid",
            "profile",
            "offline_access"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>Query reached the content graph and succeeded. The body is the graph's JSON response, passed through unchanged.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"data\":{\"cmp_PublicImageAsset\":{\"cursor\":\"FGluY2x1\",\"total\":53,\"items\":[{\"Id\":\"03f47ac464bc11f18b0102420ac80022\"}]}},\"extensions\":{\"correlationId\":\"a18548eeeee29cba\",\"cost\":51}}",
            "description": "<p>The content graph's GraphQL response, passed through unchanged. Its shape is determined by the submitted query: <code>data</code> (and <code>extensions</code>) for a successful query, or <code>errors</code> when the graph rejects it.</p>",
            "customType": "ContentGraphQueryResponse",
            "schema": [
              {
                "name": "data",
                "kind": "optional",
                "type": "map",
                "description": "<p>Query result, shaped by the submitted GraphQL query.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "array",
                "description": "Present when the graph rejects the query.",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": []
              },
              {
                "name": "extensions",
                "kind": "optional",
                "type": "map",
                "description": "Graph metadata such as correlation id and query cost.",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ContentGraphQueryResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "400",
        "description": "<p>The request was invalid (for example a missing <code>query</code>), or the graph rejected a well-formed query. When it originates from the graph, the body is the graph's GraphQL <code>errors</code> payload.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"errors\":[{\"message\":\"Cannot query field \\\"Nope\\\" on type \\\"Query\\\".\"}]}",
            "description": "<p>The content graph's GraphQL response, passed through unchanged. Its shape is determined by the submitted query: <code>data</code> (and <code>extensions</code>) for a successful query, or <code>errors</code> when the graph rejects it.</p>",
            "customType": "ContentGraphQueryResponse",
            "schema": [
              {
                "name": "data",
                "kind": "optional",
                "type": "map",
                "description": "<p>Query result, shaped by the submitted GraphQL query.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "array",
                "description": "Present when the graph rejects the query.",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": []
              },
              {
                "name": "extensions",
                "kind": "optional",
                "type": "map",
                "description": "Graph metadata such as correlation id and query cost.",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ContentGraphQueryResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Authorization error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Unauthorized\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "403",
        "description": "Permission error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"You do not have the permission to perform this operation\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "404",
        "description": "Not found error",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Resource not found\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "429",
        "description": "<p>The content graph rate-limited the request. Passed through with the graph's status and body unchanged. Retry after a short delay.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"errors\":[{\"message\":\"Too many requests.\"}]}",
            "description": "<p>The content graph's GraphQL response, passed through unchanged. Its shape is determined by the submitted query: <code>data</code> (and <code>extensions</code>) for a successful query, or <code>errors</code> when the graph rejects it.</p>",
            "customType": "ContentGraphQueryResponse",
            "schema": [
              {
                "name": "data",
                "kind": "optional",
                "type": "map",
                "description": "<p>Query result, shaped by the submitted GraphQL query.</p>",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "array",
                "description": "Present when the graph rejects the query.",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": []
              },
              {
                "name": "extensions",
                "kind": "optional",
                "type": "map",
                "description": "Graph metadata such as correlation id and query cost.",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/ContentGraphQueryResponse",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "502",
        "description": "<p>The content graph is unavailable or returned an error that could not be passed through to the caller. Transient — retry.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Content graph query failed upstream. Please retry.\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "504",
        "description": "<p>The content graph could not be reached within the timeout. Transient — retry.</p>",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"message\":\"Content graph is unreachable. Please retry.\"}",
            "description": "Error payload",
            "customType": "Error",
            "schema": [
              {
                "name": "message",
                "kind": "required",
                "type": "string",
                "description": "Message describing the error",
                "example": "Not found"
              },
              {
                "name": "errors",
                "kind": "optional",
                "type": "map",
                "description": "Additional information",
                "example": "",
                "customType": "map<string, string>",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/Error",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "KZxqp1ug-n6FwtvBWHLBE",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.cmp.optimizely.com/v3/content-graphs/{instance_id}/query \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"query\": \"query MyQuery($after: String) { cmp_PublicImageAsset(limit: 50, cursor: $after) { total items { Id } cursor } }\"\n     }'"
        },
        {
          "id": "Ap3njsd6lnrz0H49Wr050",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"query\": \"query MyQuery($after: String) { cmp_PublicImageAsset(limit: 50, cursor: $after) { total items { Id } cursor } }\"\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.cmp.optimizely.com/v3/content-graphs/{instance_id}/query\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "6RInNE1H6mawBLsJZpMSR",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.cmp.optimizely.com/v3/content-graphs/{instance_id}/query\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"query\": \"query MyQuery($after: String) { cmp_PublicImageAsset(limit: 50, cursor: $after) { total items { Id } cursor } }\"\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "HOkKie7fUxIFnogQywc4Y",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.cmp.optimizely.com/v3/content-graphs/{instance_id}/query\"\n\npayload = json.dumps({\n   \"query\": \"query MyQuery($after: String) { cmp_PublicImageAsset(limit: 50, cursor: $after) { total items { Id } cursor } }\"\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "KZxqp1ug-n6FwtvBWHLBE"
    },
    "results": {
      "languages": [
        {
          "id": "qO5AXycd--03H6xJtBx1V",
          "language": "200",
          "code": "// Query reached the content graph and succeeded. The body is the graph's JSON response, passed through unchanged.\n{\n  \"data\": \"\",\n  \"errors\": [\n    {}\n  ],\n  \"extensions\": \"\"\n}"
        },
        {
          "id": "uJZxVrRHw9iAyi9lKauIJ",
          "language": "400",
          "code": "// The request was invalid (for example a missing query), or the graph rejected a well-formed query. When it originates from the graph, the body is the graph's GraphQL errors payload.\n{\n  \"data\": \"\",\n  \"errors\": [\n    {}\n  ],\n  \"extensions\": \"\"\n}"
        },
        {
          "id": "VedIR3zRf7GzeiGbkMRpI",
          "language": "401",
          "code": "// Authorization error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "R2-v919bisUVXTzf8r3wh",
          "language": "403",
          "code": "// Permission error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "smGPdYunbqbxe1Vu0uQEm",
          "language": "404",
          "code": "// Not found error\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "veIYqBUzqZoyjAi4oqncw",
          "language": "429",
          "code": "// The content graph rate-limited the request. Passed through with the graph's status and body unchanged. Retry after a short delay.\n{\n  \"data\": \"\",\n  \"errors\": [\n    {}\n  ],\n  \"extensions\": \"\"\n}"
        },
        {
          "id": "sHqR8HIE6yJ30D8zCHybJ",
          "language": "502",
          "code": "// The content graph is unavailable or returned an error that could not be passed through to the caller. Transient — retry.\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        },
        {
          "id": "0Tb-lIXrnOn2H3_MF2DYi",
          "language": "504",
          "code": "// The content graph could not be reached within the timeout. Transient — retry.\n{\n  \"message\": \"Not found\",\n  \"errors\": \"\"\n}"
        }
      ],
      "selectedLanguageId": "qO5AXycd--03H6xJtBx1V"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}