# Get Started

To effectively utilize the USSD API, follow these steps:

1. Begin by registering a shortcode with us.
2. Share your webhook with us. This webhook acts as a callback mechanism, triggered by an incoming user request with the registered shortcode. \
   Whenever such a request is received on our platform, we will make an HTTP POST request to your provided webhook. \
   The payload sent to your webhook will contain the request data in JSON format (Content-Type: application/json). \
   \
   **Here's an example of a sample payload:**

```json5
{
  "shortcode": "165",
  "msisdn": "256756070595",  
  "mccmnc":"64101",
  "sessionid": "50b1be9cb6a90",
  "state": "START",
  "message": "1"
}
```

3. Your server should respond with the desired message to be displayed on the user's handset in JSON format (Content-Type: application/json). \
   The response should include the same payload structure as the received request, with an updated state. \
   \
   **Here's an example of an expected response from your server:**

```json5
{
  "msisdn": "256756070595",
  "sessionid": "50b1be9cb6a90",
  "state": "CONTINUE",
  "message": "Hello world. Welcome to LTD"
}
```

{% hint style="info" %}
The USSD API operates with three different states:

* **START**: This state is sent when a new session is initiated by the user.
* **CONTINUE**: Your server should respond with this state if you wish to continue the session.
* **END**: Your server should respond with this state if you want to terminate the session.
  {% endhint %}

4. It's important to note that every request we send you will include a **sessionid**, which should be maintained and used until the session is completed.
5. Avoid including special characters in your USSD Menu to ensure seamless access to your USSD services. Telcos may encounter difficulties in rendering content with special characters, potentially causing disruptions in the user's ability to utilize your USSD services.
6. Payloads are signed using public-key cryptography to guarantee the authenticity of delivered callbacks. Each callback delivery request includes a **Signature** header field. This field contains a base64-encoded RSA PKCS#1 v1.5 signature of the SHA256 digest of the request body buffer.


---

# 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://docs.paytota.com/ussd/get-started.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.
