Base Path
Overview
The VIGIA platform integrates with WHO’s official ICD-11 API to provide:- Diagnostic Code Search: Full-text search across ICD-11 disease classifications
- Code Information: Detailed information about specific ICD-11 codes
- Multi-Release Support: Automatic fallback across ICD-11 releases
- OAuth2 Authentication: Transparent token management with WHO ICD API
- Localization: Configurable language support (default: Spanish)
Authentication
The API handles WHO ICD API authentication automatically using OAuth2 client credentials flow.Required Environment Variables
| Variable | Required | Description |
|---|---|---|
ICD_CLIENT_ID | Yes | WHO ICD API Client ID |
ICD_CLIENT_SECRET | Yes | WHO ICD API Client Secret |
ICD_TOKEN_URL | No | Token endpoint (default: WHO production) |
ICD_SCOPE | No | OAuth scope (default: icdapi_access) |
- Register at https://icd.who.int/icdapi
- Create an application to receive Client ID and Secret
- Configure credentials in your environment
- Tokens are cached automatically
- Auto-refresh when token expires (60s buffer)
- No manual token handling required
Endpoints
Search ICD-11 Codes
GET/POST /icd11/search
Search for ICD-11 disease codes by text query with pagination.
| Parameter | Type | Default | Description |
|---|---|---|---|
q | string | - | Search query (required) |
flatResults | boolean | true | Return flat list vs hierarchical |
highlighting | boolean | true | Include search term highlighting |
release | string | auto | ICD-11 release version (e.g., “2025-01”) |
linearization | string | mms | Linearization type (mms, icf, etc.) |
chapterFilter | string | null | Filter by ICD chapter |
subtreesFilter | string | null | Filter by code subtree |
page | integer | 1 | Page number (1-indexed) |
pageSize | integer | 25 | Results per page |
200 OK
results: Array of matching ICD-11 entitiestotal: Total number of matches across all pagesquery: Echo of search querypage,pageSize: Pagination info
Get Code Information
GET /icd11/codeinfo/{code}
Retrieve detailed information about a specific ICD-11 code.
code(required): ICD-11 code (e.g., “BA00”)
release(optional): Specific release versionlinearization(optional, default: “mms”): Linearization type
200 OK
Release Management
Automatic Release Fallback
The API implements intelligent release fallback to handle WHO API availability: Fallback Order:- Environment-specified release (
ICD_RELEASE) 2025-022025-012024-02- Default release (no version specified)
- If a release returns 404, automatically tries the next fallback
- If client specifies a release explicitly, no fallback occurs (returns 404)
- If all releases fail, returns 200 with empty results and
_triedmetadata
Configuration
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
ICD_CLIENT_ID | Yes | - | WHO API Client ID |
ICD_CLIENT_SECRET | Yes | - | WHO API Client Secret |
ICD_API_VERSION | No | v2 | ICD API version |
ICD_TOKEN_URL | No | WHO prod URL | OAuth token endpoint |
ICD_SCOPE | No | icdapi_access | OAuth scope |
ICD_BASE | No | https://id.who.int/icd | ICD API base URL |
ICD_ACCEPT_LANG | No | es | Response language (es, en, etc.) |
ICD_RELEASE | No | auto | Preferred ICD-11 release version |
ICD_HTTP_TIMEOUT | No | 20 | HTTP request timeout (seconds) |
Linearizations
ICD-11 supports multiple linearizations:- mms (default): Mortality and Morbidity Statistics
- icf: International Classification of Functioning
- other: Additional specialized linearizations
Debug Endpoints
Ping
GET /icd11/debug/ping
Check API configuration and connectivity.
Token Debug
GET /icd11/debug/token
Verify OAuth token retrieval and expiration.
Sample Search
GET /icd11/debug/sample
Execute a sample search to verify end-to-end functionality.
q(optional, default: “tos”): Test search query
Error Handling
Common Errors
500 Internal Server Error - Missing credentials:HTTP Timeout
All WHO API requests have a configurable timeout (default: 20 seconds). Configure viaICD_HTTP_TIMEOUT environment variable.
Usage Examples
Python
JavaScript
cURL
Best Practices
- Use POST for Complex Queries: POST requests support larger payloads and better handle special characters
- Enable Highlighting: Set
highlighting: trueto see which terms matched - Paginate Results: Use appropriate
pageSizevalues to avoid overwhelming responses - Cache Code Info: ICD-11 code details rarely change within a release - consider caching
- Monitor Token Expiry: The API handles this automatically, but be aware of credential expiration
- Use Specific Releases: For production, specify a fixed release version for consistency