Company credit scoring APIs
Mock Creditsafe Connect credit reports for catalogue suppliers in UK, Germany, and France, and mock Dun & Bradstreet Direct Commercial Credit Score (CCS) for the US. Paths follow the public vendor docs — not invented shapes.
Base URL for examples: https://mock-server.oscar-int.prc.re
Supplier findings
Each row links a punchout catalogue supplier to a credit finding in data/credit/companies.json.
| Catalogue supplier | Country | Bureau | Identifier |
|---|---|---|---|
| officepro | GB | Creditsafe | GB-0-09876543 |
| wurth | DE | Creditsafe | DE-0-HRB712345 |
| techline | DE | Creditsafe | DE-0-HRB723456 |
| safeguard | DE | Creditsafe | DE-0-HRB734567 |
| printmax | FR | Creditsafe | FR-0-532123456 |
| cleanworks | FR | Creditsafe | FR-0-812345678 |
| workspace | US | D&B CCS | DUNS 362241452 |
Seeded companies: 6 Creditsafe ltd (1 DE non-ltd) · 3 D&B US (incl. sandbox DUNS 804735132).
Creditsafe Connect (GB / DE / FR)
Public docs: Credit and Risk. Auth defaults: CREDITSAFE_USERNAME / CREDITSAFE_PASSWORD → procureai / demo.
| Method | Path | Purpose |
|---|---|---|
POST | /v1/authenticate | Username/password → bearer token |
GET | /v1/companies/searchcriteria?countries=GB | Searchable fields per country |
GET | /v1/companies?countries=GB&name=OfficePro | Company search → connectId |
GET | /v1/companies/schema/GB | Country report schema |
GET | /v1/companies/{connectId} | Full company credit report |
GET | /v1/reportcustomdata/DE | German reason-code values |
GET | /v1/localSolutions/DE/nonLtdCompanies?name=Hans&city=Berlin | DE non-limited company search |
GET | /v1/localSolutions/DE/nonLtdCompanies/{id}?reason=1 | DE non-limited company report |
Authenticate
curl -s -X POST https://mock-server.oscar-int.prc.re/v1/authenticate \
-H 'Content-Type: application/json' \
-d '{"username":"procureai","password":"demo"}'Search (UK example)
TOKEN=$(curl -s -X POST https://mock-server.oscar-int.prc.re/v1/authenticate \
-H 'Content-Type: application/json' \
-d '{"username":"procureai","password":"demo"}' | jq -r .token)
curl -s "https://mock-server.oscar-int.prc.re/v1/companies?countries=GB&name=OfficePro" \
-H "Authorization: Bearer $TOKEN"{
"totalSize": 1,
"companies": [
{
"id": "GB-0-09876543",
"country": "GB",
"regNo": "09876543",
"safeNo": "UK09876543",
"name": "OFFICEPRO SUPPLIES LIMITED",
"status": "Active",
"address": {
"simpleValue": "14 KING STREET, MANCHESTER, M2 6AG",
"street": "KING STREET",
"city": "MANCHESTER",
"postCode": "M2 6AG"
}
}
]
}Credit report (DE — reason code required)
curl -s "https://mock-server.oscar-int.prc.re/v1/companies/DE-0-HRB712345?customData=de_reason_code::1" \ -H "Authorization: Bearer $TOKEN"
France example connectId: FR-0-532123456 (no reason code).
creditRating fields (from live mock report)
| Field | Type | Example |
|---|---|---|
commonValue | string | A |
commonDescription | string | Very low risk |
providerValue | object | {"value":"208","minValue":"100","maxValue":"600"} |
providerDescription | string | Creditsafe Index (lower is better) |
creditLimit | object | {"currency":"EUR","value":"250000"} |
pod | number | 0.2 |
Dun & Bradstreet Direct — CCS (US)
Public docs: Commercial Credit Score (REST). Score range 101–670 (lower = higher delinquency risk). Auth: OAuth2 bearer from POST /oauth/token (OAUTH_CLIENT_ID / OAUTH_CLIENT_SECRET).
Order CCS product
TOKEN=$(curl -s -X POST https://mock-server.oscar-int.prc.re/oauth/token \ -d grant_type=client_credentials \ -d client_id=oci-download-client \ -d client_secret=oci-download-secret | jq -r .access_token) curl -s "https://mock-server.oscar-int.prc.re/V5.0/organizations/362241452/products/PPR_CCS_V9" \ -H "Authorization: Bearer $TOKEN"
Catalogue supplier workspace → DUNS 362241452. Sandbox-style company from D&B docs: DUNS 804735132 (Gorman Manufacturing Company, Inc.).
CommercialCreditScore (from live mock data)
| Field | Type | Example |
|---|---|---|
rawScore | number | 560 |
classScore | string | 2 |
classScoreDescription | string | LOW TO MODERATE RISK |
nationalPercentile | number | 70 |
Creditsafe monitoring
Portfolios, event rules and notification events, keyed on the same effective rating the credit report endpoints serve.
| Method | Path | Purpose |
|---|---|---|
GET | /v1/monitoring/portfolios | List portfolios (Connect paging) |
POST | /v1/monitoring/portfolios | Create a portfolio |
GET | /v1/monitoring/portfolios/{portfolioId} | Get a portfolio |
DELETE | /v1/monitoring/portfolios/{portfolioId} | Remove a portfolio and its events |
GET | /v1/monitoring/portfolios/{portfolioId}/companies | List monitored companies |
POST | /v1/monitoring/portfolios/{portfolioId}/companies | Add a company to the portfolio |
DELETE | /v1/monitoring/portfolios/{portfolioId}/companies/{companyId} | Remove a company |
GET | /v1/monitoring/portfolios/{portfolioId}/companies/{companyId}/notificationEvents | Events for one monitored company |
GET | /v1/monitoring/portfolios/{portfolioId}/eventRules/{countryCode} | Portfolio's rule settings |
PUT | /v1/monitoring/portfolios/{portfolioId}/eventRules/{countryCode} | Activate/deactivate rules |
GET | /v1/monitoring/portfolios/{portfolioId}/notificationEvents | Events for one portfolio |
GET | /v1/monitoring/eventRules/{countryCode} | Global rule catalogue |
GET | /v1/monitoring/notificationEvents | Events across all portfolios |
Event rules
| Rule code | Name | Default active |
|---|---|---|
101 | International Rating | Reduce by {0} Band(s) OR Less than Band {1} | yes |
102 | Credit Limit | Change by {0}% | yes |
105 | Address | no |
Create a portfolio and add a company
CS_TOKEN=$(curl -s -X POST https://mock-server.oscar-int.prc.re/v1/authenticate \
-H 'Content-Type: application/json' \
-d '{"username":"procureai","password":"demo"}' | jq -r .token)
PID=$(curl -s -X POST https://mock-server.oscar-int.prc.re/v1/monitoring/portfolios -H "Authorization: Bearer $CS_TOKEN" \
-H 'Content-Type: application/json' -d '{"name":"Procure Ai suppliers"}' | jq -r .portfolioId)
curl -s -X POST "https://mock-server.oscar-int.prc.re/v1/monitoring/portfolios/$PID/companies" -H "Authorization: Bearer $CS_TOKEN" \
-H 'Content-Type: application/json' -d '{"id":"DE-0-HRB723456","personalReference":"","freeText":"","personalLimit":""}'D&B Direct+ — identity, assessment, monitoring
The Direct+ generation (/v2/token, /v1/match/cleanseMatch, /v1/data/duns/{duns}, /v1/monitoring/registrations/…) is the adapter target. The legacy Direct 2.0 CCS endpoint above stays only for back-compat.
| Method | Path | Purpose |
|---|---|---|
POST | /v2/token | Direct+ token from Basic key:secret |
GET | /v1/match/cleanseMatch?name=…&countryISOAlpha2Code=US | Identity resolution to DUNS with confidence |
GET | /v1/data/duns/{duns}?blockIDs=dnbassessment_L3_v1 | Assessment data block (PD, credit limit) |
GET | /v1/monitoring/registrations | List seeded monitoring registrations |
GET | /v1/monitoring/registrations/{reference} | Get one registration |
POST | /v1/monitoring/registrations/{reference}/duns/{duns} | Enrol a DUNS subject |
DELETE | /v1/monitoring/registrations/{reference}/duns/{duns} | Remove a DUNS subject |
GET | /v1/monitoring/registrations/{reference}/subjects | List enrolled subjects |
GET | /v1/monitoring/registrations/{reference}/pull?maxNotifications=100 | Pull notifications (advances cursor) |
GET | /v1/monitoring/registrations/{reference}/pull/replay?replayStartTimestamp=… | Replay notifications since a timestamp (cursor unaffected) |
cleanseMatch (name + address → DUNS)
DNB_TOKEN=$(curl -s -X POST https://mock-server.oscar-int.prc.re/v2/token \
-H "Authorization: Basic $(echo -n 'oci-download-client:oci-download-secret' | base64)" \
-H 'Content-Type: application/json' -d '{"grant_type":"client_credentials"}' | jq -r .access_token)
curl -s "https://mock-server.oscar-int.prc.re/v1/match/cleanseMatch?name=WorkSpace%20Interiors&countryISOAlpha2Code=US" \
-H "Authorization: Bearer $DNB_TOKEN"A D&B monitoring notification for a band change carries element organization.dnbAssessment.delinquencyScore.classScore.
Scripted rating change & cost units
Mock-only endpoints that move a rating and emit the matching provider-shaped notifications.
| Method | Path | Purpose |
|---|---|---|
GET | /api/scenarios/credit | List presets and current mock state |
POST | /api/scenarios/credit/rating-change | Apply a scripted rating/band change |
POST | /api/scenarios/credit/reset | Reset all credit mock state to fixtures |
Default demo (screen 09): WorkSpace Interiors Inc. class 2 (LOW) → class 4 (HIGH)
curl -s -X POST https://mock-server.oscar-int.prc.re/v1/monitoring/registrations/procureai-credit/duns/362241452 \ -H "Authorization: Bearer $DNB_TOKEN" curl -s -X POST https://mock-server.oscar-int.prc.re/api/scenarios/credit/rating-change -H "Authorization: Bearer $DNB_TOKEN" curl -s "https://mock-server.oscar-int.prc.re/v1/monitoring/registrations/procureai-credit/pull" -H "Authorization: Bearer $DNB_TOKEN"
TechLine (Creditsafe DE) B → D
curl -s -X POST https://mock-server.oscar-int.prc.re/api/scenarios/credit/rating-change -H "Authorization: Bearer $CS_TOKEN" \
-H 'Content-Type: application/json' -d '{"provider":"creditsafe","id":"DE-0-HRB723456","band":"HIGH"}'Presets
| Preset | Provider | Id | Band |
|---|---|---|---|
screen-09 (default) | dnb | 362241452 | HIGH |
techline-downgrade | creditsafe | DE-0-HRB723456 | HIGH |
Cost units (header X-Mock-Cost-Units)
| Call | Units |
|---|---|
creditsafeCompanyReport | 1 |
creditsafeNonLtdReport | 1 |
dnbCcsProduct | 1 |
dnbDataBlock | 1 |
search | 0 |
dnbMatch | 0 |
monitoring | 0 |
Source of truth
- Fixtures:
data/credit/companies.json - Handlers:
src/lib/protocols/creditsafe/,src/lib/protocols/dnb/,src/lib/protocols/credit/ - Runtime state (portfolios, registrations, rating overrides, emitted events) is one versioned document, persisted in Postgres table
credit_mock_statewhenDATABASE_URLis set, otherwise kept in memory until restart. - Field tables above are derived from the same records the handlers return — not hand-maintained copies.