Skip to content

Get Single Locale

Retrieve detailed information for a specific language locale.

Endpoint

GET /api/shop/locales/{id}

Path Parameters

ParameterTypeRequiredDescriptionExample
idstring/integerYesLocale identifier1

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/1' \
  -H 'accept: application/json' \
  -H 'X-STOREFRONT-KEY: pk_storefront_PvlE42nWGsKRVIf8bDlJngTPAdWAZbIy'

JavaScript/Fetch Example

javascript
fetch('https://your-domain.com/api/shop/locales/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., 94)
X-RateLimit-ResetUnix timestamp when limit resets
X-Built-WithBagisto
Cache-Controlno-cache,private

Error Responses

404 Not Found

json
{
  "message": "Locale not found",
  "errors": {
    "id": [
      "The specified locale does not exist"
    ]
  }
}

401 Unauthorized

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

Text Direction

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

Use Cases

  • Get locale details for content rendering
  • Validate locale codes
  • Display locale information
  • Set up locale-specific formatters
  • Configure RTL layout
  • Fetch native language name

Common Locale IDs

  • 1 - English (en)
  • 2 - French (fr)
  • 3 - Arabic (ar)
  • Check Get All Locales for complete list

Released under the MIT License.