Discover/Gov API
live

Gov APIncar.gov.sa

Access Saudi regulations, international treaties, Um Al-Qura newspaper archives, and governmental coding data via the NCAR ncar.gov.sa API.

Endpoints
7
Updated
2mo ago

What is the Gov API?

This API exposes 7 endpoints covering Saudi Arabia's official governmental document repository at ncar.gov.sa, including rules and regulations, international conventions and treaties, Um Al-Qura newspaper archives, and administrative coding hierarchies. The global_search endpoint lets you query across all content types in a single call, while dedicated endpoints like search_rules_and_regulations and get_regulation_details give structured access to individual legislative documents by encrypted document ID.

Try it
Page number
Number of results per page
Sort order (ASC/DESC)
Column to sort by
api.parse.bot/scraper/76b4a511-4473-467d-a219-faaf36adcc3e/<endpoint>
Ready to send
Fill in the parameters and hit sign in to send to see live response data here.
Call it over HTTPgrab a free API key at signup
curl -X GET 'https://api.parse.bot/scraper/76b4a511-4473-467d-a219-faaf36adcc3e/search_rules_and_regulations?page=1&limit=10&sort_order=DESC&sort_column=IsTranslated' \
  -H 'X-API-Key: $PARSE_API_KEY'
Python SDK · recommended

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 ncar-gov-sa-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.

"""
NCAR Saudi Arabia API Client
Access to Saudi National Center for Archives and Records data.
Get your API key from: https://parse.bot/settings
"""

import os
import requests
from typing import Any, Dict, List, Optional


class ParseClient:
    """Client for NCAR Saudi Arabia API."""

    def __init__(self, api_key: Optional[str] = None):
        """
        Initialize the Parse API client.

        Args:
            api_key: API key for authentication. Defaults to PARSE_API_KEY env var.
        """
        self.base_url = "https://api.parse.bot"
        self.scraper_id = "635962d4-1cf3-4667-8967-7fa96e07c2f1"
        self.api_key = api_key or os.getenv("PARSE_API_KEY")
        if not self.api_key:
            raise ValueError("API key required. Set PARSE_API_KEY env var or pass api_key parameter.")

    def _call(self, endpoint: str, method: str = "POST", **params) -> Dict[str, Any]:
        """
        Make a request to the API.

        Args:
            endpoint: API endpoint name
            method: HTTP method (GET or POST)
            **params: Query/body parameters

        Returns:
            API response as dictionary
        """
        url = f"{self.base_url}/scraper/{self.scraper_id}/{endpoint}"
        headers = {
            "X-API-Key": self.api_key,
            "Content-Type": "application/json"
        }

        if method == "GET":
            response = requests.get(url, headers=headers, params=params)
        elif method == "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 search_rules_and_regulations(
        self,
        page: int = 1,
        limit: int = 10,
        sort_column: str = "IsTranslated",
        sort_order: str = "DESC"
    ) -> Dict[str, Any]:
        """
        Search for Saudi rules and regulations with pagination and sorting.

        Args:
            page: Page number (default: 1)
            limit: Number of results per page (default: 10)
            sort_column: Column to sort by (default: IsTranslated)
            sort_order: Sort order ASC/DESC (default: DESC)

        Returns:
            Search results containing data array and metadata
        """
        return self._call(
            "search_rules_and_regulations",
            method="GET",
            page=page,
            limit=limit,
            sort_column=sort_column,
            sort_order=sort_order
        )

    def get_regulation_details(self, doc_id: str) -> Dict[str, Any]:
        """
        Get full details of a specific regulation by its document ID.

        Args:
            doc_id: The encrypted document ID

        Returns:
            Regulation details including title, summary, and attachments
        """
        return self._call(
            "get_regulation_details",
            method="GET",
            doc_id=doc_id
        )

    def search_conventions_and_treaties(
        self,
        page: int = 1,
        limit: int = 10,
        sort_column: str = "IsTranslated",
        sort_order: str = "DESC"
    ) -> Dict[str, Any]:
        """
        Search for Saudi international conventions and treaties.

        Args:
            page: Page number (default: 1)
            limit: Number of results per page (default: 10)
            sort_column: Column to sort by (default: IsTranslated)
            sort_order: Sort order ASC/DESC (default: DESC)

        Returns:
            Search results containing conventions and treaties
        """
        return self._call(
            "search_conventions_and_treaties",
            method="GET",
            page=page,
            limit=limit,
            sort_column=sort_column,
            sort_order=sort_order
        )

    def search_um_alqura_newspaper(
        self,
        page: int = 1,
        limit: int = 8,
        sort_order: str = "DESC"
    ) -> Dict[str, Any]:
        """
        Search for Um Al-Qura newspaper issues.

        Args:
            page: Page number (default: 1)
            limit: Number of results per page (default: 8)
            sort_order: Sort order ASC/DESC (default: DESC)

        Returns:
            Newspaper issues with dates and versions
        """
        return self._call(
            "search_um_alqura_newspaper",
            method="GET",
            page=page,
            limit=limit,
            sort_order=sort_order
        )

    def global_search(self, query: str) -> Dict[str, Any]:
        """
        Perform a global site search across all content types.

        Args:
            query: Search keyword

        Returns:
            Search results across magazines, news, and other content
        """
        return self._call(
            "global_search",
            method="POST",
            query=query
        )

    def get_regions_coding(self) -> Dict[str, Any]:
        """
        Get the hierarchy of administrative regions coding.

        Returns:
            Array of regions with IDs and names
        """
        return self._call(
            "get_regions_coding",
            method="GET"
        )

    def get_governmental_coding(self, name: str = "") -> Dict[str, Any]:
        """
        Search for governmental entity coding data.

        Args:
            name: Agency name to filter by (optional)

        Returns:
            Array of governmental entities with IDs and names
        """
        return self._call(
            "get_governmental_coding",
            method="POST",
            name=name
        )


