🌍 Translation API

Effortlessly translate text into multiple languages using our simple and powerful API.

📌 Overview

The Translation API offers a variety of endpoints designed to easily translate text into multiple languages. This guide provides clear instructions for using each of the available API endpoints.

🌍 Base URL

https://translate.zamdev.dev/api/translate

🔹 API Endpoints

1️⃣ Standard Translation

📌 Endpoint: /api/translate

📜 Method: GET

📄 Description: Translates a given text into a target language. For example: Translate 'Hello world' to Spanish (es).

📤 Example Request:

https://translate.zamdev.dev/api/translate?text=Hello%20world&tr=es
                

📤 Example Response:

{
    "status": "success",
    "code": 200,
    "timestamp": "2025-03-04 05:57:33",
    "execution_time": "0.5202s",
    "translations": {
        "es": "Hola Mundo"
    }
}
                

2️⃣ Multi-Language Translation

📌 Endpoint: /api/translate

📜 Method: GET

📄 Description: Translates a given text into multiple target languages simultaneously. For example: Translate 'Hello world' to French, German, and Spanish.

📤 Example Request:

https://translate.zamdev.dev/api/translate?text=Hello%20world&tr[]=fr&tr[]=de&tr[]=es
                

📤 Example Response:

{
    "status": "success",
    "code": 200,
    "timestamp": "2025-03-04 05:52:49",
    "execution_time": "0.5434s",
    "translations": {
        "fr": "Bonjour le monde",
        "de": "Hallo Welt",
        "es": "Hola Mundo"
    }
}
                

3️⃣ POST Method (Single Translation)

📌 Endpoint: /api/translate

📜 Method: POST

📄 Description: Sends translation data in the body for a single translation request.

📤 Example Request:

{
    "text": "Hello world",
    "tr": "es"
}
                

📤 Example Response:

{
    "status": "success",
    "code": 200,
    "timestamp": "2025-03-04 05:57:33",
    "execution_time": "0.5202s",
    "translations": {
        "es": "Hola Mundo"
    }
}
                

4️⃣ POST Method (Multi-Language Translation)

📌 Endpoint: /api/translate

📜 Method: POST

📄 Description: Allows sending multiple translation targets in the request body for translating text to various languages at once.

📤 Example Request:

{
    "text": "Hello world",
    "tr": ["so", "es", "fr"]
}
                

📤 Example Response:

{
    "status": "success",
    "code": 200,
    "timestamp": "2025-03-04 06:51:03",
    "execution_time": "0.5402s",
    "translations": {
        "so": "Salaan World",
        "es": "Hola Mundo",
        "fr": "Bonjour le monde"
    }
}