Skip to main content

You can integrate BusinessEnglish.ai into any software using our simple, powerful API.

To request an API key, contact us.

We recommend – but do not require – that you release your BusinessEnglish.ai API integrations under the open-source General Public License. If you’re working on a public BusinessEnglish.ai-powered tool, please share it with us so we can promote it and give you free message credits for testing.

Getting Started

You’ll need to create a free BusinessEnglish.ai account to get your API key. Please note that you shouldn’t include your own key in a publicly accessible application, since other users would then be able to use your message quota. Instead, build a way for your users to enter their own BusinessEnglish.ai API key.

Sending an API request is easy. Here’s the endpoint:

https://businessenglish.ai/wp-json/api/v1/messages

Send a POST request with three elements: accent, context and message. The value of message should be the text you want to transform into professional English. Accent defaults to American but also accepts Australian, British and Canadian. Context defaults to chat and also accepts email or social.

Send a header called Authorization with the value Bearer: [Your API Key].

Here’s a full example PHP cURL Request:

function business_english_generate_message($message, $api_key, ){
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://businessenglish.ai/wp-json/api/v1/messages',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => array('message' => $message, 'context' => $context, 'accent' => $accent),
    CURLOPT_HTTPHEADER => array(
        'Authorization: Bearer '. $api_key
        ),
    ));

    $response = curl_exec($curl);
    curl_close($curl);
    return json_decode($response);
}

A successful response will contain the professional English version of your message, as well as your current message credit quota (tokens) and how much of that quota you’ve used to date (used_tokens). Here’s an example:

{
    "tokens": "100",
    "used_tokens": "10",
    "result": [The message generated by BusinessEnglish.ai]
}

If you receive an error in response, it will look like this:

{
    "code": "rest_forbidden",
    "message": "Your API key is invalid.",
    "data": {
        "status": 401
    }
}

Two possible error messages are Your API key is invalid. and You've used all the message credits for this API key. Add more at BusinessEnglish.ai.

Please note that every time you hit this endpoint and get a successful response, it will deduct one message credit from your balance.

Checking Your Message Quota

To check the remaining message credits associated with your API key, send the same request as above to the following endpoint. Please note that you do not need any POST array on this request, but it should still be set up as a POST request (i.e. as if you had submitted an empty form).

https://businessenglish.ai/wp-json/api/v1/get_available_tokens

This will return JSON showing your remaining message credits. Hitting this endpoint does not deduct from your credit balance, but we may rate-limit this endpoint within reason.

Questions?

If you’d like to talk shop about building an API integration, we’re here to help.