Bawabatic APIbawabatic.dz ↗
Access Algerian government public services, themes, sectors, and procedures via the bawabatic.dz API. Supports Arabic, French, and English.
What is the Bawabatic API?
The bawabatic.dz API exposes 9 endpoints covering the Algerian Government Portal of Public Services, returning structured data on service themes, ministries, individual procedures, and official government links. Using get_service_detail, you can retrieve a specific procedure's name, description, metadata object, and target audience array. The API supports Arabic, French, and English via a lang parameter on every endpoint.
curl -X GET 'https://api.parse.bot/scraper/24ffe10c-26ba-422b-8e0a-db30dcd221f3/get_homepage' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace bawabatic-dz-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""
Algeria Public Services Portal API Client
Get your API key from: https://parse.bot/settings
"""
import os
import json
import requests
from typing import Optional, Dict, Any, List
class ParseClient:
"""Client for accessing the Algeria Public Services Portal API via Parse."""
def __init__(self, api_key: Optional[str] = None):
"""Initialize the Parse API client.
Args:
api_key: API key for authentication. If not provided, reads from PARSE_API_KEY env var.
"""
self.base_url = "https://api.parse.bot"
self.scraper_id = "50ee29a0-6c16-4377-8e7b-f4bf622c511f"
self.api_key = api_key or os.getenv("PARSE_API_KEY")
if not self.api_key:
raise ValueError(
"API key not provided. Set PARSE_API_KEY environment variable or pass api_key parameter."
)
def _call(self, endpoint: str, method: str = "POST", **params) -> Dict[str, Any]:
"""Make a call to the Parse API.
Args:
endpoint: The endpoint name to call
method: HTTP method (GET or POST)
**params: Query parameters or request body parameters
Returns:
The API response as a dictionary
"""
url = f"{self.base_url}/scraper/{self.scraper_id}/{endpoint}"
headers = {"X-API-Key": self.api_key, "Content-Type": "application/json"}
if method.upper() == "GET":
response = requests.get(url, headers=headers, params=params)
elif method.upper() == "POST":
response = requests.post(url, headers=headers, json=params)
else:
raise ValueError(f"Unsupported HTTP method: {method}")
response.raise_for_status()
return response.json()
def get_homepage(self, lang: str = "en") -> Dict[str, Any]:
"""Fetch the main homepage of the Government Portal of Public Services.
Args:
lang: Language code (ar/fr/en). Defaults to 'en'.
Returns:
Portal description and basic metadata
"""
return self._call("get_homepage", method="GET", lang=lang)
def list_themes(self, lang: str = "en") -> Dict[str, Any]:
"""Retrieve all available service themes/categories.
Args:
lang: Language code (ar/fr/en). Defaults to 'en'.
Returns:
List of theme objects with ID, name, and service count
"""
return self._call("list_themes", method="GET", lang=lang)
def get_services_by_theme(self, theme_id: str, lang: str = "en") -> Dict[str, Any]:
"""Retrieve all public services listed under a specific theme.
Args:
theme_id: The theme ID
lang: Language code (ar/fr/en). Defaults to 'en'.
Returns:
Services under the specified theme
"""
return self._call(
"get_services_by_theme", method="GET", theme_id=theme_id, lang=lang
)
def list_sectors(self, lang: str = "en") -> Dict[str, Any]:
"""Retrieve all ministries/sectors listed on the portal.
Args:
lang: Language code (ar/fr/en). Defaults to 'en'.
Returns:
List of sectors with ID and name
"""
return self._call("list_sectors", method="GET", lang=lang)
def get_services_by_sector(self, sector_id: str, lang: str = "en") -> Dict[str, Any]:
"""Retrieve all public services listed under a specific ministry/sector.
Args:
sector_id: The sector ID
lang: Language code (ar/fr/en). Defaults to 'en'.
Returns:
Services under the specified sector
"""
return self._call(
"get_services_by_sector", method="GET", sector_id=sector_id, lang=lang
)
def get_service_detail(self, service_id: str, lang: str = "en") -> Dict[str, Any]:
"""Retrieve full details of a specific public service or procedure.
Args:
service_id: The service ID
lang: Language code (ar/fr/en). Defaults to 'en'.
Returns:
Full details of the service including description, target audience, and metadata
"""
return self._call(
"get_service_detail", method="GET", service_id=service_id, lang=lang
)
def search_services(self, query: str, lang: str = "en") -> Dict[str, Any]:
"""Search for public services by keyword across all themes and sectors.
Args:
query: Search keyword
lang: Language code (ar/fr/en). Defaults to 'en'.
Returns:
List of services matching the search query
"""
return self._call("search_services", method="GET", query=query, lang=lang)
def get_country_info(self, lang: str = "en") -> Dict[str, Any]:
"""Retrieve general country information about Algeria.
Args:
lang: Language code (ar/fr/en). Defaults to 'en'.
Returns:
Country information including government type, contact details, and metadata
"""
return self._call("get_country_info", method="GET", lang=lang)
def get_important_links(self, lang: str = "en") -> Dict[str, Any]:
"""Retrieve the list of important external government links featured on the portal.
Args:
lang: Language code (ar/fr/en). Defaults to 'en'.
Returns:
List of important government links
"""
return self._call("get_important_links", method="GET", lang=lang)
def main():
"""Practical workflow demonstrating the Parse API client."""
client = ParseClient()
print("=" * 70)
print("ALGERIA PUBLIC SERVICES PORTAL - API DEMONSTRATION")
print("=" * 70)
print("\n1. FETCHING PORTAL HOMEPAGE")
print("-" * 70)
homepage = client.get_homepage(lang="en")
print(f"Portal: {homepage.get('title', 'N/A')}")
print(f"Description: {homepage.get('description', 'N/A')}")
print(f"URL: {homepage.get('url', 'N/A')}")
print("\n2. FETCHING COUNTRY INFORMATION")
print("-" * 70)
country_info = client.get_country_info(lang="en")
print(f"Official Name: {country_info.get('official_name', 'N/A')}")
print(f"Government Type: {country_info.get('government', 'N/A')}")
print(f"Location: {country_info.get('location', 'N/A')}")
print(f"Operator: {country_info.get('operator', 'N/A')}")
if "contact" in country_info:
contact = country_info["contact"]
print(f"Contact Address: {contact.get('address', 'N/A')}")
print(f"Contact Email: {contact.get('email', 'N/A')}")
print("\n3. BROWSING THEMES AND THEIR SERVICES")
print("-" * 70)
themes_response = client.list_themes(lang="en")
total_themes = themes_response.get("total_themes", 0)
print(f"Total themes available: {total_themes}")
if themes_response.get("themes"):
for idx, theme in enumerate(themes_response["themes"][:3], 1):
theme_id = theme.get("id")
theme_name = theme.get("name")
service_count = theme.get("service_count", 0)
print(f"\n Theme {idx}: {theme_name} (ID: {theme_id})")
print(f" Services in this theme: {service_count}")
services_response = client.get_services_by_theme(theme_id, lang="en")
services = services_response.get("services", [])
if services:
print(f" Sample services (first 3):")
for service in services[:3]:
service_name = service.get("name", "N/A")
print(f" - {service_name}")
print("\n4. SEARCHING FOR SPECIFIC SERVICES")
print("-" * 70)
search_keywords = ["passport", "health", "education"]
for keyword in search_keywords:
search_results = client.search_services(query=keyword, lang="en")
results = search_results.get("results", [])
print(
f"\nSearch results for '{keyword}': {len(results)} services found"
)
if results:
for service in results[:2]:
service_name = service.get("name", "N/A")
print(f" - {service_name}")
print("\n5. BROWSING SECTORS (MINISTRIES)")
print("-" * 70)
sectors_response = client.list_sectors(lang="en")
total_sectors = sectors_response.get("total_sectors", 0)
print(f"Total sectors available: {total_sectors}")
if sectors_response.get("sectors"):
for idx, sector in enumerate(sectors_response["sectors"][:3], 1):
sector_id = sector.get("id")
sector_name = sector.get("name")
print(f"\n Sector {idx}: {sector_name} (ID: {sector_id})")
sector_services = client.get_services_by_sector(sector_id, lang="en")
services = sector_services.get("services", [])
if services:
print(f" Services in this sector (first 3):")
for service in services[:3]:
service_id = service.get("id")
service_name = service.get("name", "N/A")
print(f" - {service_name} (ID: {service_id})")
if service_id and idx == 1:
detail = client.get_service_detail(service_id, lang="en")
description = detail.get("description", "No description")
target_audience = detail.get("target_audience", [])
print(f" Description: {description[:100]}...")
if target_audience:
print(f" Target Audience: {', '.join(target_audience)}")
print("\n6. IMPORTANT GOVERNMENT LINKS")
print("-" * 70)
links_response = client.get_important_links(lang="en")
links = links_response.get("links", [])
if links:
print(f"Featured government links ({len(links)} total):")
for link in links[:5]:
link_name = link.get("name", "N/A")
link_url = link.get("url", "N/A")
print(f" - {link_name}: {link_url}")
print("\n" + "=" * 70)
print("API DEMONSTRATION COMPLETED SUCCESSFULLY")
print("=" * 70)
if __name__ == "__main__":
main()Fetch the main homepage of the Government Portal of Public Services, returning the portal description and basic metadata. Supports lang parameter (ar/fr/en).
| Param | Type | Description |
|---|---|---|
| lang | string | Language (ar/fr/en) |
{
"type": "object",
"fields": {
"url": "string",
"lang": "string",
"title": "string",
"description": "string"
},
"sample": {
"url": "http://bawaba.mna.gov.dz/index.php",
"lang": "en",
"title": "Government Portal of Public Services",
"description": "Algerian Portal for Public Services and Administrative Procedures"
}
}About the Bawabatic API
What the API Covers
The bawabatic.dz API surfaces data from Algeria's official public services portal. It covers the portal's full taxonomy of services: list_themes returns every theme/category with a total_themes count and per-theme service count, while list_sectors returns all ministries and government sectors with a total_sectors count. Every endpoint accepts an optional lang parameter accepting ar, fr, or en, so responses can be retrieved in the language most useful for your application.
Browsing and Searching Services
get_services_by_theme and get_services_by_sector both require an ID (theme_id or sector_id respectively) and return an array of services plus a count. To drill into a specific procedure, get_service_detail accepts a service_id and returns id, name, description, a metadata object, and a target_audience array — the most field-rich response in the API. search_services accepts a free-text query and returns a results array spanning all themes and sectors, making it the fastest way to locate a service without knowing its theme or sector in advance.
Supporting Endpoints
get_homepage returns the portal's title and description plus the resolved url and active lang — useful for confirming portal availability or surfacing localized portal copy. get_country_info returns structured fields including official_name, government, operator, location, and a contact object with Algeria's national contact details as listed on the portal. get_important_links returns an array of curated external government links featured on the portal homepage.
IDs and Navigation
Theme and sector IDs used by get_services_by_theme and get_services_by_sector are obtained from the themes array returned by list_themes and the sectors array returned by list_sectors respectively. Service IDs for get_service_detail are found within those service arrays. There is no separate ID-lookup endpoint, so the intended flow is: list → browse by theme or sector → detail.
The Bawabatic API is a managed, monitored endpoint for bawabatic.dz — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when bawabatic.dz changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official bawabatic.dz API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a multilingual directory of Algerian administrative procedures using
list_themesandget_service_detailfields liketarget_audienceanddescription. - Power a government chatbot that resolves citizen queries by calling
search_serviceswith a keyword and returning matching procedure names. - Map ministries to their services by pairing
list_sectorswithget_services_by_sectorfor a sector-level service inventory. - Integrate Algerian public service data into an expat or immigration guide using the
frorenlang parameter. - Aggregate official government portal links from
get_important_linksto build a curated resource hub for public administration. - Surface Algeria country metadata (
official_name,government,contact) in civic-tech or open-data dashboards viaget_country_info. - Monitor which themes have the most services by comparing
total_themescounts fromlist_themesover time.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does bawabatic.dz have an official developer API?+
What does `get_service_detail` return beyond a service name?+
get_service_detail returns id, name, description, a metadata object (which may include procedure-specific fields such as required documents or deadlines as presented on the portal), and a target_audience array identifying who the service applies to. All fields are returned in the language specified by the lang parameter.Does the API return downloadable forms or attached documents for procedures?+
Is there pagination for large result sets from `list_themes` or `list_sectors`?+
total_themes and total_sectors reflect the complete count. There are no offset or page parameters currently. If the portal adds significantly more entries and pagination becomes necessary, you can fork the API on Parse and revise it to add pagination support.Can I filter services by both theme and sector simultaneously?+
get_services_by_theme filters by theme_id and get_services_by_sector filters by sector_id — each filter operates independently. Cross-filtering by both dimensions in a single call is not currently supported. You can fork this API on Parse and revise it to add a combined filter endpoint.