API Documentation

Overview

The Different Synonym API provides RESTful access to our comprehensive synonym database. All responses are in JSON format and require no authentication for basic endpoints.

Base URL: https://differentsynonym.com/api

Rate Limit: 100 requests per hour (free tier)

Endpoints

GET /synonyms/:word

Get synonyms for a specific word

Returns detailed information about a word including its synonyms, antonyms, etymology, and common misuses.

Parameters

Parameter Type Description
word string The word to search for (URL encoded)

Example Request

curl "https://differentsynonym.com/api/synonyms/different"

Example Response

{ "id": "different-1", "word": "different", "partOfSpeech": "adjective", "definition": "not the same as another; unlike", "synonyms": [ { "word": "distinct", "definition": "recognizably different in nature", "example": "The two companies have distinct business models.", "frequency": "very common", "tone": "formal" } ], "antonyms": ["same", "identical"], "etymology": "From Old French 'differencier'..." }
GET /search

Search for words and synonyms

Searches across all words and their synonyms in the database. Returns up to 20 results.

Parameters

Parameter Type Description
q string Search query (minimum 2 characters)

Example Request

curl "https://differentsynonym.com/api/search?q=happy"
GET /random

Get a random word entry

Returns a random entry from the synonym database.

Example Request

curl "https://differentsynonym.com/api/random"
GET /quiz

Generate quiz questions

Returns 10 random quiz questions for synonym testing.

Example Request

curl "https://differentsynonym.com/api/quiz"

Code Examples

JavaScript

fetch('https://differentsynonym.com/api/synonyms/different') .then(res => res.json()) .then(data => { console.log('Synonyms for "' + data.word + '":'); data.synonyms.forEach(syn => { console.log('- ' + syn.word + ': ' + syn.definition); }); });

Python

import requests response = requests.get('https://differentsynonym.com/api/synonyms/happy') data = response.json() print(f"Synonyms for '{data['word']}':") for synonym in data['synonyms']: print(f" - {synonym['word']}: {synonym['definition']}")

cURL

curl -X GET \ "https://differentsynonym.com/api/synonyms/beautiful" \ -H "Content-Type: application/json"

Error Handling

The API returns appropriate HTTP status codes and error messages:

Status Code Description
200 Successful request
400 Bad request (e.g., search query too short)
404 Word not found in database
429 Rate limit exceeded
500 Server error

Questions or Issues?

If you encounter any issues or have questions about the API, please contact us at api@differentsynonym.com