def main():
    """Practical workflow demonstrating the API client."""
    # Initialize client
    client = ParseClient()

    print("=" * 70)
    print("NCAR Saudi Arabia API - Practical Workflow Example")
    print("=" * 70)

    # Step 1: Search for regulations
    print("\n[1] Searching for rules and regulations (first 5 results)...")
    regulations_result = client.search_rules_and_regulations(page=1, limit=5)

    if regulations_result.get("status") == 1:
        regulations = regulations_result.get("data", [])
        total_count = regulations_result.get("dataLength", 0)
        print(f"✓ Found {total_count} total regulations. Showing {len(regulations)} results:\n")

        for i, reg in enumerate(regulations, 1):
            title = reg.get("title_en", "N/A")
            number = reg.get("number", "N/A")
            date = reg.get("approve_date", "N/A")
            doc_id = reg.get("id", "")

            print(f"  {i}. {title}")
            print(f"     Number: {number} | Date: {date}")

            # Step 2: Get detailed information for the first regulation
            if i == 1 and doc_id:
                print(f"\n[2] Getting detailed information for first regulation (ID: {doc_id[:20]}...)...")
                try:
                    details = client.get_regulation_details(doc_id)
                    if details.get("status") == 1:
                        data = details.get("data", {})
                        summary = data.get("summery_en", "No summary available")
                        print(f"✓ Summary: {summary[:150]}..." if len(summary) > 150 else f"✓ Summary: {summary}")
                except Exception as e:
                    print(f"⚠ Could not fetch details: {str(e)}")
            print()

    # Step 3: Search for conventions and treaties
    print("[3] Searching for international conventions and treaties (first 3 results)...")
    conventions_result = client.search_conventions_and_treaties(page=1, limit=3)

    if conventions_result.get("status") == 1:
        conventions = conventions_result.get("data", [])
        total_count = conventions_result.get("dataLength", 0)
        print(f"✓ Found {total_count} total conventions. Showing {len(conventions)} results:\n")

        for i, conv in enumerate(conventions, 1):
            title = conv.get("title_en", "N/A")
            print(f"  {i}. {title}")
        print()

    # Step 4: Search Um Al-Qura newspaper
    print("[4] Searching Um Al-Qura newspaper (latest 3 issues)...")
    newspaper_result = client.search_um_alqura_newspaper(page=1, limit=3)

    if newspaper_result.get("status") == 1:
        issues = newspaper_result.get("data", [])
        total_count = newspaper_result.get("dataLength", 0)
        print(f"✓ Found {total_count} total newspaper issues. Showing {len(issues)} results:\n")

        for i, issue in enumerate(issues, 1):
            date = issue.get("date", "N/A")
            version = issue.get("version", "N/A")
            issue_id = issue.get("id", "N/A")
            print(f"  {i}. Issue Date: {date} | Version: {version} | ID: {issue_id}")
        print()

    # Step 5: Global search example
    print("[5] Performing global search for 'labor'...")
    search_result = client.global_search(query="labor")

    if search_result.get("status") == 1:
        data = search_result.get("data", {})
        news = data.get("news", [])
        magazines = data.get("magazines", [])
        print(f"✓ Global search completed")
        print(f"  - News items found: {len(news)}")
        print(f"  - Magazine items found: {len(magazines)}")
        print()

    # Step 6: Get administrative regions
    print("[6] Fetching administrative regions coding...")
    regions_result = client.get_regions_coding()

    if regions_result.get("status") == 1:
        regions = regions_result.get("data", [])
        print(f"✓ Found {len(regions)} regions:\n")
        for i, region in enumerate(regions[:5], 1):
            name = region.get("name_ar", "N/A")
            region_id = region.get("id", "N/A")
            print(f"  {i}. ID: {region_id} | Name (AR): {name}")
        if len(regions) > 5:
            print(f"  ... and {len(regions) - 5} more regions")
        print()

    # Step 7: Get governmental entities
    print("[7] Fetching governmental entity coding...")
    gov_result = client.get_governmental_coding()

    if gov_result.get("status") == 1:
        entities = gov_result.get("data", [])
        print(f"✓ Found {len(entities)} governmental entities:\n")
        for i, entity in enumerate(entities[:5], 1):
            name = entity.get("name_ar", "N/A")
            entity_id = entity.get("id", "N/A")
            print(f"  {i}. ID: {entity_id} | Name (AR): {name}")
        if len(entities) > 5:
            print(f"  ... and {len(entities) - 5} more entities")
        print()

    print("=" * 70)
    print("Workflow completed successfully!")
    print("=" * 70)


