# REST API

Unecast’s REST API allows you to integrate SMS capabilities into your applications with ease. Our RESTful API uses standard HTTP methods and JSON data formats to provide a flexible and developer-friendly interface.

### **Base URL**

All API endpoints are relative to the base URL:&#x20;

{% code title="Use for omnichannel messaging (WhatsApp+SMS)" fullWidth="false" %}

```json
https://api.unecast.com/v2/
```

{% endcode %}

{% code title="Deprecated (Supports only for legacy SMS)" fullWidth="false" %}

```json
https://api.unecast.com/v1.0
```

{% endcode %}

### **Authentication**

Authenticate your API requests using API keys. Include your API key in the `Authorization` header:

```json
Authorization: Bearer YOUR_API_KEY
```

### **Allowed HTTP Methods**

The Unecast SMS Gateway API utilizes GET and POST methods to for the following use cases.&#x20;

<table><thead><tr><th width="170">HTTP Method</th><th>Use Cases</th><th>Description</th></tr></thead><tbody><tr><td><code>GET</code></td><td><ul><li>To check account balance </li><li>To check message statuses</li></ul></td><td><code>GET</code> method allow users to retrieve information about their account balance and the delivery status of their sent messages. </td></tr><tr><td><code>POST</code></td><td><p>To send messages</p><ul><li>SMS</li><li>WhatsApp</li></ul></td><td><ul><li><code>POST</code> method enables users to send SMS messages by providing the necessary details such as the sender ID, recipient number(s), and message content. </li><li>The <code>POST</code> method ensures secure and efficient communication between the user's application and the Unecast service.</li></ul></td></tr></tbody></table>

The `POST` method is set as the default method for sending messages due to several security-related reasons:

#### **1. Data Encapsulation in the Body**

Unlike the GET method, where data is included in the URL, the POST method sends data in the body of the request. This offers enhanced security because:

* **URL Visibility**: Data in the URL can be logged in server logs, browser history, and be visible in the browser's address bar, potentially exposing sensitive information. Using the POST method avoids this issue.
* **Data Length**: URLs have length limitations, which can restrict the amount of data sent. POST requests do not have such restrictions, allowing for more extensive and detailed data to be transmitted securely.

#### **2. Handling Sensitive Data**

The POST method allows sensitive data such as API keys, user credentials, and SMS content to be included in the request body. This provides several advantages:

* **Encryption**: When using HTTPS, the request body is encrypted, ensuring that sensitive data is transmitted securely over the network.
* **Parameter Safety**: Sensitive information is less likely to be exposed in the browser history or server logs, as it is not part of the URL.

#### **3. Appropriate for Data Modification**

The POST method is designed for operations that create or modify data, such as sending an SMS. This aligns with security practices where:

* **Transaction Safety**: Actions that change the state of the server, such as sending a message, should be securely encapsulated to prevent unintended actions. POST is designed for such operations.
* **Explicit Actions**: POST requests explicitly indicate an action to be performed, reducing the risk of unintended or accidental data retrieval, as can happen with GET requests when URLs are accidentally clicked or refreshed.

***

## Let's Get Started

1. **Create an App**: Sign in to Unecast and click on Developer to [`create your first app`](https://app.unecast.com/developer/create).
2. **Select Project Scope**: Select REST API to generate an API key
3. **Send an SMS**: Use the `/sms/send` endpoint to send your first SMS.
4. **Check Status**: Use the `/sms/status/{message_id}` endpoint to check the delivery status of your message.
5. **Account Balance**: Use the `/account/balance` endpoint to check the current balance in your account.

***

## Community and Support

Join our community forums to connect with other developers, ask questions, and share your experiences. Our support team is also available to help you with any technical issues or inquiries.

***

## **Technical Support**

For service requests, questions, or clarifications, please visit the [Unecast Support Center](https://app.unecast.com/support). Our engineers and technical consultants will assist you in resolving your concerns free of charge.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.unecast.com/rest-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
