# /kenyappip/contracts/search

`POST /api/kenyappip/contracts/search`

Price: 20 credits

Search contracts awarded through Kenyan public tenders on tenders.go.ke by keyword, supplier, buyer, tender, contract number, financial year, AGPO group, amount, award and start dates, termination and variation. Returns the contract with its supplier, buyer, the tender it was awarded under, and the termination or variation record where one was filed.

## How to use it

This is the award side of the portal: every row is a signed contract with `amount` in KES and the winning `supplier`, and `tender.id` links back to kenyappip/tenders for the bids it beat. `amount` filters on the exact figure only; there is no range. `awarded` and `started` take a year, a month or a day. Name filters match substrings, so `supplier: "limited"` returns every limited company. `terminated_only` rows carry `termination` (reason, date, amount, completed percent); `amended_only` rows carry `variation` (old and new price, dates and periods) on most rows, null where the buyer only flagged the contract.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `query` (string, nullable) — Words matched against the tender title and reference, contract number, supplier and buyer names (examples: "road", "RASISA"; minLength: 1)
- `supplier` (string, nullable) — Part of the awarded supplier name (examples: "limited"; minLength: 1)
- `supplier_id` (integer, nullable) — Supplier id (examples: 159743; min: 1)
- `buyer` (string, nullable) — Part of the procuring entity name (examples: "Kenya Urban Roads Authority"; minLength: 1)
- `buyer_id` (integer, nullable) — Procuring entity id as returned by kenyappip/buyers/search (examples: 5390; min: 1)
- `tender_id` (integer, nullable) — Tender id the contract was awarded under (min: 1)
- `tender_ref` (string, nullable) — Part of the tender reference number (examples: "NG-CDF"; minLength: 1)
- `contract_number` (string, nullable) — Contract number (examples: "4270131"; minLength: 1)
- `financial_year` (string, nullable) — Kenyan financial year (one of: "2015/2016", "2016/2017", "2018/2019", "2019/2020", "2020/2021", "2021/2022", "2022/2023", "2023/2024", "2024/2025", "2025/2026", "2026/2027")
- `agpo_group` (string, nullable) — AGPO group the award was reserved for (one of: "women", "youth", "people_with_disabilities", "all")
- `amount` (number, nullable) — Exact contract amount in KES (examples: 540000; min: 0)
- `awarded` (string, nullable) — Award year, month or day (examples: "2026", "2026-01", "2026-01-19")
- `started` (string, nullable) — Contract start year, month or day (examples: "2026-02")
- `terminated_only` (boolean) — Keep only contracts that were terminated (default: false)
- `amended_only` (boolean) — Keep only contracts varied after signing (default: false)
- `count` (integer, required) — Max number of contracts to return (min: 1; max: 450)

## Response

### 200 — Successful Response

- `@type` (string) (default: "KenyappipContract")
- `id` (integer, required)
- `contract_number` (string, nullable)
- `amount` (number, nullable)
- `currency` (string) (default: "KES")
- `award_date` (string, nullable)
- `notification_of_award_date` (string, nullable)
- `evaluation_completion_date` (string, nullable)
- `sign_date` (string, nullable)
- `start_date` (string, nullable)
- `end_date` (string, nullable)
- `is_amended` (boolean, nullable)
- `is_terminated` (boolean, nullable)
- `is_published` (boolean, nullable)
- `award_reason_id` (integer, nullable)
- `agpo_group` (string, nullable)
- `agpo_certificate_number` (string, nullable)
- `financial_year` (string, nullable)
- `supplier` (object, nullable)
  - `@type` (string) (default: "KenyappipSupplier")
  - `id` (integer, required)
  - `name` (string, required)
  - `business_registration_number` (string, nullable)
  - `registration_status` (string, nullable)
  - `business_type` (string, nullable)
  - `telephone` (string, nullable)
  - `email` (string, nullable)
  - `physical_address` (string, nullable)
  - `postal_address` (string, nullable)
  - `town` (string, nullable)
  - `county` (string, nullable)
  - `registered_date` (string, nullable)
