Create a Language

Endpoint Overview

This endpoint allows you to create a new language in your Venddor store. Languages are essential for providing multilingual experiences to your customers.

POST /api/languages/

Request Parameters

Send a POST request with the following parameters in the HTTP request body. The format should follow your specified Content-Type.

Parameter Type Required Description
lang_code* string Yes Two-letter language code. Must be unique among all installed languages.
name* string Yes The display name of the language.
status string No Language status: A (active), H (hidden), or D (disabled).
country_code string No ISO code of the country (in capital letters). Determines the flag icon shown in the administration panel and storefront.
from_lang_code string No The language code to copy language variables from. If not specified, variables will be taken from CART_LANGUAGE.
Important: Do not use the lang_code of any languages that come with Venddor, or that language will disappear from the list until you delete the language you created.
Tip: Write country_code in capital letters (e.g., "US" for United States). You can find a list of ISO country codes at countrycode.org.
Note: Sending a POST request to /api/languages/?sl=en will have the same effect as specifying "from_lang_code": "en" in the JSON body.

Example Request

{
  "lang_code": "ts",
  "name": "Test",
  "status": "A",
  "country_code": "US",
  "from_lang_code": "en"
}

Response Format

Success Response (201 Created)

{
  "lang_id": 3
}

Error Response (400 Bad Request)

Returned when the language couldn't be created due to invalid parameters or other issues.

Implementation Notes

When creating a new language, consider the following best practices: