This document shows how the sandbox accurately mirrors the real Investec API structure, ensuring your development experience translates directly to production.
All components now accurately reflect the official Investec API specification:
| Component | Alignment Status | Details |
|---|---|---|
| OAuth Flow | ✅ Exact Match | Client credentials with Basic Auth + x-api-key |
| API Endpoints | ✅ Exact Match | /za/pb/v1/* path structure |
| Response Format | ✅ Exact Match | Includes data, links, and meta properties |
| Authentication | ✅ Exact Match | Bearer tokens with API key headers |
| Error Handling | ✅ Exact Match | Standard HTTP status codes and error formats |
POST http://localhost:3000/identity/v2/oauth2/token
Authorization: Basic {base64(client_id:client_secret)}
x-api-key: mock-api-key
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&scope=accountsPOST https://openapisandbox.investec.com/identity/v2/oauth2/token
Authorization: Basic {base64(your_client_id:your_client_secret)}
x-api-key: your-api-key
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&scope=accountsMigration: Simply change the base URL and credentials!
| Sandbox | Production | Status |
|---|---|---|
http://localhost:3000/za/pb/v1/accounts |
https://openapisandbox.investec.com/za/pb/v1/accounts |
✅ Identical |
http://localhost:3000/za/pb/v1/accounts/{id}/balance |
https://openapisandbox.investec.com/za/pb/v1/accounts/{id}/balance |
✅ Identical |
http://localhost:3000/za/pb/v1/accounts/{id}/transactions |
https://openapisandbox.investec.com/za/pb/v1/accounts/{id}/transactions |
✅ Identical |
All responses follow the exact Investec API structure:
{
"data": [
{
"accountId": "1234567890",
"accountNumber": "62012345678",
"accountName": "Demo Current Account",
"accountType": "current",
"currency": "ZAR",
"currentBalance": 15432.50,
"availableBalance": 14932.50,
"referenceName": "Demo Account",
"productName": "Private Bank Account"
}
],
"links": {
"self": "https://openapisandbox.investec.com/za/pb/v1/accounts"
},
"meta": {
"totalPages": 1
}
}{
'Authorization': 'Bearer {access_token}',
'x-api-key': '{your-api-key}',
'Content-Type': 'application/json'
}{
"error": "invalid_token",
"error_description": "The access token provided is expired, revoked, malformed, or invalid"
}-
Update Base URLs:
// Sandbox const baseUrl = 'http://localhost:3000'; // Production Sandbox const baseUrl = 'https://openapisandbox.investec.com'; // Production const baseUrl = 'https://openapi.investec.com';
-
Update Credentials:
// Sandbox (mock) const config = { client_id: 'mock-client', client_secret: 'mock-secret', api_key: 'mock-api-key' }; // Production (real) const config = { client_id: process.env.INVESTEC_CLIENT_ID, client_secret: process.env.INVESTEC_CLIENT_SECRET, api_key: process.env.INVESTEC_API_KEY };
-
Code Stays Identical:
- Authentication flow remains the same
- API endpoints use same paths
- Response parsing logic unchanged
- Error handling patterns identical
- OAuth token exchange - Exact same flow
- Account listing - Identical response format
- Transaction history - Same data structure
- Balance queries - Matching field names
- Error conditions - Consistent error codes
All 14 prompts in the prompt pack generate code that works with:
- ✅ Local sandbox
- ✅ Investec sandbox environment
- ✅ Investec production (with credential updates)
- Seamless Migration - Code written for sandbox works in production
- Realistic Testing - Experience matches live API behavior
- Confidence - Know your integration will work before going live
- AI Accuracy - Generated code follows real API patterns
This sandbox is built from official Investec specifications:
- Swagger Files: Located in
Official swagger Docs/ - Developer Portal: developer.investec.com
- API Reference: Current with latest Investec API versions
To verify alignment, compare sandbox responses with the official API:
# Test sandbox
curl -H "Authorization: Bearer {sandbox_token}" \
-H "x-api-key: mock-api-key" \
http://localhost:3000/za/pb/v1/accounts
# Test production sandbox
curl -H "Authorization: Bearer {real_token}" \
-H "x-api-key: your-api-key" \
https://openapisandbox.investec.com/za/pb/v1/accountsResponse structures will be identical!
This sandbox provides a production-accurate development environment that eliminates surprises when deploying to live Investec APIs. Your development experience directly translates to production success! 🚀