What is YAWAPI?

YAWAPI is a JSON based word generator API based on the Ispell word list. If you have a web application that needs random words, you're at the right spot. YAWAPI is a very simple key based API. You can obtain a key by filling in the host name of the server where the script runs from. The generated key should be passed on to the request for a word as a get parameter with the name 'key'. See below for more details.

· · ·

How can I get a key?

A YAWAPI key can be obtained by filling in the Key Generator form. Add the host name of the server where your application runs from, and a key will be generated. The key can then be copied to or pasted into your application.

Get a key here!

· · ·

How does the api work?

YAWAPI has a url for getting a word: get.php. It requires a key-request parameter to validate your application, i.e. to validate where the request comes from. An example request might look like this:

  • http://vincentbruijn.nl/yawapi/v1/get.php?key=f7d0b4d0
The result will be a JSON string which your application can decode and use:
  • {"response":{"code":200,"word":"some-word"}}
Other possible responses are:
  • {"response":{"code":401,"msg":"Unauthorized. Invalid key."}}
    your license key is invalid.
  • {"response":{"code":200,"msg":"Reached limit."}}
    you have reached the daily limit of 1000 requests.
  • {"response":{"code":400,"msg":"Bad request"}}
    you made a malformed request. This might happen when you forget to add the key parameter to the request.

· · ·

Code example

A PHP script using YAWAPI might look something like this:

$word = "";
$key = "yourkeyhere";
$url = "http://www.vincentbruijn.nl/yawapi/v1/get.php?key=";
$json = @file_get_contents($url . $key);
if ($json !== false) {
  $data = json_decode($json, true);
  if ($data["code"] == 200 && isset($data["word"])) {
    $word = $data["word"];
echo $word;
Be aware that the script you're running is allowed to open URL's using file_get_contents(). This option can be set in the php.ini file. If you do not have access to this configuration file, please contact your Hosting Provider. Another option is to use cURL to retrieve a word.

· · ·