Credit scoring mocks

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 supplierCountryBureauIdentifier
officeproGBCreditsafeGB-0-09876543
wurthDECreditsafeDE-0-HRB712345
techlineDECreditsafeDE-0-HRB723456
safeguardDECreditsafeDE-0-HRB734567
printmaxFRCreditsafeFR-0-532123456
cleanworksFRCreditsafeFR-0-812345678
workspaceUSD&B CCSDUNS 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.

MethodPathPurpose
POST/v1/authenticateUsername/password → bearer token
GET/v1/companies/searchcriteria?countries=GBSearchable fields per country
GET/v1/companies?countries=GB&name=OfficeProCompany search → connectId
GET/v1/companies/schema/GBCountry report schema
GET/v1/companies/{connectId}Full company credit report
GET/v1/reportcustomdata/DEGerman reason-code values
GET/v1/localSolutions/DE/nonLtdCompanies?name=Hans&city=BerlinDE non-limited company search
GET/v1/localSolutions/DE/nonLtdCompanies/{id}?reason=1DE 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)

FieldTypeExample
commonValuestringA
commonDescriptionstringVery low risk
providerValueobject{"value":"208","minValue":"100","maxValue":"600"}
providerDescriptionstringCreditsafe Index (lower is better)
creditLimitobject{"currency":"EUR","value":"250000"}
podnumber0.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)

FieldTypeExample
rawScorenumber560
classScorestring2
classScoreDescriptionstringLOW TO MODERATE RISK
nationalPercentilenumber70

Creditsafe monitoring

Portfolios, event rules and notification events, keyed on the same effective rating the credit report endpoints serve.

MethodPathPurpose
GET/v1/monitoring/portfoliosList portfolios (Connect paging)
POST/v1/monitoring/portfoliosCreate 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}/companiesList monitored companies
POST/v1/monitoring/portfolios/{portfolioId}/companiesAdd a company to the portfolio
DELETE/v1/monitoring/portfolios/{portfolioId}/companies/{companyId}Remove a company
GET/v1/monitoring/portfolios/{portfolioId}/companies/{companyId}/notificationEventsEvents 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}/notificationEventsEvents for one portfolio
GET/v1/monitoring/eventRules/{countryCode}Global rule catalogue
GET/v1/monitoring/notificationEventsEvents across all portfolios

Event rules

Rule codeNameDefault active
101International Rating | Reduce by {0} Band(s) OR Less than Band {1}yes
102Credit Limit | Change by {0}%yes
105Addressno

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.

MethodPathPurpose
POST/v2/tokenDirect+ token from Basic key:secret
GET/v1/match/cleanseMatch?name=…&countryISOAlpha2Code=USIdentity resolution to DUNS with confidence
GET/v1/data/duns/{duns}?blockIDs=dnbassessment_L3_v1Assessment data block (PD, credit limit)
GET/v1/monitoring/registrationsList 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}/subjectsList enrolled subjects
GET/v1/monitoring/registrations/{reference}/pull?maxNotifications=100Pull 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.

MethodPathPurpose
GET/api/scenarios/creditList presets and current mock state
POST/api/scenarios/credit/rating-changeApply a scripted rating/band change
POST/api/scenarios/credit/resetReset 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

PresetProviderIdBand
screen-09 (default)dnb362241452HIGH
techline-downgradecreditsafeDE-0-HRB723456HIGH

Cost units (header X-Mock-Cost-Units)

CallUnits
creditsafeCompanyReport1
creditsafeNonLtdReport1
dnbCcsProduct1
dnbDataBlock1
search0
dnbMatch0
monitoring0

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_state when DATABASE_URL is set, otherwise kept in memory until restart.
  • Field tables above are derived from the same records the handlers return — not hand-maintained copies.

← Back to mock server home