# Preview returning 500 api\_internal\_error

**URL:** <https://community.prismic.io/t/preview-returning-500-api-internal-error/9827>\
**Category:** Developing with Prismic\
**Tags:** graphql\
**Created:** [April 20, 2022, 3:21pm UTC](https://community.prismic.io/t/preview-returning-500-api-internal-error/9827 "2022-04-20T15:21:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin1](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@martin1](https://community.prismic.io/u/martin1)\
**Post date:** [April 20, 2022, 3:21pm UTC](https://community.prismic.io/t/preview-returning-500-api-internal-error/9827/1 "2022-04-20T15:21:53Z")

</div>

Hello

Our content writers have informed me that the Prismic preview functionality has stopped working for draft documents.

We have started receiving the following response from the GraphQL API when previewing a draft document:

```auto
{"type":"api_internal_error","message":"Unexpected error"}

```

GraphQL Query:

```auto
query PRISMIC_DOCUMENT {
  pDocuments: _allDocuments(id: "YmATZhIAACUA6eOx", lang: "en-us") {
    edges {
      node {
        ...meta
        __typename
      }
    }
  }
}
fragment meta on _Document {
  _meta {
    id
    lang
    tags
    type
    uid
  }
  __typename
}

```

Prismic-Ref: "Yl\_cMBIAACEA6Oqd:YmAVhRIAACMA6evQ"

I have also tried the REST API and receive a 500:

```auto
https://xxx.prismic.io/api/v2/documents/search?access_token=xxx&ref=Yl_cMBIAACEA6Oqd%3AYmAVhRIAACMA6evQ&q=%5B%5Bat(document.id,%20%22YmATZhIAACUA6eOx%22)%5D%5D

```

_I have omitted our repository name and access token from the above requests but I can assure you they are correct._

Our issue appears similar to the following, which needed to be resolved internally by your DevOps team:

> [@Unexpected 500 on all API-calls](https://community.prismic.io/t/unexpected-500-on-all-api-calls/7641):
>
> Hey, I suddenly got 500 on requests to the API while I was maintaining our webpage yesterday. I did not make any changes that should cause different behaviour towards the API, so I wondered if there is some known internal server errors at the moment? Alternatively; if there is some use limit or potential timeouts visible to administrators/maintainers that I may have exceeded? I get the following error message in the browser and when trying to build the project (have removed the exact repo-name…

Is this something you can help with?

---

<div class="post-metadata">

**Author:** ![martin1](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@martin1](https://community.prismic.io/u/martin1)\
**Post date:** [April 20, 2022, 4:43pm UTC](https://community.prismic.io/t/preview-returning-500-api-internal-error/9827/2 "2022-04-20T16:43:39Z")

</div>

I should add that we have since published another piece of content and the draft preview functionality has stopped 500ing.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [April 20, 2022, 10:13pm UTC](https://community.prismic.io/t/preview-returning-500-api-internal-error/9827/4 "2022-04-20T22:13:10Z")

</div>

Hello @martin1, thanks for reaching out. Maybe this is related to the cache in the browser. You'll need to delete the preview cookie. Also, make sure to always exit the previews correctly using the ‘X’ on the preview module on the bottom left.