if __name__ == "__main__":
    main()
All endpoints · 7 totalmissing one? ·

Search for Saudi rules and regulations with pagination and sorting.

Input
ParamTypeDescription
pageintegerPage number
limitintegerNumber of results per page
sort_orderstringSort order (ASC/DESC)
sort_columnstringColumn to sort by
Response
{
  "type": "object",
  "fields": {
    "data": "array",
    "status": "integer",
    "messages": "array",
    "dataLength": "integer"
  },
  "sample": {
    "data": {
      "data": [
        {
          "id": "eyJpdiI6ImxZTUk3V3Vnci9zZlBwS05vbjZIYkE9PSIsInZhbHVlIjoiOTJZNC9LeThGYjVnUktlQi9XQkJkUT09IiwibWFjIjoiM2E2OTVlYmEwMTM5NzNmZTZlYzMzZjZlODAzNjM2MzQxODFkMWNmNDhlOTM3YWRmNTRhMDY4ZmI0MTE2MmZmNCIsInRhZyI6IiJ9",
          "marker": {
            "class": "valid",
            "title_ar": "الوثيقة سارية",
            "title_en": "The document is valid"
          },
          "number": "أ/164",
          "status": "2",
          "checked": false,
          "Approves": [
            {
              "id": 1,
              "name_ar": "أمر ملكي",
              "name_en": "Royal Order",
              "TypeOrder": "1",
              "approve_date": "١٤٢٨/٠٩/٢٦"
            }
          ],
          "is_valid": "سارية",
          "title_ar": "اللائحة التنفيذية لنظام هيئة البيعة لعام 1428هـ",
          "title_en": "Implementing Regulations of the Succession Commission Law 2007M",
          "is_latest": 0,
          "approve_date": "١٤٢٨/٠٩/٢٦",
          "IsGovernmental": 0,
          "PublishingStatus": 1
        },
        {
          "id": "eyJpdiI6IjdHbG1GNjdEMzRlaGx6TGY1Q21GQnc9PSIsInZhbHVlIjoiNE83d2NzeXFjb09oajlNUkpGK0FPQT09IiwibWFjIjoiNDMzOWM5MjVjMDE5ZTE5ZGRmZTMzMGRiM2RhYjViZDNjOWNiNWI2ZGExZmE0OGE5ZWJiMjc5MzRiMmNmNzhlNyIsInRhZyI6IiJ9",
          "marker": {
            "class": "valid-modified",
            "title_ar": "الوثيقة سارية ومعدلة",
            "title_en": "The document is valid and amended"
          },
          "number": "م/3",
          "status": "2",
          "checked": false,
          "Approves": [
            {
              "id": 2,
              "name_ar": "مرسوم ملكي",
              "name_en": "Royal Decree",
              "TypeOrder": "2",
              "approve_date": "١٣٩٣/٠٢/١٠"
            }
          ],
          "is_valid": "سارية",
          "title_ar": "نظام العلم للمملكة العربية السعودية لعام 1393هـ",
          "title_en": "Flag Law of the Kingdom of Saudi Arabia for the year 1973",
          "is_latest": 0,
          "approve_date": "١٣٩٣/٠٢/١٠",
          "IsGovernmental": 0,
          "PublishingStatus": 1
        },
        {
          "id": "eyJpdiI6ImVaZkhGU3dyYURNcFhwRndVOXR1Nnc9PSIsInZhbHVlIjoiMWhjWk1yMlUzV1JxUHZDbUxHaG0vQT09IiwibWFjIjoiMTRkZWM5ODE5NjVhYWM5NzhkMmE3NTU4YjJmNGExZmI2YWU5Y2UzZmRhOGRmMTBhNzIzZjg4YWYzOTZhNDhhYiIsInRhZyI6IiJ9",
          "marker": {
            "class": "valid",
            "title_ar": "الوثيقة سارية",
            "title_en": "The document is valid"
          },
          "number": "أ/135",
          "status": "2",
          "checked": false,
          "Approves": [
            {
              "id": 1,
              "name_ar": "أمر ملكي",
              "name_en": "Royal Order",
              "TypeOrder": "1",
              "approve_date": "١٤٢٧/٠٩/٢٦"
            }
          ],
          "is_valid": "سارية",
          "title_ar": "نظام هيئة البيعة لعام 1427هـ",
          "title_en": "Succession Commission Law 1427H",
          "is_latest": 0,
          "approve_date": "١٤٢٧/٠٩/٢٦",
          "IsGovernmental": 0,
          "PublishingStatus": 1
        }
      ],
      "status": 1,
      "messages": 0,
      "dataLength": 6621
    },
    "status": "success"
  }
}

