Reference

Public Endpoints

get
https://api.weglot.com
/public/status
Status
No content is returned by this endpoint, you will only get a 200 status code if the service is up and running.
This is only a health check endpoint, don't spam it.
get
https://api.weglot.com
/public/languages
List languages
get
https://api.weglot.com
/public/languages/is-supported
Is language pair supported

Authenticated Endpoints

Weglot requires an API key to allow access to its endpoints. You can register and get a Weglot API Key at: Register.
The API key is to be included in all API requests to the server in the URL as the value of the api_key parameter, as follows:
https://api.weglot.com/endpoint?api_key=my_api_key
Make sure to replace my_api_key with your Weglot API key.
post
https://api.weglot.com
/translate?api_key=my_api_key
Translate
You can find WordType and BotType resources at the end of this document.
Here is a simple request example:
HTTP
cURL
1
POST /translate?api_key=my_api_key HTTP/1.1
2
Host: api.weglot.com
3
Content-Type: application/json
4
5
{
6
"l_from":"en",
7
"l_to":"fr",
8
"request_url":"https://www.website.com/",
9
"words":[
10
{"w":"This is a blue car", "t": 1},
11
{"w":"This is a black car", "t": 1}
12
]
13
}
Copied!
1
curl -X POST \
2
'https://api.weglot.com/translate?api_key=my_api_key' \
3
-H 'Content-Type: application/json' \
4
-d '{
5
"l_from":"en",
6
"l_to":"fr",
7
"request_url":"https://www.website.com/",
8
"words":[
9
{"w":"This is a blue car", "t": 1},
10
{"w":"This is a black car", "t": 1}
11
]
12
}'
Copied!

Resources

BotType

Used to define the source of a request.
Short-Name
Value
Description
HUMAN
0
Sent from human action
OTHER
1
Sent from unknown source
GOOGLE
2
Sent from Google Bot
BING
3
Sent from Bing Bot
YAHOO
4
Sent from Yahoo Bot
BAIDU
5
Sent from Baidu Bot
YANDEX
6
Sent from Yandex Bot

WordType

Used to provide context over where the text we wish to translate comes from. Any general text node is of WordType 1. We use the WordType to classify translations on the admin dashboard.
Short name
Value
Description
OTHER
0
None of the elements below (deprecated)
TEXT
1
General text (used most of the time)
VALUE
2
The value of an input tag'svalueattribute
PLACEHOLDER
3
The value of an input tag's placeholderattribute
META_CONTENT
4
The value of a meta tags' content attribute
IFRAME_SRC
5
The src link to a page used in an iframe
IMG_SRC
6
The srcvalue of an imgtag
IMG_ALT
7
The alt value of an imgtag
PDF_HREF
8
A URL pointing to a PDF document
PAGE_TITLE
9
Text from title tag
EXTERNAL_LINK
10
External links when dashboard option is enabled
Last modified 1yr ago