---
title: Execute graphql query
slug: graph/api/V7P7-execute-graphql-query
docTags: 
createdAt: 2026-08-28T18:28:55.472Z
---

{
  "id": "NNZTwkAVJdkN3pZfvBEdt",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://cg.optimizely.com/content/v2",
    "servers": [
      {
        "url": "https://cg.optimizely.com/content/v2"
      }
    ],
    "name": "Execute graphql query",
    "description": "Retrieve content respect to graphql query",
    "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": "optional",
          "name": "query",
          "type": "string",
          "description": ""
        },
        {
          "kind": "optional",
          "name": "mutation",
          "type": "string",
          "description": ""
        },
        {
          "kind": "optional",
          "name": "operationName",
          "type": "string",
          "description": ""
        },
        {
          "kind": "optional",
          "name": "variables",
          "type": "string",
          "description": ""
        }
      ],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "epi-single",
          "name": "auth",
          "kind": "optional",
          "type": "apiKey",
          "description": "Single key authentication",
          "in": "query"
        },
        {
          "id": "epi-hmac",
          "name": "Authorization",
          "kind": "optional",
          "type": "apiKey",
          "description": "<p>HMAC authentication (<code>epi-hmac xxx</code>)</p>",
          "in": "header"
        },
        {
          "id": "Bearer",
          "name": "Bearer",
          "kind": "optional",
          "type": "http",
          "description": "JWT token",
          "scheme": "bearer"
        },
        {
          "id": "Basic",
          "name": "Basic",
          "kind": "optional",
          "type": "http",
          "description": "HMAC credentials",
          "scheme": "basic"
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Returns query result",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "GraphQLResponse",
            "schema": [
              {
                "name": "data",
                "kind": "optional",
                "type": "object",
                "description": "Construct a type with a set of properties K of type T",
                "modelRef": "#/components/schemas/Record_string.any_",
                "customType": "Record_string.any_",
                "schema": []
              },
              {
                "name": "extensions",
                "kind": "optional",
                "type": "object",
                "description": "Construct a type with a set of properties K of type T",
                "modelRef": "#/components/schemas/Record_string.any_",
                "customType": "Record_string.any_",
                "schema": []
              }
            ],
            "modelRef": "#/components/schemas/GraphQLResponse",
            "isExpanded": true
          }
        ]
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "k1opCDZ9GoGmM2PnJ-JbE",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://cg.optimizely.com/content/v2 \\\n     --header 'accept: application/json'"
        },
        {
          "id": "J5r8M2cHSFjIHoa7UeZHk",
          "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://cg.optimizely.com/content/v2\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "9wdymlRCzBBfnMag7wxRJ",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://cg.optimizely.com/content/v2\")\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": "4Gg6fNQvLSuXY5kegN4Bv",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://cg.optimizely.com/content/v2\"\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": "k1opCDZ9GoGmM2PnJ-JbE"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// Returns query result\n{\n  \"data\": {},\n  \"extensions\": {}\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}