Skip to main content
GET
/
admin
/
locales
JS SDK
import Medusa from "@medusajs/js-sdk"

export const sdk = new Medusa({
  baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
  debug: import.meta.env.DEV,
  auth: {
    type: "session",
  },
})

sdk.admin.locale.list()
.then(({ locales, count, limit, offset }) => {
  console.log(locales)
})
{ "limit": 123, "offset": 123, "count": 123, "locales": [ { "code": "fr-FR", "name": "<string>", "created_at": "2023-11-07T05:31:56Z", "updated_at": "2023-11-07T05:31:56Z", "deleted_at": "2023-11-07T05:31:56Z" } ], "estimate_count": 123 }

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

q
string

Search query to filter locales by code or other fields.

code

Filter locales by a code.

limit
number

Limit the number of items returned in the list.

offset
number

The number of items to skip when retrieving a list.

order
string

The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.

with_deleted
boolean

The locale's with deleted.

fields
string

Comma-separated fields that should be included in the returned data. If a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. Without prefix it will replace the entire default fields.

$and
$and · object[]

Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.

$or
$or · object[]

Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.

Response

OK

The list of locales with pagination details.

limit
number
required

The maximum number of locales returned.

offset
number
required

The number of locales skipped before retrieving the returned locales.

count
number
required

The total number of locales matching the query.

locales
object[]
required

The list of locales.

estimate_count
number

The estimated count retrieved from the PostgreSQL query planner, which may be inaccurate.