About the Gov API

Regulations and Conventions

search_rules_and_regulations accepts page, limit, sort_order, and sort_column parameters, returning a paginated data array alongside a dataLength integer that reflects the total result count. Once you have a document identifier from that listing, get_regulation_details takes the encrypted doc_id and returns a single data object with the full record for that regulation or convention. search_conventions_and_treaties follows the same pagination and sorting interface and also exposes a dataLength field, making it straightforward to build paginated clients that walk the full treaty catalog.

Um Al-Qura Newspaper Archive

search_um_alqura_newspaper provides access to issues of the Saudi official gazette, Um Al-Qura, with page, limit, and sort_order controls. The endpoint returns a data array of matching issues and a dataLength count. This is useful for locating historical gazette entries that published royal decrees, ministerial decisions, or official announcements.

Governmental and Regional Coding

get_regions_coding requires no input parameters and returns the full hierarchy of Saudi administrative regions as a data array. get_governmental_coding accepts an optional name string to filter results by agency name, returning matching governmental entity records. Both endpoints return a status integer alongside their data payloads.

Global Search

The global_search POST endpoint accepts a query string and returns a data object that spans all content types — regulations, treaties, newspaper issues, and coding records — in a single response. This is useful when the content type is unknown or when building a unified search interface over NCAR's document holdings.

Reliability & maintenance

The Gov API is a managed, monitored endpoint for ncar.gov.sa — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when ncar.gov.sa 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 ncar.gov.sa 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?+
It's built not to. Every endpoint is health-checked on a schedule with automated test probes. When the source site changes and a check fails, the API is automatically queued for repair and re-verified — that's the self-healing layer. Each API page shows when its endpoints were last verified. And because marketplace APIs are shared, any fix reaches everyone using it.
Is this an official API from the source site?+
No — Parse APIs are independent, managed REST wrappers over publicly available data. That is the point: where a site has no official API (or only a limited one), Parse gives you a maintained, monitored endpoint for that data and keeps it working as the site changes — so you get a stable contract over a source that never promised one.
Can I fix or extend this API myself if I need a new endpoint or field?+
Yes — and you don't have to wait on us. This API was generated by the Parse agent, which stays attached. Describe the change in plain English ("add an endpoint that returns reviews", "fix the price field") in the revise box on the API page or via the revise_api MCP tool, and the agent rebuilds it against the live site in minutes. Contributing the change back to the public API is free.
What happens if I call an endpoint that has an issue?+
Errors are machine-readable: a bad call returns a clean status with the list of available endpoints and a repair hint, so an agent (or you) can recover or trigger a fix instead of failing silently. Confirmed failures feed the automatic repair queue.
Common use cases
  • Build a compliance tool that retrieves current Saudi regulations by keyword using search_rules_and_regulations and get_regulation_details.
  • Aggregate Saudi international treaty data for legal research by paginating through search_conventions_and_treaties results.
  • Index historical Um Al-Qura newspaper issues for archival or journalistic research using search_um_alqura_newspaper.
  • Map Saudi administrative region hierarchies for geospatial or logistics applications using get_regions_coding.
  • Look up governmental entity codes by agency name with get_governmental_coding to validate or enrich government procurement records.
  • Power a unified document search interface over NCAR holdings using the global_search endpoint with a single query string.
  • Monitor newly published regulations by polling search_rules_and_regulations with sort_order=DESC sorted by publication date.
