Skip to main content
POST
/
session
Creates a customer session
curl --request POST \
  --url https://api.pipevest.com/v1/ussd/session \
  --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 '
{
  "customerId": 123456
}
'
import requests

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

payload = { "customerId": 123456 }
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({customerId: 123456})
};

fetch('https://api.pipevest.com/v1/ussd/session', 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/session",
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([
'customerId' => 123456
]),
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/session"

payload := strings.NewReader("{\n \"customerId\": 123456\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/session")
.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 \"customerId\": 123456\n}")
.asString();
require 'uri'
require 'net/http'

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

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 \"customerId\": 123456\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "sessionId": "ussd_3278668b308502f3a562950fc8043028",
    "currentState": "HOME",
    "menu": {
      "state": "HOME",
      "text": "Select an investment option:",
      "options": [
        {
          "key": "1",
          "label": "Stocks",
          "nextState": "STOCKS"
        },
        {
          "key": "2",
          "label": "My Portfolio",
          "nextState": "MY_PORTFOLIO"
        }
      ],
      "isEndState": false
    },
    "ussdText": "Select an investment option:\n\n1. Stocks\n2. My Portfolio",
    "expiresAt": "2025-11-06T14:38:12.202Z"
  },
  "code": 200,
  "message": "Success"
}
{
"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 create a customer session

customerId
integer
required

Unique customer identifier

Example:

123456

Response

Customer session created successfully

data
object
required

The USSD session response data

code
string
required

Request response code

Example:

200

message
string
required

Request response message

Example:

"Success"