📚 API Examples

Copy-paste ready code for Python, Bash, PHP, JavaScript, and Go

📨 Send Text Message

Send simple or HTML-formatted text messages

Python
import requests

def send_message(api_key: str, message: str):
    url = "https://t69.me"

    # Recommended: Use X-API-Key header
    headers = {
        "X-API-Key": api_key
    }

    data = {
        "message": message
    }

    response = requests.post(url, json=data, headers=headers)

    if response.status_code == 200:
        print("✅ Message sent successfully!")
    else:
        print(f"❌ Failed: {response.text}")

# Usage
api_key = "your-api-key-here"
send_message(api_key, "Hello from Python!")
send_message(api_key, "Bold and italic text")
Bash
#!/bin/bash

API_KEY="your-api-key-here"
MESSAGE="Hello from Bash!"

# Method 1: Using X-API-Key header (Recommended)
curl -X POST https://t69.me \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{"message": "$MESSAGE"}"

# Method 2: Using Authorization Bearer header (Also recommended)
curl -X POST https://t69.me \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d "{"message": "$MESSAGE"}"
PHP
<?php

function sendMessage($apiKey, $message) {
    $url = "https://t69.me";

    $data = array("message" => $message);

    // Recommended: Use X-API-Key header
    $options = array(
        'http' => array(
            'header'  => "Content-Type: application/json\r\n" .
                         "X-API-Key: $apiKey\r\n",
            'method'  => 'POST',
            'content' => json_encode($data)
        )
    );

    $context = stream_context_create($options);
    $result = file_get_contents($url, false, $context);

    if ($result === FALSE) {
        echo "❌ Error sending message\n";
    } else {
        echo "✅ Message sent successfully!\n";
    }
}

// Usage
$apiKey = "your-api-key-here";
sendMessage($apiKey, "Hello from PHP!");

?>
JavaScript
const axios = require('axios');

async function sendMessage(apiKey, message) {
    const url = 'https://t69.me';

    try {
        // Recommended: Use X-API-Key header
        const response = await axios.post(url,
            { message: message },
            {
                headers: {
                    'X-API-Key': apiKey,
                    'Content-Type': 'application/json'
                }
            }
        );

        console.log('✅ Message sent successfully!');
        console.log(response.data);
    } catch (error) {
        console.error('❌ Error:', error.message);
    }
}

// Usage
const apiKey = 'your-api-key-here';
sendMessage(apiKey, 'Hello from Node.js!');
Go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
)

func sendMessage(apiKey, message string) error {
    apiURL := "https://t69.me"

    data := map[string]string{
        "message": message,
    }

    jsonData, _ := json.Marshal(data)

    req, _ := http.NewRequest("POST", apiURL, bytes.NewBuffer(jsonData))

    // Recommended: Use X-API-Key header
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("X-API-Key", apiKey)

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
        return err
    }
    defer resp.Body.Close()

    fmt.Println("✅ Message sent successfully!")
    return nil
}

func main() {
    apiKey := "your-api-key-here"
    sendMessage(apiKey, "Hello from Go!")
}

📸 Send Photo

Upload and send photos with captions

Python
import requests

def send_photo(api_key: str, image_path: str, caption: str):
    url = "https://t69.me"

    # Recommended: Use X-API-Key header
    headers = {
        'X-API-Key': api_key
    }

    with open(image_path, 'rb') as photo:
        files = {'file': photo}
        data = {
            'message': caption,
            'file_type': 'photo'
        }

        response = requests.post(url, data=data, files=files, headers=headers)

        if response.status_code == 200:
            print("✅ Photo sent successfully!")
        else:
            print(f"❌ Failed: {response.text}")

# Usage
api_key = "your-api-key-here"
send_photo(api_key, "image.jpg", "Check this out!")
Bash
#!/bin/bash

API_KEY="your-api-key-here"
IMAGE_PATH="image.jpg"
CAPTION="Check this out!"

# Recommended: Use X-API-Key header
curl -X POST https://t69.me \
  -H "X-API-Key: $API_KEY" \
  -F "message=$CAPTION" \
  -F "file_type=photo" \
  -F "file=@$IMAGE_PATH"
PHP
<?php

function sendPhoto($apiKey, $imagePath, $caption) {
    $url = "https://t69.me";

    $curl = curl_init();

    $postData = array(
        'message' => $caption,
        'file_type' => 'photo',
        'file' => new CURLFile($imagePath)
    );

    // Recommended: Use X-API-Key header
    curl_setopt_array($curl, array(
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => $postData,
        CURLOPT_HTTPHEADER => array(
            "X-API-Key: $apiKey"
        )
    ));

    $response = curl_exec($curl);

    if ($response === FALSE) {
        echo "❌ Error: " . curl_error($curl) . "\n";
    } else {
        echo "✅ Photo sent successfully!\n";
    }

    curl_close($curl);
}

// Usage
$apiKey = "your-api-key-here";
sendPhoto($apiKey, "image.jpg", "Check this out!");

?>
JavaScript
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

async function sendPhoto(apiKey, imagePath, caption) {
    const url = 'https://t69.me';

    const form = new FormData();
    form.append('message', caption);
    form.append('file_type', 'photo');
    form.append('file', fs.createReadStream(imagePath));

    try {
        // Recommended: Use X-API-Key header
        const response = await axios.post(url, form, {
            headers: {
                ...form.getHeaders(),
                'X-API-Key': apiKey
            }
        });

        console.log('✅ Photo sent successfully!');
    } catch (error) {
        console.error('❌ Error:', error.message);
    }
}

