# JS Api: Get all available locales

**URL:** <https://community.prismic.io/t/js-api-get-all-available-locales/1737>\
**Category:** Developing with Prismic\
**Tags:** javascript\
**Created:** [September 3, 2020, 8:17am UTC](https://community.prismic.io/t/js-api-get-all-available-locales/1737 "2020-09-03T08:17:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreas.kratzel](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/andreas.kratzel/32/415_2.png) [@andreas.kratzel](https://community.prismic.io/u/andreas.kratzel)\
**Post date:** [September 3, 2020, 8:17am UTC](https://community.prismic.io/t/js-api-get-all-available-locales/1737/1 "2020-09-03T08:17:10Z")

</div>

Hi there,

with the JS API I want to fetch all available locales. I understood that fetching the api at cdn level returns the `languages` but how would I achieve this using a JS Prismic client? Is there a prismic predicate for it?

The post I'm referring to is this one:

> [@Query all available locales?](https://community.prismic.io/t/query-all-available-locales/1006):
>
> Hi there, is there a way to query all available locales? We are currently building a locale switch for a website will be available in 15+ different countries. I know how i can query the alternative languages as soon as i queried a specific content. But now i would need to find out which locales are generally available even if the content i currently look at hasn't been published to that locale yet. In this case we would want to send the user to the home page of that locale as a backup solution.…

Thx

---

<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 3, 2020, 9:16am UTC](https://community.prismic.io/t/js-api-get-all-available-locales/1737/2 "2020-09-03T09:16:51Z")

</div>

Hi Andreas,

You just need to query the api to get that info using the method described here:

> **[prismicio/prismic-javascript](https://github.com/prismicio/prismic-javascript#query-the-content)**
>
> Javascript kit for API V2. Contribute to prismicio/prismic-javascript development by creating an account on GitHub.

So to get the languages it would be something like:

```auto
Prismic.api("https://your-repository-name.cdn.prismic.io/api/v2").then(function(api) {
  languages = api.data.languages
});

```

Let me know if this helps.

---

<div class="post-metadata">

**Author:** ![Fares](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Fares](https://community.prismic.io/u/Fares)\
**Post date:** [September 24, 2020, 12:46pm UTC](https://community.prismic.io/t/js-api-get-all-available-locales/1737/3 "2020-09-24T12:46:19Z")

</div>

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

This issue has been closed due to inactivity.

---

<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:21pm UTC](https://community.prismic.io/t/js-api-get-all-available-locales/1737/4 "2021-12-09T17:21:17Z")

</div>

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


