Locales API Routes

A locale is a language that content is translated into for customers to view in a storefront. Medusa installs locales by default. These API routes allow admin users to retrieve and view locales.

GET /admin/locales#

List Locales

Retrieve a list of locales. The locales can be filtered by fields such as code. The locales can also be sorted or paginated.

Feature flag: This API route is only available when the translation feature flag is enabled. Set the MEDUSA_FF_TRANSLATION environment variable to true to enable it.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Query parameters

qstringOptional
Search query to filter locales by code or other fields.
codestring | string[]Optional
Filter locales by a code.
limitnumberOptional
Limit the number of items returned in the list.
offsetnumberOptional
The number of items to skip when retrieving a list.
orderstringOptional
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_deletedbooleanOptional
The locale's with deleted.
fieldsstringOptional
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.
$andobject[]Optional
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
$orobject[]Optional
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.

Request examples

Responses

200 OK

limitnumber
The maximum number of locales returned.
offsetnumber
The number of locales skipped before retrieving the returned locales.
countnumber
The total number of locales matching the query.
estimate_countnumberOptional
The estimated count retrieved from the PostgreSQL query planner, which may be inaccurate.
localesobject[]
The list of locales.

400, 401, 404, 409, 422, 500: an error response is returned.


GET /admin/locales/{code}#

Get a Locale

Retrieve a locale by its code. You can expand the locale's relations or select the fields that should be returned.

Feature flag: This API route is only available when the translation feature flag is enabled. Set the MEDUSA_FF_TRANSLATION environment variable to true to enable it.

Authentication: secret API key (HTTP Basic authorization), cookie session, JWT bearer token.

Path parameters

codestring
The locale's code in BCP 47 format.

Query parameters

fieldsstringOptional
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.

Request examples

Responses

200 OK

localeobject
The locale's details.

400, 401, 404, 409, 422, 500: an error response is returned.

Found a problem with this page?Report Issue
Edited Nov 14·Edit this page