# Need the list of Error code for prismic API

**URL:** <https://community.prismic.io/t/need-the-list-of-error-code-for-prismic-api/14209>\
**Category:** Developing with Prismic\
**Tags:** nextjs, product-feature-idea, rest-api\
**Created:** [September 29, 2023, 9:28am UTC](https://community.prismic.io/t/need-the-list-of-error-code-for-prismic-api/14209 "2023-09-29T09:28:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![headout](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/headout/32/4477_2.png) [@headout](https://community.prismic.io/u/headout)\
**Post date:** [September 29, 2023, 9:28am UTC](https://community.prismic.io/t/need-the-list-of-error-code-for-prismic-api/14209/1 "2023-09-29T09:28:08Z")

</div>

To handle error codes in our web application, especially when the Prismic API was down recently and it was affecting our service, we need to implement cache control mechanisms for such situations.

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [September 29, 2023, 2:03pm UTC](https://community.prismic.io/t/need-the-list-of-error-code-for-prismic-api/14209/3 "2023-09-29T14:03:52Z")

</div>

Hi @headout,

I'll look into this and get back to you.

Sam

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [October 11, 2023, 11:56am UTC](https://community.prismic.io/t/need-the-list-of-error-code-for-prismic-api/14209/5 "2023-10-11T11:56:20Z")

</div>

Hi @headout,

I asked our infrastructure team, and they gave me the following list of status codes:

200, 302, 400, 401, 403, 404, 410, 422, 500, 502

We don't have this documented anywhere. However, in `@prismicio/client` you can see the error messages for the most common status codes:

> <https://github.com/prismicio/prismic-client/blob/163d03ebaa38849c7816cc5a82f95e4fffb3b7fc/src/createClient.ts#L1883>

We're going to work on getting full documentation in our technical reference. Thanks for raising this!

Sam

---

<div class="post-metadata">

**Author:** ![headout](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/headout/32/4477_2.png) [@headout](https://community.prismic.io/u/headout)\
**Post date:** [November 21, 2023, 12:02pm UTC](https://community.prismic.io/t/need-the-list-of-error-code-for-prismic-api/14209/7 "2023-11-21T12:02:55Z")

</div>

Hey @samlittlefair , thanks for the reply. Is there any way we can test this error code, similar like a test environment. The use case is that we we will be handling the prismic 5XX with above error code 500 and 502,and we want to test this scenario.

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [November 23, 2023, 3:34pm UTC](https://community.prismic.io/t/need-the-list-of-error-code-for-prismic-api/14209/9 "2023-11-23T15:34:36Z")

</div>

Hi @headout,

That's an interesting question! In short, no. We don't have any way to test internal server errors. I'll keep that in mind as we work on our error handling, though.

Sam

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [May 7, 2024, 1:28pm UTC](https://community.prismic.io/t/need-the-list-of-error-code-for-prismic-api/14209/12 "2024-05-07T13:28:12Z")

</div>

> [@Prismic API HTTP Status Codes and Errors Explained](https://community.prismic.io/t/prismic-api-http-status-codes-and-errors-explained/14813):
>
> Error Code Exact Meaning Likely Cause Likely Fix 000 000 indicates that the viewer closed the connection before the server could respond to the request. If the viewer closes the connection after the server starts to send the response, this field contains the HTTP status code of the response that the server started to send. - User application didn’t wait long enough for response killed request - Check the retries in your application 200 200 OK success status response code indicates that…
