{
  "openapi": "3.0.0",
  "info": {
    "title": "Nilinde Hub API",
    "version": "1.0",
    "description": "Kenyan identity, vehicle, business, tax, phone and background checks through one API. Authenticate with `Authorization: Bearer <API key>`: `sk_test_…` keys use the sandbox (sample data, free), `sk_live_…` keys query the real sources and are charged. Guides, errors and webhooks are in the documentation."
  },
  "servers": [
    {
      "url": "https://restapi.nilinde.com"
    }
  ],
  "security": [
    {
      "ApiKey": []
    }
  ],
  "tags": [
    {
      "name": "Identity",
      "description": "People's identity records: national ID, alien ID and passport (IPRS), and driving licences and PSV badges (NTSA)."
    },
    {
      "name": "Vehicles",
      "description": "Vehicle records from NTSA: make, model, owners and caveats for a number plate."
    },
    {
      "name": "Tax",
      "description": "KRA PIN lookups."
    },
    {
      "name": "Businesses",
      "description": "Company and business-name records from the Business Registration Service."
    },
    {
      "name": "Phone numbers",
      "description": "Safaricom mobile number checks: who a number is registered to, recent SIM swaps and how long a number has been on the network. Numbers on other networks can't be checked."
    },
    {
      "name": "Background checks",
      "description": "Police clearance (certificate of good conduct) verification against the DCI portal."
    },
    {
      "name": "Verification records",
      "description": "Look up verifications you've already made, and summarise usage."
    },
    {
      "name": "Billing and usage",
      "description": "Your prepaid wallet balance and this month's usage against your bundle. Pricing, charging and top-ups are explained in the Billing guide."
    }
  ],
  "x-tagGroups": [
    {
      "name": "Verification APIs",
      "tags": [
        "Identity",
        "Vehicles",
        "Tax",
        "Businesses",
        "Phone numbers",
        "Background checks"
      ]
    },
    {
      "name": "Account",
      "tags": [
        "Verification records",
        "Billing and usage"
      ]
    }
  ],
  "paths": {
    "/v1/verifications": {
      "get": {
        "operationId": "VerificationController_list",
        "tags": [
          "Verification records"
        ],
        "summary": "List verifications",
        "description": "Your organization's verifications, newest first. A key sees only its own environment (test keys see test verifications).",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Page size, 1 to 100.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "`nextCursor` from the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "apiCode",
            "in": "query",
            "required": false,
            "description": "Only this API, e.g. `identity.national-id`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "COMPLETED",
                "FAILED"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One page of verifications.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationPage"
                },
                "examples": {
                  "page": {
                    "summary": "A page",
                    "value": {
                      "data": [
                        {
                          "id": "cmhd2k7q80001s60h3x9f2a1b",
                          "api": "tax.kra-pin",
                          "status": "COMPLETED",
                          "environment": "LIVE",
                          "result": {
                            "found": true,
                            "idNumber": "12345678",
                            "taxpayer": {
                              "pin": "A000000000S",
                              "name": "JANE WANJIKU DOE"
                            }
                          },
                          "error": null,
                          "cost": "50",
                          "latencyMs": 412,
                          "createdAt": "2026-10-30T09:15:02.118Z",
                          "completedAt": "2026-10-30T09:15:02.530Z"
                        }
                      ],
                      "nextCursor": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/summary": {
      "get": {
        "operationId": "VerificationController_summary",
        "tags": [
          "Verification records"
        ],
        "summary": "Usage summary",
        "description": "Calls, success rate and cost per API over a period (default: the last 30 days).",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": false,
            "description": "Start (inclusive), ISO 8601.",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "example": "2026-10-01T00:00:00Z"
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "description": "End (exclusive), ISO 8601.",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "example": "2026-11-01T00:00:00Z"
          }
        ],
        "responses": {
          "200": {
            "description": "The summary.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerificationSummary"
                },
                "examples": {
                  "summary": {
                    "summary": "October",
                    "value": {
                      "from": "2026-10-01T00:00:00.000Z",
                      "to": "2026-11-01T00:00:00.000Z",
                      "environment": "LIVE",
                      "calls": 128,
                      "completed": 126,
                      "successRate": 0.984375,
                      "totalCost": "6300",
                      "byApi": [
                        {
                          "apiCode": "identity.national-id",
                          "calls": 100,
                          "completed": 99,
                          "failed": 1,
                          "cost": "4950"
                        },
                        {
                          "apiCode": "tax.kra-pin",
                          "calls": 28,
                          "completed": 27,
                          "failed": 1,
                          "cost": "1350"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid period.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "summary": "`from` after `to`",
                    "value": {
                      "statusCode": 400,
                      "message": "Validation failed",
                      "issues": [
                        {
                          "path": [],
                          "message": "`from` must be before `to`"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/{id}": {
      "get": {
        "operationId": "VerificationController_get",
        "tags": [
          "Verification records"
        ],
        "summary": "Get a verification",
        "description": "Fetch a verification again by its `id`, e.g. after a timeout or to show a past result.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "cmhd2k7q80001s60h3x9f2a1b"
          }
        ],
        "responses": {
          "200": {
            "description": "The verification.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "found": {
                    "summary": "Completed",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "tax.kra-pin",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "idNumber": "12345678",
                        "taxpayer": {
                          "pin": "A000000000S",
                          "name": "JANE WANJIKU DOE"
                        }
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such verification in this key's environment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notFound": {
                    "summary": "Not found",
                    "value": {
                      "statusCode": 404,
                      "message": "Verification not found"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/wallet": {
      "get": {
        "operationId": "BillingController_getWallet",
        "tags": [
          "Billing and usage"
        ],
        "summary": "Get wallet balance",
        "description": "Your organization's prepaid balance. Top-ups are made in the dashboard.",
        "responses": {
          "200": {
            "description": "The wallet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                },
                "examples": {
                  "wallet": {
                    "summary": "Wallet",
                    "value": {
                      "id": "cmh8w1a2b0000s60hwallet01",
                      "organizationId": "cmh8w0z9y0000s60horg00001",
                      "balance": "12450",
                      "currency": "KES",
                      "createdAt": "2026-09-02T07:30:00.000Z",
                      "updatedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/usage/quota": {
      "get": {
        "operationId": "UsageController_quota",
        "tags": [
          "Billing and usage"
        ],
        "summary": "Get monthly usage",
        "description": "Verifications made this calendar month against your bundle's monthly quota.",
        "responses": {
          "200": {
            "description": "This month's usage.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quota"
                },
                "examples": {
                  "limited": {
                    "summary": "Bundle with a quota",
                    "value": {
                      "period": "2026-10",
                      "calls": 128,
                      "quota": 1000
                    }
                  },
                  "unlimited": {
                    "summary": "No quota",
                    "value": {
                      "period": "2026-10",
                      "calls": 128,
                      "quota": null
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/identity.national-id": {
      "post": {
        "tags": [
          "Identity"
        ],
        "operationId": "verify_identity_national_id",
        "summary": "National ID, alien ID or passport (IPRS)",
        "description": "Looks up a national ID, alien ID or passport in IPRS by its document type and number, and returns the holder's registered names, date of birth, gender and citizenship.\n\n**Price:** set by your bundle; one charge per call. \"Not found\" answers (`result.found: false`) are charged. Source failures return `502` and are refunded.\n\n**Try it:** press **Test** on the request panel, choose **ApiKey** under Authentication and paste your test key (kept for this browser session). **Use Example** loads a scenario for each outcome. Test keys return sandbox sample data, free.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes retries safe: a repeat with the same key and body returns the original verification without charging again. Up to 255 characters.",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "example": "6f1c2a90-order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "idType": {
                    "type": "string",
                    "enum": [
                      "NATIONAL_ID",
                      "ALIEN_ID",
                      "PASSPORT"
                    ],
                    "description": "Kind of document `idNumber` belongs to.",
                    "example": "NATIONAL_ID"
                  },
                  "idNumber": {
                    "type": "string",
                    "pattern": "^[A-Z0-9]{4,20}$",
                    "description": "Document number. National IDs are 6-10 digits.",
                    "example": "12345678"
                  }
                },
                "required": [
                  "idType",
                  "idNumber"
                ]
              },
              "examples": {
                "match-0": {
                  "summary": "Match",
                  "value": {
                    "idType": "NATIONAL_ID",
                    "idNumber": "12345678"
                  }
                },
                "no-such-person-1": {
                  "summary": "No such person",
                  "value": {
                    "idType": "NATIONAL_ID",
                    "idNumber": "00000000"
                  }
                },
                "iprs-unavailable-502-refunded-2": {
                  "summary": "IPRS unavailable (502, refunded)",
                  "value": {
                    "idType": "NATIONAL_ID",
                    "idNumber": "99999999"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification completed; see `result`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "match-0": {
                    "summary": "Match",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "identity.national-id",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "idType": "NATIONAL_ID",
                        "person": {
                          "idNumber": "12345678",
                          "firstName": "JANE",
                          "middleName": "WANJIKU",
                          "lastName": "DOE",
                          "dateOfBirth": "1990-01-15",
                          "gender": "F",
                          "citizenship": "KENYAN"
                        }
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  },
                  "no-such-person-1": {
                    "summary": "No such person",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "identity.national-id",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": false,
                        "idType": "NATIONAL_ID",
                        "idNumber": "00000000"
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The input failed validation; `issues` lists each problem.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "summary": "Missing or invalid fields",
                    "value": {
                      "statusCode": 400,
                      "message": "Validation failed",
                      "issues": [
                        {
                          "code": "invalid_value",
                          "values": [
                            "NATIONAL_ID",
                            "ALIEN_ID",
                            "PASSPORT"
                          ],
                          "path": [
                            "idType"
                          ],
                          "message": "Invalid option: expected one of \"NATIONAL_ID\"|\"ALIEN_ID\"|\"PASSPORT\""
                        },
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "idNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The wallet can't cover this call (live keys only). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficientFunds": {
                    "summary": "Insufficient funds",
                    "value": {
                      "statusCode": 402,
                      "code": "INSUFFICIENT_FUNDS",
                      "message": "Insufficient wallet balance"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This API isn't in your organization's bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notInPlan": {
                    "summary": "API not in your bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "API_NOT_IN_PLAN",
                      "message": "Your plan does not include identity.national-id"
                    }
                  },
                  "noSubscription": {
                    "summary": "No active bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "NO_ACTIVE_SUBSCRIPTION",
                      "message": "No active subscription"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was used for a different request, or that request is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "reused": {
                    "summary": "Key reused with a different body",
                    "value": {
                      "statusCode": 409,
                      "message": "Idempotency-Key was already used for a different request"
                    }
                  },
                  "inProgress": {
                    "summary": "First attempt still running",
                    "value": {
                      "statusCode": 409,
                      "message": "A request with this Idempotency-Key is still in progress"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Monthly quota reached, or more than 120 requests a minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "summary": "Monthly quota reached",
                    "value": {
                      "statusCode": 429,
                      "code": "QUOTA_EXCEEDED",
                      "message": "Monthly quota of 1000 calls reached"
                    }
                  },
                  "rateLimit": {
                    "summary": "Rate limit",
                    "value": {
                      "statusCode": 429,
                      "message": "ThrottlerException: Too Many Requests"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The source failed or didn't answer. The charge was refunded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "iprs-unavailable-502-refunded-2": {
                    "summary": "IPRS unavailable (502, refunded)",
                    "value": {
                      "statusCode": 502,
                      "code": "PROVIDER_UNAVAILABLE",
                      "message": "IPRS is unavailable (sandbox simulation)",
                      "retryable": true,
                      "requestId": "cmhd2k7q80001s60h3x9f2a1b"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/identity.driving-licence": {
      "post": {
        "tags": [
          "Identity"
        ],
        "operationId": "verify_identity_driving_licence",
        "summary": "Driving licence & PSV badge (NTSA)",
        "description": "Looks up the driving licence held under a Kenyan national ID number in NTSA: holder name, licence number, status, classes and expiry date, plus the PSV badge (number, status, expiry, licensed for) when the holder has one (`psvLicence`, otherwise null).\n\n**Price:** set by your bundle; one charge per call. \"Not found\" answers (`result.found: false`) are charged. Source failures return `502` and are refunded.\n\n**Try it:** press **Test** on the request panel, choose **ApiKey** under Authentication and paste your test key (kept for this browser session). **Use Example** loads a scenario for each outcome. Test keys return sandbox sample data, free.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes retries safe: a repeat with the same key and body returns the original verification without charging again. Up to 255 characters.",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "example": "6f1c2a90-order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "idNumber": {
                    "type": "string",
                    "pattern": "^\\d{6,10}$",
                    "description": "National ID number of the licence holder.",
                    "example": "12345678"
                  }
                },
                "required": [
                  "idNumber"
                ]
              },
              "examples": {
                "match-0": {
                  "summary": "Match",
                  "value": {
                    "idNumber": "12345678"
                  }
                },
                "no-licence-under-this-id-1": {
                  "summary": "No licence under this ID",
                  "value": {
                    "idNumber": "00000000"
                  }
                },
                "ntsa-unavailable-502-refunded-2": {
                  "summary": "NTSA unavailable (502, refunded)",
                  "value": {
                    "idNumber": "99999999"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification completed; see `result`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "match-0": {
                    "summary": "Match",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "identity.driving-licence",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "idNumber": "12345678",
                        "holderName": "JANE WANJIKU DOE",
                        "drivingLicence": {
                          "referenceNumber": "DL-0000001",
                          "status": "valid",
                          "classes": [
                            "B",
                            "C1"
                          ],
                          "expiryDate": "2030-01-15"
                        },
                        "psvLicence": {
                          "referenceNumber": "PSV-0000001",
                          "status": "valid",
                          "expiryDate": "2027-06-30",
                          "licensedFor": "PSV DRIVER"
                        }
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  },
                  "no-licence-under-this-id-1": {
                    "summary": "No licence under this ID",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "identity.driving-licence",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": false,
                        "idNumber": "00000000"
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The input failed validation; `issues` lists each problem.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "summary": "Missing or invalid fields",
                    "value": {
                      "statusCode": 400,
                      "message": "Validation failed",
                      "issues": [
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "idNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The wallet can't cover this call (live keys only). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficientFunds": {
                    "summary": "Insufficient funds",
                    "value": {
                      "statusCode": 402,
                      "code": "INSUFFICIENT_FUNDS",
                      "message": "Insufficient wallet balance"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This API isn't in your organization's bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notInPlan": {
                    "summary": "API not in your bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "API_NOT_IN_PLAN",
                      "message": "Your plan does not include identity.national-id"
                    }
                  },
                  "noSubscription": {
                    "summary": "No active bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "NO_ACTIVE_SUBSCRIPTION",
                      "message": "No active subscription"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was used for a different request, or that request is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "reused": {
                    "summary": "Key reused with a different body",
                    "value": {
                      "statusCode": 409,
                      "message": "Idempotency-Key was already used for a different request"
                    }
                  },
                  "inProgress": {
                    "summary": "First attempt still running",
                    "value": {
                      "statusCode": 409,
                      "message": "A request with this Idempotency-Key is still in progress"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Monthly quota reached, or more than 120 requests a minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "summary": "Monthly quota reached",
                    "value": {
                      "statusCode": 429,
                      "code": "QUOTA_EXCEEDED",
                      "message": "Monthly quota of 1000 calls reached"
                    }
                  },
                  "rateLimit": {
                    "summary": "Rate limit",
                    "value": {
                      "statusCode": 429,
                      "message": "ThrottlerException: Too Many Requests"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The source failed or didn't answer. The charge was refunded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "ntsa-unavailable-502-refunded-2": {
                    "summary": "NTSA unavailable (502, refunded)",
                    "value": {
                      "statusCode": 502,
                      "code": "PROVIDER_UNAVAILABLE",
                      "message": "NTSA is unavailable (sandbox simulation)",
                      "retryable": true,
                      "requestId": "cmhd2k7q80001s60h3x9f2a1b"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/vehicle.registration": {
      "post": {
        "tags": [
          "Vehicles"
        ],
        "operationId": "verify_vehicle_registration",
        "summary": "Vehicle registration search (NTSA via Pesaflow)",
        "description": "Returns the NTSA record for a number plate: make, model, year, body, colour, chassis and engine numbers, registration status, owner names and any caveats. Pass `ownerIdNumber` to check whether that person is a registered owner (`checks.isOwner`); owner ID numbers are never returned.\n\n**Price:** set by your bundle; one charge per call. \"Not found\" answers (`result.found: false`) are charged. Source failures return `502` and are refunded.\n\n**Try it:** press **Test** on the request panel, choose **ApiKey** under Authentication and paste your test key (kept for this browser session). **Use Example** loads a scenario for each outcome. Test keys return sandbox sample data, free.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes retries safe: a repeat with the same key and body returns the original verification without charging again. Up to 255 characters.",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "example": "6f1c2a90-order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "registrationNumber": {
                    "description": "Number plate; spaces and case don't matter.",
                    "example": "KDA 123A",
                    "type": "string"
                  },
                  "ownerIdNumber": {
                    "description": "National ID to check against the registered owners (`checks.isOwner`). Never returned.",
                    "example": "12345678",
                    "type": "string",
                    "pattern": "^\\d{6,10}$"
                  }
                },
                "required": [
                  "registrationNumber"
                ]
              },
              "examples": {
                "match-0": {
                  "summary": "Match",
                  "value": {
                    "registrationNumber": "KDA 123A",
                    "ownerIdNumber": "12345678"
                  }
                },
                "not-a-registered-owner-checks-isowner-fa-1": {
                  "summary": "Not a registered owner (`checks.isOwner: false`)",
                  "value": {
                    "registrationNumber": "KDA 123A",
                    "ownerIdNumber": "87654321"
                  }
                },
                "no-such-vehicle-2": {
                  "summary": "No such vehicle",
                  "value": {
                    "registrationNumber": "KZZ 000Z"
                  }
                },
                "ntsa-unavailable-502-refunded-3": {
                  "summary": "NTSA unavailable (502, refunded)",
                  "value": {
                    "registrationNumber": "KZZ 999Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification completed; see `result`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "match-0": {
                    "summary": "Match",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "vehicle.registration",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "vehicle": {
                          "registrationNumber": "KDA123A",
                          "make": "TOYOTA",
                          "model": "FIELDER",
                          "yearOfManufacture": 2015,
                          "bodyType": "STATION WAGON",
                          "color": "SILVER",
                          "fuelType": "PETROL",
                          "chassisNumber": "NZE161-0123456",
                          "engineNumber": "1NZ-1234567",
                          "registrationStatus": "REGISTERED",
                          "registrationDate": "2019-03-04"
                        },
                        "owners": [
                          {
                            "name": "JANE WANJIKU DOE",
                            "type": "INDIVIDUAL"
                          }
                        ],
                        "caveats": [],
                        "hasCaveats": false,
                        "checks": {
                          "isOwner": true
                        }
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  },
                  "not-a-registered-owner-checks-isowner-fa-1": {
                    "summary": "Not a registered owner (`checks.isOwner: false`)",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "vehicle.registration",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "vehicle": {
                          "registrationNumber": "KDA123A",
                          "make": "TOYOTA",
                          "model": "FIELDER",
                          "yearOfManufacture": 2015,
                          "bodyType": "STATION WAGON",
                          "color": "SILVER",
                          "fuelType": "PETROL",
                          "chassisNumber": "NZE161-0123456",
                          "engineNumber": "1NZ-1234567",
                          "registrationStatus": "REGISTERED",
                          "registrationDate": "2019-03-04"
                        },
                        "owners": [
                          {
                            "name": "JANE WANJIKU DOE",
                            "type": "INDIVIDUAL"
                          }
                        ],
                        "caveats": [],
                        "hasCaveats": false,
                        "checks": {
                          "isOwner": false
                        }
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  },
                  "no-such-vehicle-2": {
                    "summary": "No such vehicle",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "vehicle.registration",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": false,
                        "registrationNumber": "KZZ000Z",
                        "reason": null
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The input failed validation; `issues` lists each problem.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "summary": "Missing or invalid fields",
                    "value": {
                      "statusCode": 400,
                      "message": "Validation failed",
                      "issues": [
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "registrationNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The wallet can't cover this call (live keys only). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficientFunds": {
                    "summary": "Insufficient funds",
                    "value": {
                      "statusCode": 402,
                      "code": "INSUFFICIENT_FUNDS",
                      "message": "Insufficient wallet balance"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This API isn't in your organization's bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notInPlan": {
                    "summary": "API not in your bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "API_NOT_IN_PLAN",
                      "message": "Your plan does not include identity.national-id"
                    }
                  },
                  "noSubscription": {
                    "summary": "No active bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "NO_ACTIVE_SUBSCRIPTION",
                      "message": "No active subscription"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was used for a different request, or that request is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "reused": {
                    "summary": "Key reused with a different body",
                    "value": {
                      "statusCode": 409,
                      "message": "Idempotency-Key was already used for a different request"
                    }
                  },
                  "inProgress": {
                    "summary": "First attempt still running",
                    "value": {
                      "statusCode": 409,
                      "message": "A request with this Idempotency-Key is still in progress"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Monthly quota reached, or more than 120 requests a minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "summary": "Monthly quota reached",
                    "value": {
                      "statusCode": 429,
                      "code": "QUOTA_EXCEEDED",
                      "message": "Monthly quota of 1000 calls reached"
                    }
                  },
                  "rateLimit": {
                    "summary": "Rate limit",
                    "value": {
                      "statusCode": 429,
                      "message": "ThrottlerException: Too Many Requests"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The source failed or didn't answer. The charge was refunded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "ntsa-unavailable-502-refunded-3": {
                    "summary": "NTSA unavailable (502, refunded)",
                    "value": {
                      "statusCode": 502,
                      "code": "PROVIDER_UNAVAILABLE",
                      "message": "PESAFLOW is unavailable (sandbox simulation)",
                      "retryable": true,
                      "requestId": "cmhd2k7q80001s60h3x9f2a1b"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/tax.kra-pin": {
      "post": {
        "tags": [
          "Tax"
        ],
        "operationId": "verify_tax_kra_pin",
        "summary": "KRA PIN by ID number (KRA)",
        "description": "Returns the KRA PIN registered to a Kenyan national ID number and the taxpayer name on it.\n\n**Price:** set by your bundle; one charge per call. \"Not found\" answers (`result.found: false`) are charged. Source failures return `502` and are refunded.\n\n**Try it:** press **Test** on the request panel, choose **ApiKey** under Authentication and paste your test key (kept for this browser session). **Use Example** loads a scenario for each outcome. Test keys return sandbox sample data, free.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes retries safe: a repeat with the same key and body returns the original verification without charging again. Up to 255 characters.",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "example": "6f1c2a90-order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "idNumber": {
                    "type": "string",
                    "pattern": "^\\d{6,10}$",
                    "description": "National ID number of the taxpayer.",
                    "example": "12345678"
                  }
                },
                "required": [
                  "idNumber"
                ]
              },
              "examples": {
                "match-0": {
                  "summary": "Match",
                  "value": {
                    "idNumber": "12345678"
                  }
                },
                "no-pin-for-this-id-1": {
                  "summary": "No PIN for this ID",
                  "value": {
                    "idNumber": "00000000"
                  }
                },
                "kra-unavailable-502-refunded-2": {
                  "summary": "KRA unavailable (502, refunded)",
                  "value": {
                    "idNumber": "99999999"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification completed; see `result`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "match-0": {
                    "summary": "Match",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "tax.kra-pin",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "idNumber": "12345678",
                        "taxpayer": {
                          "pin": "A000000000S",
                          "name": "JANE WANJIKU DOE"
                        }
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  },
                  "no-pin-for-this-id-1": {
                    "summary": "No PIN for this ID",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "tax.kra-pin",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": false,
                        "idNumber": "00000000"
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The input failed validation; `issues` lists each problem.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "summary": "Missing or invalid fields",
                    "value": {
                      "statusCode": 400,
                      "message": "Validation failed",
                      "issues": [
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "idNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The wallet can't cover this call (live keys only). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficientFunds": {
                    "summary": "Insufficient funds",
                    "value": {
                      "statusCode": 402,
                      "code": "INSUFFICIENT_FUNDS",
                      "message": "Insufficient wallet balance"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This API isn't in your organization's bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notInPlan": {
                    "summary": "API not in your bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "API_NOT_IN_PLAN",
                      "message": "Your plan does not include identity.national-id"
                    }
                  },
                  "noSubscription": {
                    "summary": "No active bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "NO_ACTIVE_SUBSCRIPTION",
                      "message": "No active subscription"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was used for a different request, or that request is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "reused": {
                    "summary": "Key reused with a different body",
                    "value": {
                      "statusCode": 409,
                      "message": "Idempotency-Key was already used for a different request"
                    }
                  },
                  "inProgress": {
                    "summary": "First attempt still running",
                    "value": {
                      "statusCode": 409,
                      "message": "A request with this Idempotency-Key is still in progress"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Monthly quota reached, or more than 120 requests a minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "summary": "Monthly quota reached",
                    "value": {
                      "statusCode": 429,
                      "code": "QUOTA_EXCEEDED",
                      "message": "Monthly quota of 1000 calls reached"
                    }
                  },
                  "rateLimit": {
                    "summary": "Rate limit",
                    "value": {
                      "statusCode": 429,
                      "message": "ThrottlerException: Too Many Requests"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The source failed or didn't answer. The charge was refunded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "kra-unavailable-502-refunded-2": {
                    "summary": "KRA unavailable (502, refunded)",
                    "value": {
                      "statusCode": 502,
                      "code": "PROVIDER_UNAVAILABLE",
                      "message": "KRA is unavailable (sandbox simulation)",
                      "retryable": true,
                      "requestId": "cmhd2k7q80001s60h3x9f2a1b"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/business.registration": {
      "post": {
        "tags": [
          "Businesses"
        ],
        "operationId": "verify_business_registration",
        "summary": "Business registration search (BRS via Pesaflow)",
        "description": "Returns the Business Registration Service record: name, status, registration date, KRA PIN, addresses and partners/directors.\n\n**Price:** set by your bundle; one charge per call. \"Not found\" answers (`result.found: false`) are charged. Source failures return `502` and are refunded.\n\n**Try it:** press **Test** on the request panel, choose **ApiKey** under Authentication and paste your test key (kept for this browser session). **Use Example** loads a scenario for each outcome. Test keys return sandbox sample data, free.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes retries safe: a repeat with the same key and body returns the original verification without charging again. Up to 255 characters.",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "example": "6f1c2a90-order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "registrationNumber": {
                    "type": "string",
                    "minLength": 3,
                    "maxLength": 40,
                    "description": "BRS registration number of the company or business name.",
                    "example": "PVT-ABC123"
                  }
                },
                "required": [
                  "registrationNumber"
                ]
              },
              "examples": {
                "match-0": {
                  "summary": "Match",
                  "value": {
                    "registrationNumber": "PVT-ABC123"
                  }
                },
                "no-such-business-1": {
                  "summary": "No such business",
                  "value": {
                    "registrationNumber": "PVT-00000000"
                  }
                },
                "brs-unavailable-502-refunded-2": {
                  "summary": "BRS unavailable (502, refunded)",
                  "value": {
                    "registrationNumber": "PVT-99999999"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification completed; see `result`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "match-0": {
                    "summary": "Match",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "business.registration",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "business": {
                          "registrationNumber": "PVT-ABC123",
                          "name": "SANDBOX TRADERS LIMITED",
                          "status": "Registered",
                          "registered": true,
                          "kraPin": "P000000000Z",
                          "registrationDate": "2018-06-01",
                          "physicalAddress": "NAIROBI",
                          "postalAddress": "P.O. BOX 1-00100",
                          "partners": [
                            {
                              "name": "JANE WANJIKU DOE",
                              "shares": 1000
                            }
                          ]
                        }
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  },
                  "no-such-business-1": {
                    "summary": "No such business",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "business.registration",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": false,
                        "registrationNumber": "PVT-00000000"
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The input failed validation; `issues` lists each problem.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "summary": "Missing or invalid fields",
                    "value": {
                      "statusCode": 400,
                      "message": "Validation failed",
                      "issues": [
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "registrationNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The wallet can't cover this call (live keys only). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficientFunds": {
                    "summary": "Insufficient funds",
                    "value": {
                      "statusCode": 402,
                      "code": "INSUFFICIENT_FUNDS",
                      "message": "Insufficient wallet balance"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This API isn't in your organization's bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notInPlan": {
                    "summary": "API not in your bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "API_NOT_IN_PLAN",
                      "message": "Your plan does not include identity.national-id"
                    }
                  },
                  "noSubscription": {
                    "summary": "No active bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "NO_ACTIVE_SUBSCRIPTION",
                      "message": "No active subscription"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was used for a different request, or that request is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "reused": {
                    "summary": "Key reused with a different body",
                    "value": {
                      "statusCode": 409,
                      "message": "Idempotency-Key was already used for a different request"
                    }
                  },
                  "inProgress": {
                    "summary": "First attempt still running",
                    "value": {
                      "statusCode": 409,
                      "message": "A request with this Idempotency-Key is still in progress"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Monthly quota reached, or more than 120 requests a minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "summary": "Monthly quota reached",
                    "value": {
                      "statusCode": 429,
                      "code": "QUOTA_EXCEEDED",
                      "message": "Monthly quota of 1000 calls reached"
                    }
                  },
                  "rateLimit": {
                    "summary": "Rate limit",
                    "value": {
                      "statusCode": 429,
                      "message": "ThrottlerException: Too Many Requests"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The source failed or didn't answer. The charge was refunded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "brs-unavailable-502-refunded-2": {
                    "summary": "BRS unavailable (502, refunded)",
                    "value": {
                      "statusCode": 502,
                      "code": "PROVIDER_UNAVAILABLE",
                      "message": "PESAFLOW is unavailable (sandbox simulation)",
                      "retryable": true,
                      "requestId": "cmhd2k7q80001s60h3x9f2a1b"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/phone.ownership": {
      "post": {
        "tags": [
          "Phone numbers"
        ],
        "operationId": "verify_phone_ownership",
        "summary": "Phone number ownership (Safaricom)",
        "description": "Checks with Safaricom whether a Safaricom mobile number is registered to the holder of the given ID. Safaricom answers only yes or no (`matched`); no subscriber details are returned. Numbers on other networks, or ported away from Safaricom, can't be checked.\n\n**Price:** set by your bundle; one charge per call. \"Not found\" answers (`result.found: false`) are charged. Source failures return `502` and are refunded.\n\n**Try it:** press **Test** on the request panel, choose **ApiKey** under Authentication and paste your test key (kept for this browser session). **Use Example** loads a scenario for each outcome. Test keys return sandbox sample data, free.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes retries safe: a repeat with the same key and body returns the original verification without charging again. Up to 255 characters.",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "example": "6f1c2a90-order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phoneNumber": {
                    "description": "Safaricom mobile number, in any common form: `0712345678`, `254712345678` or `+254 712 345 678`.",
                    "example": "0712345678",
                    "type": "string"
                  },
                  "idType": {
                    "default": "NATIONAL_ID",
                    "description": "Kind of document `idNumber` belongs to.",
                    "type": "string",
                    "enum": [
                      "NATIONAL_ID",
                      "MILITARY_ID",
                      "PASSPORT"
                    ]
                  },
                  "idNumber": {
                    "type": "string",
                    "pattern": "^[A-Z0-9]{4,20}$",
                    "description": "The ID the number should be registered to.",
                    "example": "12345678"
                  }
                },
                "required": [
                  "phoneNumber",
                  "idNumber"
                ]
              },
              "examples": {
                "match-0": {
                  "summary": "Match",
                  "value": {
                    "phoneNumber": "0712345678",
                    "idNumber": "12345678"
                  }
                },
                "registered-to-someone-else-matched-false-1": {
                  "summary": "Registered to someone else (`matched: false`; any ID ending in 1)",
                  "value": {
                    "phoneNumber": "0712345678",
                    "idNumber": "12345671"
                  }
                },
                "safaricom-unavailable-502-refunded-2": {
                  "summary": "Safaricom unavailable (502, refunded)",
                  "value": {
                    "phoneNumber": "0799999999",
                    "idNumber": "12345678"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification completed; see `result`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "match-0": {
                    "summary": "Match",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "phone.ownership",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "phoneNumberEndsWith": "678",
                        "idType": "NATIONAL_ID",
                        "matched": true
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  },
                  "registered-to-someone-else-matched-false-1": {
                    "summary": "Registered to someone else (`matched: false`; any ID ending in 1)",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "phone.ownership",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "phoneNumberEndsWith": "678",
                        "idType": "NATIONAL_ID",
                        "matched": false
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The input failed validation; `issues` lists each problem.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "summary": "Missing or invalid fields",
                    "value": {
                      "statusCode": 400,
                      "message": "Validation failed",
                      "issues": [
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "phoneNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        },
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "idNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The wallet can't cover this call (live keys only). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficientFunds": {
                    "summary": "Insufficient funds",
                    "value": {
                      "statusCode": 402,
                      "code": "INSUFFICIENT_FUNDS",
                      "message": "Insufficient wallet balance"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This API isn't in your organization's bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notInPlan": {
                    "summary": "API not in your bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "API_NOT_IN_PLAN",
                      "message": "Your plan does not include identity.national-id"
                    }
                  },
                  "noSubscription": {
                    "summary": "No active bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "NO_ACTIVE_SUBSCRIPTION",
                      "message": "No active subscription"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was used for a different request, or that request is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "reused": {
                    "summary": "Key reused with a different body",
                    "value": {
                      "statusCode": 409,
                      "message": "Idempotency-Key was already used for a different request"
                    }
                  },
                  "inProgress": {
                    "summary": "First attempt still running",
                    "value": {
                      "statusCode": 409,
                      "message": "A request with this Idempotency-Key is still in progress"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Monthly quota reached, or more than 120 requests a minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "summary": "Monthly quota reached",
                    "value": {
                      "statusCode": 429,
                      "code": "QUOTA_EXCEEDED",
                      "message": "Monthly quota of 1000 calls reached"
                    }
                  },
                  "rateLimit": {
                    "summary": "Rate limit",
                    "value": {
                      "statusCode": 429,
                      "message": "ThrottlerException: Too Many Requests"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The source failed or didn't answer. The charge was refunded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "safaricom-unavailable-502-refunded-2": {
                    "summary": "Safaricom unavailable (502, refunded)",
                    "value": {
                      "statusCode": 502,
                      "code": "PROVIDER_UNAVAILABLE",
                      "message": "SAFARICOM is unavailable (sandbox simulation)",
                      "retryable": true,
                      "requestId": "cmhd2k7q80001s60h3x9f2a1b"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/phone.sim-swap": {
      "post": {
        "tags": [
          "Phone numbers"
        ],
        "operationId": "verify_phone_sim_swap",
        "summary": "Last SIM swap (Safaricom)",
        "description": "When the SIM behind a Safaricom number was last swapped. Safaricom only looks back about three months: `lastSwapDate` is null when there was no swap in that window. `daysSinceSwap` helps flag recent swaps, a common sign of account takeover.\n\n**Price:** set by your bundle; one charge per call. \"Not found\" answers (`result.found: false`) are charged. Source failures return `502` and are refunded.\n\n**Try it:** press **Test** on the request panel, choose **ApiKey** under Authentication and paste your test key (kept for this browser session). **Use Example** loads a scenario for each outcome. Test keys return sandbox sample data, free.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes retries safe: a repeat with the same key and body returns the original verification without charging again. Up to 255 characters.",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "example": "6f1c2a90-order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phoneNumber": {
                    "description": "Safaricom mobile number, in any common form: `0712345678`, `254712345678` or `+254 712 345 678`.",
                    "example": "0712345678",
                    "type": "string"
                  }
                },
                "required": [
                  "phoneNumber"
                ]
              },
              "examples": {
                "match-0": {
                  "summary": "Match",
                  "value": {
                    "phoneNumber": "0712345678"
                  }
                },
                "safaricom-unavailable-502-refunded-1": {
                  "summary": "Safaricom unavailable (502, refunded)",
                  "value": {
                    "phoneNumber": "0799999999"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification completed; see `result`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "match-0": {
                    "summary": "Match",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "phone.sim-swap",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "phoneNumberEndsWith": "678",
                        "lastSwapDate": "2026-11-12",
                        "daysSinceSwap": 12
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The input failed validation; `issues` lists each problem.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "summary": "Missing or invalid fields",
                    "value": {
                      "statusCode": 400,
                      "message": "Validation failed",
                      "issues": [
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "phoneNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The wallet can't cover this call (live keys only). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficientFunds": {
                    "summary": "Insufficient funds",
                    "value": {
                      "statusCode": 402,
                      "code": "INSUFFICIENT_FUNDS",
                      "message": "Insufficient wallet balance"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This API isn't in your organization's bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notInPlan": {
                    "summary": "API not in your bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "API_NOT_IN_PLAN",
                      "message": "Your plan does not include identity.national-id"
                    }
                  },
                  "noSubscription": {
                    "summary": "No active bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "NO_ACTIVE_SUBSCRIPTION",
                      "message": "No active subscription"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was used for a different request, or that request is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "reused": {
                    "summary": "Key reused with a different body",
                    "value": {
                      "statusCode": 409,
                      "message": "Idempotency-Key was already used for a different request"
                    }
                  },
                  "inProgress": {
                    "summary": "First attempt still running",
                    "value": {
                      "statusCode": 409,
                      "message": "A request with this Idempotency-Key is still in progress"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Monthly quota reached, or more than 120 requests a minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "summary": "Monthly quota reached",
                    "value": {
                      "statusCode": 429,
                      "code": "QUOTA_EXCEEDED",
                      "message": "Monthly quota of 1000 calls reached"
                    }
                  },
                  "rateLimit": {
                    "summary": "Rate limit",
                    "value": {
                      "statusCode": 429,
                      "message": "ThrottlerException: Too Many Requests"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The source failed or didn't answer. The charge was refunded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "safaricom-unavailable-502-refunded-1": {
                    "summary": "Safaricom unavailable (502, refunded)",
                    "value": {
                      "statusCode": 502,
                      "code": "PROVIDER_UNAVAILABLE",
                      "message": "SAFARICOM is unavailable (sandbox simulation)",
                      "retryable": true,
                      "requestId": "cmhd2k7q80001s60h3x9f2a1b"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/phone.age-on-network": {
      "post": {
        "tags": [
          "Phone numbers"
        ],
        "operationId": "verify_phone_age_on_network",
        "summary": "Age on network (Safaricom)",
        "description": "When a Safaricom number was registered on the network. Safaricom only looks back so far: `registeredOn` is null (`olderThanLookback: true`) for numbers registered before that. A very new number is a common fraud signal.\n\n**Price:** set by your bundle; one charge per call. \"Not found\" answers (`result.found: false`) are charged. Source failures return `502` and are refunded.\n\n**Try it:** press **Test** on the request panel, choose **ApiKey** under Authentication and paste your test key (kept for this browser session). **Use Example** loads a scenario for each outcome. Test keys return sandbox sample data, free.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes retries safe: a repeat with the same key and body returns the original verification without charging again. Up to 255 characters.",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "example": "6f1c2a90-order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "phoneNumber": {
                    "description": "Safaricom mobile number, in any common form: `0712345678`, `254712345678` or `+254 712 345 678`.",
                    "example": "0712345678",
                    "type": "string"
                  }
                },
                "required": [
                  "phoneNumber"
                ]
              },
              "examples": {
                "match-0": {
                  "summary": "Match",
                  "value": {
                    "phoneNumber": "0712345678"
                  }
                },
                "safaricom-unavailable-502-refunded-1": {
                  "summary": "Safaricom unavailable (502, refunded)",
                  "value": {
                    "phoneNumber": "0799999999"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification completed; see `result`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "match-0": {
                    "summary": "Match",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "phone.age-on-network",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "phoneNumberEndsWith": "678",
                        "registeredOn": "2016-08-20",
                        "olderThanLookback": false
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The input failed validation; `issues` lists each problem.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "summary": "Missing or invalid fields",
                    "value": {
                      "statusCode": 400,
                      "message": "Validation failed",
                      "issues": [
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "phoneNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The wallet can't cover this call (live keys only). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficientFunds": {
                    "summary": "Insufficient funds",
                    "value": {
                      "statusCode": 402,
                      "code": "INSUFFICIENT_FUNDS",
                      "message": "Insufficient wallet balance"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This API isn't in your organization's bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notInPlan": {
                    "summary": "API not in your bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "API_NOT_IN_PLAN",
                      "message": "Your plan does not include identity.national-id"
                    }
                  },
                  "noSubscription": {
                    "summary": "No active bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "NO_ACTIVE_SUBSCRIPTION",
                      "message": "No active subscription"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was used for a different request, or that request is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "reused": {
                    "summary": "Key reused with a different body",
                    "value": {
                      "statusCode": 409,
                      "message": "Idempotency-Key was already used for a different request"
                    }
                  },
                  "inProgress": {
                    "summary": "First attempt still running",
                    "value": {
                      "statusCode": 409,
                      "message": "A request with this Idempotency-Key is still in progress"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Monthly quota reached, or more than 120 requests a minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "summary": "Monthly quota reached",
                    "value": {
                      "statusCode": 429,
                      "code": "QUOTA_EXCEEDED",
                      "message": "Monthly quota of 1000 calls reached"
                    }
                  },
                  "rateLimit": {
                    "summary": "Rate limit",
                    "value": {
                      "statusCode": 429,
                      "message": "ThrottlerException: Too Many Requests"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The source failed or didn't answer. The charge was refunded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "safaricom-unavailable-502-refunded-1": {
                    "summary": "Safaricom unavailable (502, refunded)",
                    "value": {
                      "statusCode": 502,
                      "code": "PROVIDER_UNAVAILABLE",
                      "message": "SAFARICOM is unavailable (sandbox simulation)",
                      "retryable": true,
                      "requestId": "cmhd2k7q80001s60h3x9f2a1b"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/verifications/background.police-clearance": {
      "post": {
        "tags": [
          "Background checks"
        ],
        "operationId": "verify_background_police_clearance",
        "summary": "Police clearance certificate (DCI)",
        "description": "Verifies a DCI police clearance (certificate of good conduct) against the DCI portal, using its reference number and the holder's ID number. Returns the verdict, holder name, issue and expiry dates (valid one year from issue) and any recorded offences. `found: false` with `reason` CERTIFICATE_NOT_FOUND or ID_MISMATCH is DCI's own answer. Checks can take up to a minute.\n\n**Price:** set by your bundle; one charge per call. \"Not found\" answers (`result.found: false`) are charged. Source failures return `502` and are refunded.\n\n**Try it:** press **Test** on the request panel, choose **ApiKey** under Authentication and paste your test key (kept for this browser session). **Use Example** loads a scenario for each outcome. Test keys return sandbox sample data, free.",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Makes retries safe: a repeat with the same key and body returns the original verification without charging again. Up to 255 characters.",
            "schema": {
              "type": "string",
              "maxLength": 255
            },
            "example": "6f1c2a90-order-1042"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "refNumber": {
                    "type": "string",
                    "pattern": "^PCC-[A-Z0-9]{6,12}$",
                    "description": "Reference number printed on the certificate.",
                    "example": "PCC-6QSLJEYKG"
                  },
                  "idNumber": {
                    "type": "string",
                    "pattern": "^\\d{6,10}$",
                    "description": "National ID number of the certificate holder.",
                    "example": "12345678"
                  }
                },
                "required": [
                  "refNumber",
                  "idNumber"
                ]
              },
              "examples": {
                "match-0": {
                  "summary": "Match",
                  "value": {
                    "refNumber": "PCC-6QSLJEYKG",
                    "idNumber": "12345678"
                  }
                },
                "certificate-not-found-1": {
                  "summary": "Certificate not found",
                  "value": {
                    "refNumber": "PCC-6QSLJEYKG",
                    "idNumber": "00000000"
                  }
                },
                "dci-portal-unavailable-502-refunded-2": {
                  "summary": "DCI portal unavailable (502, refunded)",
                  "value": {
                    "refNumber": "PCC-6QSLJEYKG",
                    "idNumber": "99999999"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verification completed; see `result`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Verification"
                },
                "examples": {
                  "match-0": {
                    "summary": "Match",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "background.police-clearance",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": true,
                        "refNumber": "PCC-6QSLJEYKG",
                        "certificate": {
                          "verdict": "VALID",
                          "valid": true,
                          "holderName": "JANE WANJIKU DOE",
                          "issuedOn": "2026-02-10, 09:14:03",
                          "expiresOn": "2027-02-10",
                          "status": "Approved",
                          "offencesRecorded": false,
                          "offenceCount": "NIL",
                          "offences": []
                        }
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  },
                  "certificate-not-found-1": {
                    "summary": "Certificate not found",
                    "value": {
                      "id": "cmhd2k7q80001s60h3x9f2a1b",
                      "api": "background.police-clearance",
                      "status": "COMPLETED",
                      "environment": "LIVE",
                      "result": {
                        "found": false,
                        "refNumber": "PCC-6QSLJEYKG",
                        "reason": null
                      },
                      "error": null,
                      "cost": "50",
                      "latencyMs": 412,
                      "createdAt": "2026-10-30T09:15:02.118Z",
                      "completedAt": "2026-10-30T09:15:02.530Z"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The input failed validation; `issues` lists each problem.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalid": {
                    "summary": "Missing or invalid fields",
                    "value": {
                      "statusCode": 400,
                      "message": "Validation failed",
                      "issues": [
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "refNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        },
                        {
                          "expected": "string",
                          "code": "invalid_type",
                          "path": [
                            "idNumber"
                          ],
                          "message": "Invalid input: expected string, received undefined"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing, unknown or revoked API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "unauthorized": {
                    "summary": "Invalid key",
                    "value": {
                      "statusCode": 401,
                      "message": "Invalid API key"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "The wallet can't cover this call (live keys only). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "insufficientFunds": {
                    "summary": "Insufficient funds",
                    "value": {
                      "statusCode": 402,
                      "code": "INSUFFICIENT_FUNDS",
                      "message": "Insufficient wallet balance"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "This API isn't in your organization's bundle.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "notInPlan": {
                    "summary": "API not in your bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "API_NOT_IN_PLAN",
                      "message": "Your plan does not include identity.national-id"
                    }
                  },
                  "noSubscription": {
                    "summary": "No active bundle",
                    "value": {
                      "statusCode": 403,
                      "code": "NO_ACTIVE_SUBSCRIPTION",
                      "message": "No active subscription"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The `Idempotency-Key` was used for a different request, or that request is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "reused": {
                    "summary": "Key reused with a different body",
                    "value": {
                      "statusCode": 409,
                      "message": "Idempotency-Key was already used for a different request"
                    }
                  },
                  "inProgress": {
                    "summary": "First attempt still running",
                    "value": {
                      "statusCode": 409,
                      "message": "A request with this Idempotency-Key is still in progress"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Monthly quota reached, or more than 120 requests a minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "quota": {
                    "summary": "Monthly quota reached",
                    "value": {
                      "statusCode": 429,
                      "code": "QUOTA_EXCEEDED",
                      "message": "Monthly quota of 1000 calls reached"
                    }
                  },
                  "rateLimit": {
                    "summary": "Rate limit",
                    "value": {
                      "statusCode": 429,
                      "message": "ThrottlerException: Too Many Requests"
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "The source failed or didn't answer. The charge was refunded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "dci-portal-unavailable-502-refunded-2": {
                    "summary": "DCI portal unavailable (502, refunded)",
                    "value": {
                      "statusCode": 502,
                      "code": "PROVIDER_UNAVAILABLE",
                      "message": "DCI is unavailable (sandbox simulation)",
                      "retryable": true,
                      "requestId": "cmhd2k7q80001s60h3x9f2a1b"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your API key. `sk_test_…` keys use the sandbox (sample data, free); `sk_live_…` keys query the real sources and are charged."
      }
    },
    "schemas": {
      "Verification": {
        "type": "object",
        "description": "One verification. Returned by every verification API, by `GET /v1/verifications/{id}`, and in webhooks.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique id; use it to fetch the verification again."
          },
          "api": {
            "type": "string",
            "description": "The verification API that was called, e.g. `identity.national-id`."
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "COMPLETED",
              "FAILED"
            ],
            "description": "`COMPLETED` includes \"not found\" answers; `FAILED` means the source failed and the charge was refunded."
          },
          "environment": {
            "type": "string",
            "enum": [
              "LIVE",
              "TEST"
            ],
            "description": "`TEST` for test keys (sandbox data), `LIVE` for live keys."
          },
          "result": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true,
            "description": "The answer, specific to each API (see its examples). Always has `found`: `false` when the source holds no record."
          },
          "error": {
            "type": "object",
            "nullable": true,
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "description": "Set when `status` is `FAILED`."
          },
          "cost": {
            "type": "string",
            "description": "Amount charged in KES, as a decimal string. `\"0\"` for test keys and failed verifications."
          },
          "latencyMs": {
            "type": "integer",
            "nullable": true,
            "description": "Time the source took to answer, in milliseconds."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "completedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "api",
          "status",
          "environment",
          "result",
          "error",
          "cost",
          "createdAt"
        ]
      },
      "VerificationPage": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Verification"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true,
            "description": "Pass as `cursor` for the next page; `null` on the last page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "VerificationSummary": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "type": "string",
            "format": "date-time"
          },
          "environment": {
            "type": "string",
            "enum": [
              "LIVE",
              "TEST"
            ]
          },
          "calls": {
            "type": "integer",
            "description": "All verifications in the period."
          },
          "completed": {
            "type": "integer"
          },
          "successRate": {
            "type": "number",
            "nullable": true,
            "description": "Completed share of finished verifications, from 0 to 1."
          },
          "totalCost": {
            "type": "string",
            "description": "Total charged in KES."
          },
          "byApi": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "apiCode": {
                  "type": "string"
                },
                "calls": {
                  "type": "integer"
                },
                "completed": {
                  "type": "integer"
                },
                "failed": {
                  "type": "integer"
                },
                "cost": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Wallet": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "organizationId": {
            "type": "string"
          },
          "balance": {
            "type": "string",
            "description": "Available balance, as a decimal string."
          },
          "currency": {
            "type": "string",
            "example": "KES"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Quota": {
        "type": "object",
        "properties": {
          "period": {
            "type": "string",
            "description": "The calendar month, `YYYY-MM`."
          },
          "calls": {
            "type": "integer",
            "description": "Verifications made this month."
          },
          "quota": {
            "type": "integer",
            "nullable": true,
            "description": "Your bundle's monthly limit; `null` when unlimited."
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "integer"
          },
          "code": {
            "type": "string",
            "description": "Stable machine-readable code, when there is one."
          },
          "message": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "description": "`502` only: whether retrying later can succeed."
          },
          "requestId": {
            "type": "string",
            "description": "`502` only: the failed verification's id."
          },
          "issues": {
            "type": "array",
            "description": "`400` only: one entry per invalid field.",
            "items": {
              "type": "object",
              "properties": {
                "path": {
                  "type": "array",
                  "items": {},
                  "description": "Where the problem is, e.g. `[\"idNumber\"]`."
                },
                "message": {
                  "type": "string"
                },
                "code": {
                  "type": "string",
                  "description": "The kind of problem, e.g. `invalid_type`, `invalid_format`."
                }
              },
              "additionalProperties": true
            }
          }
        },
        "required": [
          "statusCode",
          "message"
        ]
      }
    }
  }
}