# Timeout support

**URL:** <https://community.prismic.io/t/timeout-support/609>\
**Category:** Developing with Prismic\
**Tags:** javascript\
**Created:** [June 1, 2020, 8:21am UTC](https://community.prismic.io/t/timeout-support/609 "2020-06-01T08:21:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![david.halewood](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@david.halewood](https://community.prismic.io/u/david.halewood)\
**Post date:** [June 1, 2020, 8:21am UTC](https://community.prismic.io/t/timeout-support/609/1 "2020-06-01T08:21:59Z")

</div>

Hi 👋, I noticed on the release notes that there was support for a timeout now in prismic-javascript v2.6.0 and up. I couldn't find any documentation around this. Please can you advise whether we can send a timeout in the request to the cdn or when using the api object?

---

<div class="post-metadata">

**Author:** ![Levi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/levi/32/24_2.png) [@Levi](https://community.prismic.io/u/Levi)\
**Post date:** [June 1, 2020, 3:48pm UTC](https://community.prismic.io/t/timeout-support/609/2 "2020-06-01T15:48:17Z")

</div>

Hi @david.halewood, I’m not sure about this, so I’ll have to pass this over to the [@team-tech-support](https://community.prismic.io/groups/team-tech-support). Someone there will get back to you as soon as they are able.

---

<div class="post-metadata">

**Author:** ![renaud](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/renaud/32/138_2.png) [@renaud](https://community.prismic.io/u/renaud)\
**Post date:** [June 2, 2020, 10:50am UTC](https://community.prismic.io/t/timeout-support/609/3 "2020-06-02T10:50:30Z")

</div>

> [@david.halewood](#):
>
> Hi 👋, I noticed on the release notes that there was support for a timeout now in prismic-javascript v2.6.0 and up. I couldn’t find any documentation around this. Please can you advise whether we can send a timeout in the request to the cdn or when using the api object?

Hey @david.halewood, Thanks for the report. I just created an issue on the prismic-javascript kit that you can follow here.

> <https://github.com/prismicio/prismic-client/issues/129>
>
> The release notes mention now the support for a timeout in prismic-javascript v2….6.0 and up. 
> 
> Could you document how to proceed please and can you advise whether we can send a timeout in the request to the cdn or when using the api object?
> 
> Thanks

Don't hesitate to add your issue here in the future.

Thanks a lot.  
Renaud

---

<div class="post-metadata">

**Author:** ![david.halewood](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@david.halewood](https://community.prismic.io/u/david.halewood)\
**Post date:** [June 2, 2020, 12:30pm UTC](https://community.prismic.io/t/timeout-support/609/4 "2020-06-02T12:30:35Z")

</div>

Thanks for that.

David

---

<div class="post-metadata">

**Author:** ![hugo.villain](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/hugo.villain/32/186_2.png) [@hugo.villain](https://community.prismic.io/u/hugo.villain)\
**Post date:** [June 2, 2020, 1:58pm UTC](https://community.prismic.io/t/timeout-support/609/5 "2020-06-02T13:58:16Z")

</div>

Hey @david.halewood,

to use a custom timeout, you should pass a `timeoutInMs` prop when instantiating the API. The documentation is a bit arid at the time of writing but you can find out more right here: [https://prismicio.github.io/prismic-javascript/classes/httpclient.html](https://prismicio.github.io/prismic-javascript/classes/httpclient.html)

Here are all the available API options: [source code](https://github.com/prismicio/prismic-javascript/blob/26c0ba7dda35e7fa9930f41dc15e4e60d1966da3/src/Api.ts#L6).

Hope it helps ✌

---

<div class="post-metadata">

**Author:** ![david.halewood](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@david.halewood](https://community.prismic.io/u/david.halewood)\
**Post date:** [June 8, 2020, 5:45pm UTC](https://community.prismic.io/t/timeout-support/609/6 "2020-06-08T17:45:46Z")

</div>

Hey @hugo.villain, thanks for your reply. I’m a bit confused though.

Let me say what I’m hoping for and then you can let me know if it’s supported.

We:

- get the API handler from Prismic using the `getApi` from `prismic-javascript`
- call `.query` to get the content using Predicates.

Can I use a timeout in this circumstance? I think not right?

---

<div class="post-metadata">

**Author:** ![david.halewood](https://avatars.discourse-cdn.com/v4/letter/d/c37758/32.png) [@david.halewood](https://community.prismic.io/u/david.halewood)\
**Post date:** [June 8, 2020, 5:56pm UTC](https://community.prismic.io/t/timeout-support/609/7 "2020-06-08T17:56:54Z")

</div>

I figured it out:

```auto
(await getApi(PRISMIC_API_HOST, {
  accessToken: PRISMIC_ACCESS_TOKEN,
  timeoutInMs: 1500
}));

```

Cheers 👍

---

<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:** [September 15, 2020, 4:46pm UTC](https://community.prismic.io/t/timeout-support/609/8 "2020-09-15T16:46:10Z")

</div>

closed on September 15, 2020, 4:46pm UTC, flag & select 'Something Else' to reopen.



---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 5:37pm UTC](https://community.prismic.io/t/timeout-support/609/9 "2021-12-09T17:37:00Z")

</div>

Opened on December 9, 2021, 5:37pm UTC


