Stocks
Search, filter, and sort NGX equities.
Portfolio scoring
Analyze holdings and purification amounts.
Reports
Retrieve compliance reports for equities.
Usage
Monitor daily quota and API key activity.
Getting started
Authenticate with X-API-Key
Every external API request requires an API key in the X-API-Key header. Sandbox keys use sk_test_ and production keys use sk_live_.
Key formats
sk_test_
Sandbox key for development and testing.
sk_live_
Production key for live data access.
curl "https://api.toyyib.app/api/v1/stocks" \ -H "X-API-Key: sk_test_your_key_here"
Traffic controls
Rate limits are enforced per API key
Responses include rate-limit headers so your application can display remaining quota and back off gracefully.
X-RateLimit-Limit
Maximum requests in the current window
X-RateLimit-Remaining
Requests remaining in the window
X-RateLimit-Reset
UTC timestamp when the window resets
Retry-After
Seconds to wait after a 429 response
Error handling
Predictable JSON errors
The API uses standard HTTP status codes and wraps validation, authentication, authorization, and server errors in a consistent shape.
VALIDATION_ERRORInvalid request parametersINVALID_API_KEYMissing or invalid API keyFEATURE_UNAVAILABLEFeature unavailable for this keyNOT_FOUNDResource does not existRATE_LIMIT_EXCEEDEDToo many requestsINTERNAL_ERRORUnexpected server error{
"success": false,
"error": {
"code": "INVALID_API_KEY",
"message": "The API key provided is invalid or has been revoked.",
"details": {}
}
}Stocks
List Stocks
Retrieve a paginated list of NGX stocks with optional filtering, searching, and sorting.
Parameters
statusstring
Filter by compliant, non_compliant, doubtful, or pending.
sectorstring
Filter by sector name, case-insensitive.
searchstring
Search by ticker symbol or company name.
sort_bystring
Sort by symbol, price, change_percent, or market_cap.
pageinteger
Page number. Defaults to 1.
curl "https://api.toyyib.app/api/v1/stocks?status=compliant§or=Industrial%20Goods&page=1" \ -H "X-API-Key: sk_test_your_key_here"
{
"success": true,
"data": {
"stocks": [
{
"id": "019432a1-...",
"ticker": "DANGCEM",
"exchange": "NGX",
"symbol": "NGX:DANGCEM",
"name": "Dangote Cement Plc",
"sector": "Industrial Goods",
"price": "290.00",
"change_percent": "1.58",
"market_cap": "4940000000000",
"status": "compliant"
}
],
"pagination": {
"current_page": 1,
"per_page": 10,
"total_pages": 5,
"total_items": 50,
"has_next": true,
"has_previous": false
}
},
"message": "Stocks retrieved successfully"
}Stocks
Stock Details
Retrieve full details for one stock, including financials and Shariah screening ratios. Use a public ticker or exchange-qualified symbol, not the internal database ID.
Parameters
stock_identifierstring
Public ticker or exchange-qualified symbol, for example DANGCEM or NGX:DANGCEM.
curl "https://api.toyyib.app/api/v1/stocks/NGX:DANGCEM" \ -H "X-API-Key: sk_test_your_key_here"
{
"success": true,
"data": {
"id": "019432a1-...",
"ticker": "DANGCEM",
"exchange": "NGX",
"symbol": "NGX:DANGCEM",
"name": "Dangote Cement Plc",
"sector": "Industrial Goods",
"price": "290.00",
"change_percent": "1.58",
"market_cap": "4940000000000",
"status": "compliant",
"shariah_metrics": {
"debt_ratio": 20.0,
"interest_income": 1.2,
"non_compliant_income": 0.8,
"liquid_assets": 15.0,
"compliance_score": 92
}
},
"message": "Stock details retrieved successfully"
}Stocks
Sector Summaries
Retrieve sector-level stock counts, compliant counts, and average compliance scores.
Parameters
This endpoint takes no parameters.
curl "https://api.toyyib.app/api/v1/stocks/sectors" \ -H "X-API-Key: sk_test_your_key_here"
{
"success": true,
"data": {
"sectors": [
{
"name": "Banking",
"stock_count": 12,
"compliant_count": 8,
"average_compliance_score": 78.5
}
]
},
"message": "Sectors retrieved successfully"
}Portfolio
Analyze Portfolio
Submit holdings and receive portfolio-level compliance scoring, value breakdowns, and purification amounts.
Parameters
holdingsarray
One to fifty holdings, with no duplicate tickers.
holdings[].tickerstring
Ticker symbol, case-insensitive.
holdings[].sharesnumber
Number of shares held. Minimum 1.
curl -X POST "https://api.toyyib.app/api/v1/portfolio/analyze" \
-H "X-API-Key: sk_test_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"holdings": [
{"ticker": "DANGCEM", "shares": 500},
{"ticker": "BUACEMENT", "shares": 200}
]
}'{
"success": true,
"data": {
"summary": {
"total_value": 1250000.0,
"compliance_score": 72,
"compliance_status": "doubtful",
"total_purification_amount": 1523.45,
"holdings_count": 2,
"analyzed_at": "2026-04-12T10:30:00Z"
},
"holdings": [
{
"ticker": "DANGCEM",
"value": 125000.0,
"weight": 10.0,
"compliance_status": "compliant",
"purification_amount": 0.0
}
]
},
"message": "Portfolio analysis completed successfully"
}Reports
List Reports
Retrieve paginated compliance reports.
Parameters
typestring
Filter by monthly, quarterly, or special.
pageinteger
Page number.
curl "https://api.toyyib.app/api/v1/reports?type=quarterly&page=1" \ -H "X-API-Key: sk_live_your_pro_key"
{
"success": true,
"data": {
"reports": [
{
"id": "019432b2-...",
"title": "Q1 2026 Compliance Report",
"type": "quarterly",
"created_at": "2026-01-15T00:00:00Z"
}
]
},
"message": "Reports retrieved successfully"
}Reports
Report Statistics
Get report generation and download statistics, including upcoming report schedules.
Parameters
This endpoint takes no parameters.
curl "https://api.toyyib.app/api/v1/reports/stats" \ -H "X-API-Key: sk_live_your_pro_key"
{
"success": true,
"data": {
"total_reports_generated": 24,
"total_downloads": 156,
"report_schedule": [
{
"type": "monthly",
"description": "Generated on the 15th of each month",
"next_report_date": "2026-03-15T00:00:00"
}
]
},
"message": "Report statistics retrieved successfully"
}Reports
Download Report
Get a download URL for a specific compliance report.
Parameters
report_iduuid
The report unique identifier.
curl "https://api.toyyib.app/api/v1/reports/019432b2-.../download" \ -H "X-API-Key: sk_live_your_enterprise_key"
{
"success": true,
"data": {
"download_url": "https://api.toyyib.app/media/reports/q1-2026.pdf",
"file_name": "Q1 2026 Compliance Report.pdf",
"file_size": 245760
},
"message": "Download URL generated successfully"
}Account
API Usage
Check current API key usage and rate-limit status.
Parameters
This endpoint takes no parameters.
curl "https://api.toyyib.app/api/v1/usage" \ -H "X-API-Key: sk_test_your_key_here"
{
"success": true,
"data": {
"key": {
"prefix": "sk_test_abc12345",
"name": "My Dev Key",
"mode": "sandbox",
"is_active": true
},
"usage": {
"daily_limit": 1000,
"daily_used": 142,
"daily_remaining": 858,
"per_minute_limit": 30
}
},
"message": "Usage data retrieved successfully"
}Ready to add Shariah compliance to your platform?
Talk to the Halcore team about API keys, sandbox access, and business onboarding.