Skip to content

Get All Locales

Retrieve all available language locales supported by your store.

Endpoint

GET /api/shop/locales

Query Parameters

ParameterTypeRequiredDescriptionExample
pageintegerNoPagination page number1
per_pageintegerNoItems per page (max: 100)10

Request Headers

HeaderTypeRequiredDescriptionExample
X-STOREFRONT-KEYstringYesStorefront API key for authenticationpk_storefront_PvlE42nWGsKRVIf8bDlJngTPAdWAZbIy
AcceptstringNoResponse formatapplication/json

Response Fields (200 OK)

FieldTypeDescription
idintegerLocale ID
codestringLanguage code (ISO 639-1, e.g., en, fr, ar)
namestringEnglish locale name
directionstringText direction (ltr=left-to-right, rtl=right-to-left)
logoPathstringLogo path in storage
logoUrlstringFull URL to locale logo

cURL Example

bash
curl -X GET 'http://127.0.0.1:8000/api/shop/locales?page=1' \
  -H 'accept: application/json' \
  -H 'X-STOREFRONT-KEY: pk_storefront_PvlE42nWGsKRVIf8bDlJngTPAdWAZbIy'

JavaScript/Fetch Example

javascript
fetch('https://your-domain.com/api/shop/locales?page=1', {
  method: 'GET',
  headers: {
    'Accept': 'application/json',
    'X-STOREFRONT-KEY': 'pk_storefront_PvlE42nWGsKRVIf8bDlJngTPAdWAZbIy'
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Response Headers

HeaderDescription
Content-Typeapplication/json; charset=utf-8
X-RateLimit-LimitMaximum requests allowed per minute (e.g., 100)
X-RateLimit-RemainingRemaining requests in current window (e.g., 95)
X-RateLimit-ResetUnix timestamp when limit resets
X-Built-WithBagisto

Error Responses

401 Unauthorized

json
{
  "message": "Unauthorized",
  "errors": {
    "X-STOREFRONT-KEY": [
      "The X-STOREFRONT-KEY header is missing or invalid"
    ]
  }
}

400 Bad Request

json
{
  "message": "Invalid parameters",
  "errors": {
    "page": [
      "The page parameter must be a valid integer"
    ]
  }
}

Language Codes

Common ISO 639-1 codes:

  • en - English
  • fr - French
  • de - German
  • es - Spanish
  • it - Italian
  • pt - Portuguese
  • ar - Arabic
  • zh - Chinese
  • ja - Japanese

Text Direction

  • ltr - Left-to-right (Latin, Cyrillic scripts)
  • rtl - Right-to-left (Arabic, Hebrew)

Use Cases

  • Build language/locale selector dropdowns
  • Support multi-language storefront
  • Display locale-specific content
  • Set user language preferences
  • Load locale-specific product information
  • Render RTL layouts for Arabic/Hebrew

Released under the MIT License.