Before you start
You need:
- A Kosmobids API key with the
public-api-userrole and a company scope. - Network access to
https://api.kosmobids.com.
Put the key in an environment variable:
export KOSMOBIDS_API_KEY="kosmobids_live_..."
export KOSMOBIDS_BASE_URL="https://api.kosmobids.com/api/v1"
1. Read the pipeline
curl -s "$KOSMOBIDS_BASE_URL/pipeline?limit=10" \
-H "x-api-key: $KOSMOBIDS_API_KEY" | jq
{
"data": {
"tenders": [
{
"tenderId": "0f8fad5b-d9cb-469f-a165-70867728950e",
"status": "Evaluating",
"title": "Cloud migration and managed services",
"country": "DE",
"value_eur": 1200000,
"submissionDate": "2026-12-01T12:00:00.000Z",
"publishDate": "2026-11-01T09:00:00.000Z"
}
],
"nextCursor": null,
"hasMore": false
},
"error": null
}
If the response is 403 with "Public API keys require a companyId", the key is not company-scoped. Ask your Kosmobids administrator for a company-scoped key.
2. Fetch the tender detail
Take a tenderId from the pipeline and hydrate it:
curl -s "$KOSMOBIDS_BASE_URL/tenders/0f8fad5b-d9cb-469f-a165-70867728950e" \
-H "x-api-key: $KOSMOBIDS_API_KEY" | jq
The tender detail includes CPV codes, estimated value, submission deadline, contracting authority, and the source tender metadata. The source_tender.source_tender_id is the notice-level identifier; see IDs and entities.
3. Run a search
curl -s -X POST "$KOSMOBIDS_BASE_URL/search" \
-H "x-api-key: $KOSMOBIDS_API_KEY" \
-H "content-type: application/json" \
-d '{
"criteria": {
"includeKeywords": ["cloud migration"],
"contractingCountry": ["DE", "AT", "CH"],
"submissionDeadlineAtLeastDays": 14
},
"options": { "type": "mixed" }
}' | jq
Search returns IDs and relevance signals:
{
"data": {
"results": [
{
"id": "0f8fad5b-d9cb-469f-a165-70867728950e",
"score": 0.82,
"rerankingScore": 0.91,
"recommended": true,
"match": true
}
]
},
"error": null
}
Hydrate each id with GET /tenders/:tenderId before making a decision.
4. A typed request helper
The following helper checks the HTTP status and unwraps the envelope:
const BASE_URL = process.env.KOSMOBIDS_BASE_URL!;
const API_KEY = process.env.KOSMOBIDS_API_KEY!;
type ApiEnvelope<T> =
| { data: T; error: null }
| { data: null; error: Array<{ field: string; type: string; message: string }> };
export async function api<T>(path: string, init: RequestInit = {}): Promise<T> {
const response = await fetch(`${BASE_URL}${path}`, {
...init,
headers: {
'x-api-key': API_KEY,
...(init.body ? { 'content-type': 'application/json' } : {}),
...init.headers,
},
});
const text = await response.text();
const body = text ? JSON.parse(text) : null;
if (!response.ok) {
const message = body?.error?.[0]?.message ?? body?.message ?? `HTTP ${response.status}`;
throw new Error(message);
}
return (body as ApiEnvelope<T>).data;
}
Authentication failures use a plain { error, message } body, so the helper falls back to body.message. See Errors and limits.