{
  "info": {
    "_postman_id": "kyb-api-4e2b-8a7f-corporate1d25",
    "name": "KYB API - Algerian Corporate Identity & Temporal Compliance",
    "description": "Production and Sandbox API collection for Algerian KYB, single-identifier corporate resolution (NIF, RC, Raison Sociale), temporal invoice compliance under Décret exécutif 05-468 and Loi Fiscale Algérienne, and immutable double-entry ledger audits.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{apiKey}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "1. Corporate Resolution & Search",
      "item": [
        {
          "name": "Candidate Discovery Dropdown (Stage 1 - Autocomplete)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/entity/candidates?q=CEVITAL&searchMode=pm&live=false",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "entity", "candidates"],
              "query": [
                {
                  "key": "q",
                  "value": "CEVITAL",
                  "description": "Company name or RC prefix (min 4 characters)"
                },
                {
                  "key": "searchMode",
                  "value": "pm",
                  "description": "Filter: pm (default under ADR #118), pp, or both. Name search is optimized for PM."
                },
                {
                  "key": "live",
                  "value": "false",
                  "description": "Set to true to bypass cache and query CNRC free scraper pool"
                }
              ]
            },
            "description": "Fast autocomplete candidate discovery returning matching Algerian corporate companies (PM). Under ADR #118, name search is optimized for PM; PP entities are resolved deterministically via RC or NIF. Costs 1 credit (automatically refunded if 0 candidates found). Automatically upserts discovered entities into sovereign cache."
          }
        },
        {
          "name": "Targeted Detail Enrichment (Stage 2 - Certified Fiche)",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              },
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"rc_number\": \"16/00-0012345B20\",\n  \"raison_sociale\": \"CEVITAL AGRO INDUSTRIE\",\n  \"force_live\": false\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/entity/enrich",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "entity", "enrich"]
            },
            "description": "On-demand deep profile enrichment. Fetches multi-tab corporate attributes via paid session lease, validates NIF at DGI, and commits GOLDEN profile to DB. Costs 1 credit (automatically refunded on timeout or failure)."
          }
        },
        {
          "name": "Unified Resolver (By NIF, RC, or Name)",
          "request": {
            "method": "GET",
            "header": [
              {
                "key": "Accept",
                "value": "application/json"
              }
            ],
            "url": {
              "raw": "{{baseUrl}}/api/v1/entity/resolve?q=000816097764131",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "entity", "resolve"],
              "query": [
                {
                  "key": "q",
                  "value": "000816097764131",
                  "description": "Any single identifier: NIF (with or without 00 prefix), RC (e.g. 08B0977641), or Company Name (e.g. AIR ALGERIE)"
                }
              ]
            },
            "description": "Auto-detects identifier type (NIF, RC, or Raison Sociale) and returns full legal corporate profile. Deducts 1 credit (Tier 1). Refunds credit on NOT_FOUND."
          }
        },
        {
          "name": "Search Directory (Autocomplete)",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/search?q=ALGERIE",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "search"],
              "query": [
                {
                  "key": "q",
                  "value": "ALGERIE",
                  "description": "Search term across Algerian National Registry"
                }
              ]
            },
            "description": "Fuzzy full-text search across 26,000+ cached Algerian corporate entities. Sub-90ms latency."
          }
        },
        {
          "name": "Get Entity by NIF",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/entity/000816097764131",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "entity", "000816097764131"]
            },
            "description": "Retrieves official CNRC and DGI profile for an Algerian NIF. Supports legacy Wilaya 00 prefix."
          }
        }
      ]
    },
    {
      "name": "2. Temporal Invoice Compliance",
      "item": [
        {
          "name": "Submit Compliance Verification Batch",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"period\": \"2026-Q1\",\n  \"invoices\": [\n    {\n      \"nif\": \"000816097764131\",\n      \"invoice_date\": \"2026-03-15\",\n      \"amount_ttc\": 1250000,\n      \"article_imposition\": \"16012345678\"\n    },\n    {\n      \"rc\": \"00B0183304\",\n      \"invoice_date\": \"2026-02-10\",\n      \"amount_ttc\": 450000\n    }\n  ],\n  \"webhook_callback\": \"https://your-erp.domain.dz/webhooks/conforme\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/compliance/verify",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "compliance", "verify"]
            },
            "description": "Verifies up to 5,000 supplier invoices against historical strike-off (radiation) records under CID Art 169/176 and TCA Art 30. Ingests Article d'Imposition into sovereign crowd-cache."
          }
        },
        {
          "name": "Get Compliance Batch Job Status",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/compliance/jobs/{{jobId}}",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "compliance", "jobs", "{{jobId}}"]
            },
            "description": "Polls status and fetches line-by-line verification results and tax risk verdicts (SAFE vs REVIEW_NEEDED critical)."
          }
        }
      ]
    },
    {
      "name": "3. Ledger, Usage & Billing",
      "item": [
        {
          "name": "Tenant Ledger Audit Events",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/ledger/events?limit=50&offset=0",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "ledger", "events"],
              "query": [
                { "key": "limit", "value": "50", "description": "Max events to return" },
                { "key": "offset", "value": "0", "description": "Pagination offset" }
              ]
            },
            "description": "Retrieves immutable financial transaction history (charges, refunds, refills) for tenant account audits."
          }
        },
        {
          "name": "Tenant API Request Explorer",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/ledger/requests?limit=50&offset=0",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "ledger", "requests"],
              "query": [
                { "key": "limit", "value": "50", "description": "Max requests to return" },
                { "key": "offset", "value": "0", "description": "Pagination offset" }
              ]
            },
            "description": "Real-time audit log of recent API requests with HTTP status codes and credit consumption."
          }
        },
        {
          "name": "Master Pool Balance & Consumption Overview",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/billing/overview",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "billing", "overview"]
            },
            "description": "Returns current master pool balance, quota cap, active keys count, and 14-day daily consumption chart data."
          }
        }
      ]
    },
    {
      "name": "4. API Key Management",
      "item": [
        {
          "name": "List Tenant API Sub-Keys",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/keys",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "keys"]
            },
            "description": "Lists all active and revoked API sub-keys for the authenticated tenant with quota ceilings and IP whitelists."
          }
        },
        {
          "name": "Provision Scoped API Sub-Key",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"label\": \"Production ERP Integration\",\n  \"quotaCeiling\": 25000,\n  \"isSandbox\": false,\n  \"allowedIps\": [\"197.112.10.50\"]\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/keys",
              "host": ["{{baseUrl}}"],
              "path": ["api", "v1", "keys"]
            },
            "description": "Creates a new scoped API sub-key with optional quota ceiling, sandbox mode flag, and IP whitelist."
          }
        }
      ]
    },
    {
      "name": "5. System & Health",
      "item": [
        {
          "name": "Health Check Gate",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/health",
              "host": ["{{baseUrl}}"],
              "path": ["health"]
            },
            "description": "Public health check endpoint validating PostgreSQL and Redis connectivity."
          }
        }
      ]
    }
  ]
}