// Usage
const apiKey = 'your-api-key-here';
sendPhoto(apiKey, 'image.jpg', 'Check this out!');
Go
package main

import (
    "bytes"
    "fmt"
    "io"
    "mime/multipart"
    "net/http"
    "os"
)

func sendPhoto(apiKey, imagePath, caption string) error {
    apiURL := "https://t69.me"

    body := &bytes.Buffer{}
    writer := multipart.NewWriter(body)

    writer.WriteField("message", caption)
    writer.WriteField("file_type", "photo")

    file, _ := os.Open(imagePath)
    defer file.Close()

    part, _ := writer.CreateFormFile("file", imagePath)
    io.Copy(part, file)
    writer.Close()

    req, _ := http.NewRequest("POST", apiURL, body)
    req.Header.Set("Content-Type", writer.FormDataContentType())

    // Recommended: Use X-API-Key header
    req.Header.Set("X-API-Key", apiKey)

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    fmt.Println("✅ Photo sent successfully!")
    return nil
}

func main() {
    apiKey := "your-api-key-here"
    sendPhoto(apiKey, "image.jpg", "Check this out!")
}

📄 Send Document/File

Upload PDFs, ZIPs, and other files

Python
import requests

def send_document(api_key: str, file_path: str, caption: str):
    url = "https://t69.me"

    # Recommended: Use X-API-Key header
    headers = {
        'X-API-Key': api_key
    }

    with open(file_path, 'rb') as document:
        files = {'file': document}
        data = {
            'message': caption,
            'file_type': 'document'
        }

        response = requests.post(url, data=data, files=files, headers=headers)

        if response.status_code == 200:
            print("✅ Document sent successfully!")
        else:
            print(f"❌ Failed: {response.text}")

# Usage
api_key = "your-api-key-here"
send_document(api_key, "report.pdf", "Monthly Report")
Bash
#!/bin/bash

API_KEY="your-api-key-here"
FILE_PATH="report.pdf"
CAPTION="Monthly Report"

# Recommended: Use X-API-Key header
curl -X POST https://t69.me \
  -H "X-API-Key: $API_KEY" \
  -F "message=$CAPTION" \
  -F "file_type=document" \
  -F "file=@$FILE_PATH"
PHP
<?php

function sendDocument($apiKey, $filePath, $caption) {
    $url = "https://t69.me";

    $curl = curl_init();

    $postData = array(
        'message' => $caption,
        'file_type' => 'document',
        'file' => new CURLFile($filePath)
    );

    // Recommended: Use X-API-Key header
    curl_setopt_array($curl, array(
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => $postData,
        CURLOPT_HTTPHEADER => array(
            "X-API-Key: $apiKey"
        )
    ));

    $response = curl_exec($curl);

    if ($response === FALSE) {
        echo "❌ Error: " . curl_error($curl) . "\n";
    } else {
        echo "✅ Document sent successfully!\n";
    }

    curl_close($curl);
}

// Usage
$apiKey = "your-api-key-here";
sendDocument($apiKey, "report.pdf", "Monthly Report");

?>
JavaScript
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

async function sendDocument(apiKey, filePath, caption) {
    const url = 'https://t69.me';

    const form = new FormData();
    form.append('message', caption);
    form.append('file_type', 'document');
    form.append('file', fs.createReadStream(filePath));

    try {
        // Recommended: Use X-API-Key header
        const response = await axios.post(url, form, {
            headers: {
                ...form.getHeaders(),
                'X-API-Key': apiKey
            }
        });

        console.log('✅ Document sent successfully!');
    } catch (error) {
        console.error('❌ Error:', error.message);
    }
}

// Usage
const apiKey = 'your-api-key-here';
sendDocument(apiKey, 'report.pdf', 'Monthly Report');
Go
package main

import (
    "bytes"
    "fmt"
    "io"
    "mime/multipart"
    "net/http"
    "os"
)

func sendDocument(apiKey, filePath, caption string) error {
    apiURL := "https://t69.me"

    body := &bytes.Buffer{}
    writer := multipart.NewWriter(body)

    writer.WriteField("message", caption)
    writer.WriteField("file_type", "document")

    file, _ := os.Open(filePath)
    defer file.Close()

    part, _ := writer.CreateFormFile("file", filePath)
    io.Copy(part, file)
    writer.Close()

    req, _ := http.NewRequest("POST", apiURL, body)
    req.Header.Set("Content-Type", writer.FormDataContentType())

    // Recommended: Use X-API-Key header
    req.Header.Set("X-API-Key", apiKey)

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    fmt.Println("✅ Document sent successfully!")
    return nil
}

func main() {
    apiKey := "your-api-key-here"
    sendDocument(apiKey, "report.pdf", "Monthly Report")
}

📖 API Reference

Endpoint

POST https://t69.me/

Parameters

Parameter Type Required Description
api_key String ✅ Yes Your API key from @MessageGateBot
message String ✅ Yes Message text or caption (HTML supported)
file File ❌ No File to upload (photo/document)
file_type String ⚠️ If file "photo" or "document"