Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev guideRecipesAPI ReferenceChangelog
Dev guideRecipesUser GuidesNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Single key

API key to fetch publicly available data

Authorization: "epi-single {token}"

Single Key authentication provides read-only access to publicly available GraphQL data. Use this method to experiment with queries in GraphiQL or retrieve published content without user-specific authorization. Single Key authentication is available only at the GraphQL query endpoint.

When using single key authentication, Graph only returns published content that is accessible to the public user (that is, users in the Everyone group within the Content Managment System).

The returned content must meet all the following conditions:

  • The content is not deleted (_deleted = false).
  • The content has not expired (StopPublish = null or StopPublish is in the future).
  • The content is published (Status = Published).
  • The content is readable by everyone (rbac includes r:Everyone:Read).

cURL Example

curl "https://cg.optimizely.com/content/v2?auth=YOUR_SINGLE_KEY" \ 
-H "Content-Type: application/json" \ 
-d '{"query": "{ Article { items { title } } }"}' 

JavaScript Example

const response = await fetch("https://cg.optimizely.com/content/v2?auth=YOUR_SINGLE_KEY", { 
method: "POST", 
headers: { "Content-Type": "application/json" }, 
body: JSON.stringify({ query: "{ Article { items { title } } }" }), 
}); 
const data = await response.json(); 
console.log(data);