The Credit Data API allows you to retrieve information about a site's word credits. When a Wix user installs the Wix Multilingual app on their site, the site receives a free word credit quota. These credits are consumed when the Machine Translation API translates text from one language to another, with each credit representing 1 word translated.
With the Credit Data API, you can:
It's important to note the following points before starting to code:
This article presents some possible use cases you can support. This can be a helpful jumping off point as you plan your implementation.
You can check whether a site has enough credits before initiating the machine translation process.
Calculate the total number of words that need to be translated.
Call Check Sufficient Credits and specify the word count to determine whether the site has enough credits for the translation.
If there are sufficient credits, use the Machine Translation API to translate the content. If not, the Wix user needs to purchase additional credits in the Translation Manager.
You can create a dashboard that displays the credit quota, usage, and remaining credits for multiple sites.
For each site, periodically call Get Credit Data to obtain the quota type, quota amount, and the number of credits used at a given time.
For sites with a limited quota, calculate the remaining credits by subtracting the used credits from the quota.
Display this data in your dashboard and a notification system to alert Wix users when their site's credit balance is running low.
Total number of word credits consumed by a site. For sites with an unlimited word credit quota, this property still reflects the number of credits used, even though no usage limit applies.
Quota type.
Limited word credit quota.
{
"creditData": {
"creditsUsed": 100,
"quotaType": "LIMITED",
"limitedQuota": {
"quota": 3000
}
}
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a site's word credit data.
For sites with a limited quota, you can calculate the available word credits by subtracting the credits used from the quota.
For example, if a site has a quota of 100 credits and all credits have been used ("creditsUsed": 100
), the available word credits will be 0.
If a Wix user purchases an additional 50 credits, the quota
will increase to 150
, and the site will have 50 available word credits.
Credit data.
curl -X GET \
'https://www.wixapis.com/translation-credits/v1/credit' \
-H 'Authorization: <AUTH>'
{
"creditData": {
"creditsUsed": 456,
"quotaType": "LIMITED",
"limitedQuota": {
"quota": 12999
}
}
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Checks whether a site has enough credits to translate the specified number of words.
Number of words to translate.
Whether the site has enough credits to translate the specified number of words.
curl -X GET \
'https://www.wixapis.com/translation-credits/v1/credit/is-eligible' \
-H 'Authorization: <AUTH>' \
-d '{
"wordCount": 100
}'
{
"sufficientCredits": true
}
There is 1 error with this status code:
See the entire list and learn more about Wix errors.