translate Englishattach_moneyUSDQuick AI Login
emoji_food_beverage Exploreinterests Pigment Libraryattach_email Mail Enginesms Celular Textlocal_library API Docs

Global Celular Gateway API Documentation

Send and receive text messages with just a few lines of code on Messaging, the trusted platform for cross-channel messaging.

Below are the endpoints for accessing Celular Gatewway. Learn how to integrate the API into your application.

Authorization:

  • privateId *Specify privateId for site
    (e.g., "Bearer example^com-SomeIdString").

Query Parameters:

  • type Specify type of SMS
    for Transactional OTP (e.g., type:"OTP").
    for Promotional Bulk (e.g., type:"TMP").
    for Informational personalized (e.g., type:"CXT").

Body Parameters:

  • CC Specify which rates to show
    (e.g., "US"|"IN"|"DE").
  • cellId Specify array of contact number
    (e.g., ["+91" + "99876543210"]).
  • :data Specify the mail OTP|TMP|CXT string
    for Transactional OTP (e.g., OTP:"000000").
    for Promotional Bulk (e.g., TMP:"sms-id-here").
    for Informational personalized (e.g., CXT:"sms-here").

Route Parameters:

  • :region *Please check location table here
    (e.g., "WEST_3|ARAB_1|EAST_3|NORD_6").

Response based on params:

{
  "success": true,
  "info": "SMS OTP Sent!"
}

POST

check_boxNoAuthcheck_box_outline_blankLoyaltycheck_box_outline_blankEnterprise

This endpoint provides the text for sending celular sms.

JavaScript
Python
Php
Java
c#
Ruby
Go
Swift
import Foundation

struct APIClient {
    static let baseURL = "https://textpress.api.koirang.com/v1/:region"
    static let privateId = "<privateId>"
    
    static func fetchData() async throws -> [String: Any] {
        // API configuration
        let params = [
            "region": "YOUR_REGION"  // Replace with actual region value
        ]
        
        // Build URL
        var urlComponents = URLComponents(string: baseURL)!
        
        // Add path parameters
        let pathParams = ["region"]
        let pathItems = pathParams.map { params[$0]! }
        urlComponents.path += "/" + pathItems.joined(separator: "/")
        
        // Add query parameters
        let queryParams: [String: String] = {"mailId":"example@domain.com","OTP":"000000"}
        urlComponents.queryItems = queryParams.map { URLQueryItem(name: $0.key, value: $0.value) }
        
        guard let url = urlComponents.url else {
            throw URLError(.badURL)
        }
        
        // Create request
        var request = URLRequest(url: url)
        request.httpMethod = "GET"
        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        request.setValue("Bearer \(privateId)", forHTTPHeaderField: "Authorization")
        
        // Add body for POST/PUT requests
        if ["POST", "PUT"].contains("GET") {
            let bodyData = {"type":"OTP"}
            request.httpBody = try JSONSerialization.data(withJSONObject: bodyData)
        }
        
        // Send request
        let (data, response) = try await URLSession.shared.data(for: request)
        
        guard let httpResponse = response as? HTTPURLResponse else {
            throw URLError(.badServerResponse)
        }
        
        guard httpResponse.statusCode < 400 else {
            throw URLError(.badServerResponse)
        }
        
        guard let result = try JSONSerialization.jsonObject(with: data) as? [String: Any] else {
            throw URLError(.cannotParseResponse)
        }
        
        return result
    }
}

// Example usage
@main
struct APIExample {
    static func main() async {
        do {
            let result = try await APIClient.fetchData()
            let prettyJSON = try JSONSerialization.data(withJSONObject: result, options: .prettyPrinted)
            if let jsonString = String(data: prettyJSON, encoding: .utf8) {
                print(jsonString)
            }
        } catch {
            print("Error: \(error)")
        }
    }
}