About the Credit Data API

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:

  • Retrieve a site's word credit data.
  • Check whether a site has enough credits to translate a specific number of words.

Before you begin

It's important to note the following points before starting to code:

  • You can only use this API on sites where the Wix user has installed the Wix Multilingual app.
  • Wix users can receive additional word credits by purchasing a translation package in the Translation Manager at any time. These additional credits get added to the site's quota.
  • For sites with a limited quota, you can calculate the current 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, the available word credits will be 0. If a Wix user purchases an additional 50 credits, the total quota will increase to 150, and the site will have 50 available word credits.
  • Apps that use machine translation deduct credits from the site's word credit balance.

Use cases

Terminology

  • Word credit: A unit of translation capacity, where 1 credit equals 1 word to translate. Each site has a word credit balance indicating the number of words available for translation.
  • Quota: Total number of credits allocated to the site. Currently, sites have a quota limit, with the exception of Wix Studio enterprise sites, which have an unlimited quota.
Did this help?

Sample Use Cases and Flows

This article presents some possible use cases you can support. This can be a helpful jumping off point as you plan your implementation.

Check credits before using machine translation

You can check whether a site has enough credits before initiating the machine translation process.

  1. Calculate the total number of words that need to be translated.

  2. Call Check Sufficient Credits and specify the word count to determine whether the site has enough credits for the translation.

  3. 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.

Create a translation credit dashboard

You can create a dashboard that displays the credit quota, usage, and remaining credits for multiple sites.

  1. 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.

  2. For sites with a limited quota, calculate the remaining credits by subtracting the used credits from the quota.

  3. Display this data in your dashboard and a notification system to alert Wix users when their site's credit balance is running low.

Did this help?

Credit Data Object


Properties
creditsUsedintegerminimum 0format int32

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.


quotaTypestring

Quota type.


limitedQuotaLimitedQuotaRead-only

Limited word credit quota.

CreditData
JSON
{ "creditData": { "creditsUsed": 100, "quotaType": "LIMITED", "limitedQuota": { "quota": 3000 } } }
Did this help?

GET

Get Credit Data


Developer Preview

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.

Endpoint
GET
https://www.wixapis.com/translation-credits/v1/credit

Request
This endpoint does not take any parameters.
Response Object
creditDataCreditData

Credit data.

Get Credit Data
Request
cURL
curl -X GET \ 'https://www.wixapis.com/translation-credits/v1/credit' \ -H 'Authorization: <AUTH>'
Response
JSON
{ "creditData": { "creditsUsed": 456, "quotaType": "LIMITED", "limitedQuota": { "quota": 12999 } } }
Did this help?

POST

Check Sufficient Credits


Developer Preview

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.

Endpoint
POST
https://www.wixapis.com/translation-credits/v1/credit/is-eligible

Body Params
wordCountintegerRequiredminimum 0

Number of words to translate.

Response Object
sufficientCreditsboolean

Whether the site has enough credits to translate the specified number of words.

Check Sufficient Credits
Request
cURL
curl -X GET \ 'https://www.wixapis.com/translation-credits/v1/credit/is-eligible' \ -H 'Authorization: <AUTH>' \ -d '{ "wordCount": 100 }'
Response
JSON
{ "sufficientCredits": true }
Errors
404Not Found

There is 1 error with this status code:

See the entire list and learn more about Wix errors.

Did this help?