V1 API: Preview ref returning multiple documents

Hi guys,

I'm trying to fix some issues with our existing v1 integration. We're using the ruby library.

My understanding of the preview flow is this:

  1. Click the preview button on any saved document, then click an environment
  2. Prismic redirects to an endpoint in your app with a unique token/ref used to look up the current draft version of a particular document. This token is in the form "https://myrepo.prismic.io/previews/abcd12345?websitePreviewId=defg6789"
  3. Your app remembers this token and redirects to another endpoint
  4. That endpoint uses the Prismic API to request the document
  5. Your app renders the document json

We're querying the API like this:

api
	.form("everything")
	.submit(ref) # unique ref for this preview instance

For some previews this works fine, but for others we get multiple documents being returned. Why are multiple documents being returned for a unique preview ref?

When a user launches a preview in the Writing Room, a temporary and secure ref (a token that references a specific content version) is generated for the preview session. Prismic sets a cookie with a token to access the preview.

On a related note, where can we find the HTTP API documentation for v1? We're currently using the ruby library as a reference which isn't ideal.

Hello team.

Please note that the v1 endpoint is no longer supported. You should always use the v2 API. Here’s the documentation for setting up Prismic Previews.

For all correct preview setups, the workflow should look almost always like this

  1. If your kit doesn't automatically apply the preview script, add it to your code.
  2. Configure the preview setup in your repository
  3. Click the preview button on any saved document.
  4. Prismic redirects to the URL you set up in the preview configuration in your repository, appending /preview and including a unique token/ref to look up the current draft version of a particular document.
  5. Your app remembers this token
  6. That endpoint uses the Prismic API to request the document.

You need to ensure your query is targeting only the document, or release, you intend to preview.

When a user launches a preview in the Writing Room, a temporary and secure ref (a token that references a specific content version) is generated for the preview session. Prismic sets a cookie with a token to access the preview. You can verify that the io.prismic.preview cookie is set in the browser's Inspect > Application tab.