Pricing & limitsSee full pricing →
TierPriceCredits/monthRate limit
Free$0/mo1005 req/min
Hobby$30/mo1,00020 req/min
Developer$100/mo5,000100 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.

Frequently asked questions
Does ncar.gov.sa offer an official developer API?+
NCAR does not publish a documented public developer API. The data accessible through this API reflects the content available on the ncar.gov.sa website.
What does `get_regulation_details` return compared to the search endpoints?+
get_regulation_details returns a single data object with the full detail record for one document, identified by its encrypted doc_id. The search endpoints — search_rules_and_regulations and search_conventions_and_treaties — return data arrays of summary records with a dataLength count, intended for listing and pagination rather than full document retrieval.
Can I filter Um Al-Qura newspaper results by date range or issue number?+
search_um_alqura_newspaper currently accepts page, limit, and sort_order parameters only — there is no date-range or issue-number filter parameter exposed. You can fork this API on Parse and revise it to add a date or issue filter endpoint if your use case requires it.
Does the API return the full text or PDF content of regulations?+
The endpoints return structured metadata and document records as JSON fields. Full-text document content or PDF file delivery is not currently exposed. You can fork this API on Parse and revise it to add an endpoint that retrieves document file links or full text if that data is accessible from the source.
How does pagination work across the listing endpoints?+
The search_rules_and_regulations, search_conventions_and_treaties, and search_um_alqura_newspaper endpoints all accept page and limit integer parameters. Each response includes a dataLength integer representing the total number of matching records, which you can use to calculate total page counts client-side.
Page content last updated . Spec covers 7 endpoints from ncar.gov.sa.
Related APIs in Government PublicSee all →
content.naic.org API
Search and access comprehensive insurance regulatory information from state departments, including news articles, glossary definitions, committee details, and company data. Find contact information for state insurance regulators, look up insurance industry terms, and research specific insurance companies all in one place.
tenders.etimad.sa API
Browse and search all public Saudi government tenders from the Etimad platform with detailed information including tender specifications and awarding results. Stay updated on procurement opportunities by accessing tender details and award outcomes in one centralized location.
pncp.gov.br API
Search and retrieve detailed information about Brazil's public procurement contracts, including bidding results, price registries, and annual contracting plans from the official PNCP portal. Monitor government procurement activities by looking up specific contracts, procurement processes, and procurement records all in one place.
occrp.org API
Search and discover investigative journalism from OCCRP.org, including articles, investigations, and projects organized by section and region. Get the latest news updates and detailed information about specific investigations to stay informed on organized crime and corruption reporting.
examplecourt.gov API
Search and retrieve court judgments, case details, and legal metadata from a national court reporting portal, with support for advanced filtering by court and case category. Access complete case information including full text and browse paginated results to find relevant legal precedents.
naco.org API
Search and explore detailed U.S. county government information, including profiles, economic indicators, funding data, and research resources all in one place. Quickly access bulk county statistics and NACo insights to support planning, analysis, and decision-making at the local government level.
naics.com API
Find NAICS industry classification codes and their detailed descriptions by searching keywords or browsing all available codes to identify the right sector and industry classification for your business. Get comprehensive information including code numbers, sector titles, and related industry details to ensure accurate business categorization.
example-indian-regulatory-site.com API
Search and retrieve penalty data from Indian regulators like SEBI and RBI to discover fines, violation types, and enforcement actions against specific companies or across regulatory bodies. Find detailed information about penalties imposed on entities, browse violation categories, and access comprehensive enforcement records from major Indian financial authorities.