Skip to main content
POST
/
process
Processes a customer's ussd request
curl --request POST \
  --url https://api.pipevest.com/v1/ussd/process \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'Signature: <signature>' \
  --header 'Signature-Input: <signature-input>' \
  --header 'X-Client-Id: <x-client-id>' \
  --data '
{
  "sessionId": "ussd_3278668b308502f3a562950fc8043028",
  "choice": 1
}
'
import requests

url = "https://api.pipevest.com/v1/ussd/process"

payload = {
"sessionId": "ussd_3278668b308502f3a562950fc8043028",
"choice": 1
}
headers = {
"Signature": "<signature>",
"Signature-Input": "<signature-input>",
"X-Client-Id": "<x-client-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {
Signature: '<signature>',
'Signature-Input': '<signature-input>',
'X-Client-Id': '<x-client-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({sessionId: 'ussd_3278668b308502f3a562950fc8043028', choice: 1})
};

fetch('https://api.pipevest.com/v1/ussd/process', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pipevest.com/v1/ussd/process",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'sessionId' => 'ussd_3278668b308502f3a562950fc8043028',
'choice' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Signature: <signature>",
"Signature-Input: <signature-input>",
"X-Client-Id: <x-client-id>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.pipevest.com/v1/ussd/process"

payload := strings.NewReader("{\n \"sessionId\": \"ussd_3278668b308502f3a562950fc8043028\",\n \"choice\": 1\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Signature", "<signature>")
req.Header.Add("Signature-Input", "<signature-input>")
req.Header.Add("X-Client-Id", "<x-client-id>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.pipevest.com/v1/ussd/process")
.header("Signature", "<signature>")
.header("Signature-Input", "<signature-input>")
.header("X-Client-Id", "<x-client-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sessionId\": \"ussd_3278668b308502f3a562950fc8043028\",\n \"choice\": 1\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.pipevest.com/v1/ussd/process")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Signature"] = '<signature>'
request["Signature-Input"] = '<signature-input>'
request["X-Client-Id"] = '<x-client-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sessionId\": \"ussd_3278668b308502f3a562950fc8043028\",\n \"choice\": 1\n}"

response = http.request(request)
puts response.read_body
{
  "message": "USSD request processed successfully",
  "data": {
    "sessionId": "ussd_3278668b308502f3a562950fc8043028",
    "currentState": "STOCKS",
    "menu": {
      "state": "STOCKS",
      "text": "Select Stock:",
      "options": [
        {
          "key": "1",
          "label": "AAPL",
          "nextState": "SELECT_STOCK",
          "data": {
            "stockId": "cmhkp4jkw0005zxfok9m0kiwg",
            "symbol": "AAPL",
            "name": "Apple Inc."
          }
        },
        {
          "key": "2",
          "label": "AMZN",
          "nextState": "SELECT_STOCK",
          "data": {
            "stockId": "cmhkp4kcp0008zxfohlxjtvd7",
            "symbol": "AMZN",
            "name": "Amazon.com Inc."
          }
        },
        {
          "key": "3",
          "label": "GOOGL",
          "nextState": "SELECT_STOCK",
          "data": {
            "stockId": "cmhkp4juc0006zxfo52azbrvo",
            "symbol": "GOOGL",
            "name": "Alphabet Inc."
          }
        },
        {
          "key": "4",
          "label": "JPM",
          "nextState": "SELECT_STOCK",
          "data": {
            "stockId": "cmhkp4ldl000czxfoqdqmzur8",
            "symbol": "JPM",
            "name": "JPMorgan Chase & Co."
          }
        },
        {
          "key": "5",
          "label": "META",
          "nextState": "SELECT_STOCK",
          "data": {
            "stockId": "cmhkp4kv7000azxfoi6s5yw7j",
            "symbol": "META",
            "name": "Meta Platforms Inc."
          }
        },
        {
          "key": "7",
          "label": "Next Page"
        },
        {
          "key": "8",
          "label": "Search Stock",
          "nextState": "SEARCH_STOCK"
        },
        {
          "key": "0",
          "label": "Back to Home",
          "nextState": "HOME"
        }
      ],
      "isEndState": false
    },
    "ussdText": "Select Stock:\n\n1. AAPL\n2. AMZN\n3. GOOGL\n4. JPM\n5. META\n7. Next Page\n8. Search Stock\n0. Back to Home",
    "expiresAt": "2025-11-06T14:38:12.202Z"
  }
}
{
"code": 401,
"message": "Unauthorized"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Signature
string
required

Base64 encoded signed hash of the http message request components.

Learn how signatures work

Example:

"sig1=:OTEyMjY4...A5NTNDMEQ=:"

Signature-Input
string
required

An ordered list of components that make up the signature base. It is used to recompute and verify the Signature

Learn how signatures work

Example:

"sig1=(\"Content-Type\" \"Content-Digest\"...expires=<expires>"

X-Client-Id
string
required

Unique identifier assigned to the client

Example:

"client-id"

Query Parameters

customerId
integer
required

Unique customer identifier

Example:

123456

Body

application/json

Details used to process a customer's ussd request

sessionId
string
required

Unique session identifier

Example:

"ussd_3278668b308502f3a562950fc8043028"

choice
required

The choice made by the customer (can be an integer like 1, 2, 3, 4 or a string like "Tesla", "Apple", "Gold")

Example:

1

Response

USSD request processed successfully

data
object
required

The USSD process request response data

code
string
required

Request response code

Example:

200

message
string
required

Request response message

Example:

"Success"