API Documentation

Complete reference for the Word Generation API endpoints, parameters, and responses.

Authentication

API Key Required

All API endpoints require authentication using an API key. You can provide the API key in one of two ways:

  1. As a header: X-API-Key: your-api-key
  2. As a query parameter: ?apiKey=your-api-key

Keep your API key secure and never share it publicly.

Endpoints

GET

/api

List all available API endpoints and their parameters.

Example Request

curl -H "X-API-Key: your-api-key" https://your-domain.com/api

Example Response

{
  "name": "Word Generation API",
  "version": "1.0.0",
  "endpoints": {
    "/api": {
      "method": "GET",
      "description": "List all available API endpoints",
      "authentication": "Requires X-API-Key header or apiKey query parameter"
    },
    "/api/words": {
      "method": "GET",
      "description": "Generate words based on criteria",
      "authentication": "Requires X-API-Key header or apiKey query parameter",
      "parameters": {
        "language": "Language of the words (default: english)",
        "theme": "Theme of the words (e.g., nature, technology)",
        "relatedTo": "Words related to a specific concept",
        "letterCount": "Exact number of letters in each word",
        "maxWords": "Maximum number of words to return (default: 10)"
      }
    }
  }
}
GET

/api/words

Generate a list of words based on specified criteria.

Query Parameters

Parameter Type Description
language string Language of the words (default: "english")
letterCount number Exact number of letters in each word
maxWords number Maximum number of words to return (default: 10)
theme string Theme of the words (e.g., "nature", "technology")
relatedTo string Words related to a specific concept

Example Request

curl -H "X-API-Key: your-api-key" "https://your-domain.com/api/words?language=english&theme=nature&maxWords=5&letterCount=5"

Example Response

{
  "success": true,
  "words": ["grass", "river", "plant", "cloud", "beach"],
  "count": 5,
  "language": "english"
}

Error Handling

The API returns appropriate HTTP status codes and error messages:

Status Code Description
401 Missing API key
403 Invalid API key
500 Server-side errors

Error Response Format

{
  "success": false,
  "error": "Error message here"
}