Processes a customer's USSD request
const url = 'https://api.pipevest.com/v1/ussd/process';const options = { method: 'POST', headers: { Authorization: 'Bearer <token>', 'x-client-id': '<x-client-id>', 'Content-Type': 'application/json' }, body: '{"sessionId":"ussd_3278668b308502f3a562950fc8043028","choice":"1"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pipevest.com/v1/ussd/process \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'x-client-id: <x-client-id>' \ --data '{ "sessionId": "ussd_3278668b308502f3a562950fc8043028", "choice": "1" }'Advances an existing session. The body is { sessionId, choice } — it
does not take a customerId.
What the customer sees (example: the Stocks menu):
Select Stock: 1. AAPL 2. AMZN 7. Next Page 8. Search Stock 0. Back to Home
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The session and the customer’s menu choice.
object
Unique session identifier.
Example
ussd_3278668b308502f3a562950fc8043028The customer’s menu choice, always sent as a string. May be a numeric key like “1” or a free-text search term like “Tesla”. Alphanumeric, 1–10 characters.
Example
1Responses
Section titled “Responses”USSD request processed successfully
object
object
The USSD process request response data.
object
Unique session identifier.
The menu structure with state, text, options, and end state flag.
object
A menu option with key, label, optional next state, and optional data.
object
The option key (e.g. “1”, “2”, or a search term).
The display label for the option.
The next state to transition to (some options, like “Next Page”, omit this).
Optional additional data associated with the option (e.g. stock information).
object
Examples
Stocks menu response
{ "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": "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\n7. Next Page\n8. Search Stock\n0. Back to Home", "expiresAt": "2025-11-06T14:38:12.202Z" }}Request failed schema validation
object
object
Example
{ "error": "Validation failed", "details": [ { "field": "customerId", "message": "Invalid customer ID format" } ]}Unauthorized
object
Example
{ "error": "Unauthorized", "message": "Organization authentication token is required"}