- `buyer` (object, nullable)
  - `@type` (string) (default: "KenyappipBuyer")
  - `id` (integer, required)
  - `code` (string, nullable)
  - `name` (string, required)
  - `buyer_type` (string, nullable)
  - `county` (string, nullable)
  - `telephone` (string, nullable)
  - `email` (string, nullable)
  - `physical_address` (string, nullable)
  - `postal_address` (string, nullable)
  - `city` (string, nullable)
  - `website` (string, nullable)
  - `status` (string, nullable)
- `tender` (object, nullable)
  - `@type` (string) (default: "KenyappipTenderSummary")
  - `id` (integer, required)
  - `ocid` (string, nullable)
  - `tender_ref` (string, nullable)
  - `status` (string, nullable)
  - `procurement_method` (string, nullable)
  - `procurement_category` (string, nullable)
  - `published_at` (integer, nullable)
  - `closing_at` (integer, nullable)
  - `url` (string, required)
- `termination` (object, nullable)
  - `@type` (string) (default: "KenyappipTermination")
  - `id` (integer, required)
  - `reason` (string, nullable)
  - `termination_date` (string, nullable)
  - `contract_amount` (number, nullable)
  - `currency` (string) (default: "KES")
  - `completed_percent` (number, nullable)
  - `cost_of_termination` (number, nullable)
  - `created_at` (integer, nullable)
- `variation` (object, nullable)
  - `@type` (string) (default: "KenyappipVariation")
  - `id` (integer, required)
  - `variation_type` (string, nullable)
  - `variation_date` (string, nullable)
  - `initial_amount` (number, nullable)
  - `new_amount` (number, nullable)
  - `currency` (string) (default: "KES")
  - `percentage_variance` (number, nullable)
  - `initial_period` (integer, nullable)
  - `new_period` (integer, nullable)
  - `initial_end_date` (string, nullable)
  - `new_end_date` (string, nullable)
  - `submit_status` (string, nullable)
  - `submit_date` (string, nullable)
  - `review_status` (string, nullable)
  - `created_at` (integer, nullable)
- `documents` (array) (default: [])
  - `@type` (string) (default: "KenyappipDocument")
  - `id` (integer, required)
  - `url` (string, required)
  - `document_type` (string, nullable)
  - `document_type_code` (string, nullable)
  - `document_category` (string, nullable)
  - `created_at` (integer, nullable)
- `created_at` (integer, nullable)
- `updated_at` (integer, nullable)

## Errors

### 422 — Validation Error

The request body did not validate

What to do: Check the fields against this schema. A URN with the wrong prefix is the most common cause.

- `detail` (array)
  - `loc` (array, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (object)

### 408

The request ran past its time limit

What to do: Raise `timeout` in the request body, up to the maximum this endpoint documents. Lowering `count` or turning off the `with_*` flags also helps, because less work finishes sooner.

### 412

The entity was not found, or a precondition failed

What to do: Retrying will not help: either the entity does not exist, or the input points at a different one.

### 429

Too many requests: a rate limit or a usage window is exhausted

What to do: When the response carries an X-Retry-After header, wait that many seconds and retry: the same number is in the body as `detail.retry_after`, and the limit clears once that window passes. The message in the body names the limit that was hit.

### 500

Something broke on our side

What to do: Retrying will not help. If it keeps happening, send us the X-Request-ID from the response headers.

### 529

Rate limit reached, or the endpoint is overloaded

What to do: Wait at least 30 seconds, then retry.

## Response envelope

Success: Array of objects (may be empty if no results)

Error: Error may coexist with partial results if it occurs mid-execution. Check X-Error header and status code.

Every response carries these headers:

- `X-Error` — Error message text (present only on error)
- `X-Request-ID` — Unique request identifier
- `X-Execution-Time` — Execution time in seconds
- `X-Result-Count` — How many records the body carries. 0 means an empty result, which is a normal answer and not by itself an error. A non-zero count can come back together with X-Error when the failure happened partway through — read this header and X-Error independently.
- `X-Total-Available-Results` — How many records exist for this query, when the endpoint can say. On a `dry_run` request this is the answer and the body is empty. It saturates: the endpoint's documented maximum means 'at least that many', any smaller number is exact.
- `X-Warning` — Present when the request body carried keys this endpoint does not document. They were ignored, so any filter you meant to apply through them did not apply. Check the spelling against this schema and retry.
- `X-Retry-After` — Seconds to wait before retrying. Present only on 429.

