Authentication
Every request to the Korint API carries an access token identifying your client, and a tenant
header naming your tenant; see Call the API.
Get your credentials
Korint provisions a machine-to-machine client for your tenant and gives you:
client_idstringrequiredPublic identifier for your client.
client_secretstringrequiredSecret for your client. Store it as you would a database password — never in frontend code or a public repository.
tenantstringrequiredYour tenant identifier.
token_urlstringrequiredThe URL of your tenant's token endpoint. Each tenant has its own authorization server.
Ask your Korint contact if you don't have these yet. Credentials are issued per environment, so your staging client is not your production client.
Request an access token
Korint uses the OAuth 2.0 client credentials grant. Send the request to the token URL Korint gave
you for your tenant (<token_url> below).
- cURL
- Node.js
- Python
curl -X POST '<token_url>' \
--fail-with-body \
--user '<client_id>:<client_secret>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=korint.io/policies korint.io/customers'
const credentials = Buffer.from(`${clientId}:${clientSecret}`).toString('base64');
const response = await fetch(tokenUrl, {
method: 'POST',
headers: {
Authorization: `Basic ${credentials}`,
'Content-Type': 'application/x-www-form-urlencoded',
},
body: new URLSearchParams({
grant_type: 'client_credentials',
scope: 'korint.io/policies korint.io/customers',
}),
});
if (!response.ok) {
throw new Error(`Token request failed (${response.status}): ${await response.text()}`);
}
const { access_token, expires_in } = await response.json();
import requests
response = requests.post(
token_url,
auth=(client_id, client_secret),
data={
"grant_type": "client_credentials",
"scope": "korint.io/policies korint.io/customers",
},
)
response.raise_for_status()
access_token = response.json()["access_token"]
{
"access_token": "eyJraWQiOiJ...",
"token_type": "Bearer",
"expires_in": 3600
}
Cache the token and reuse it until it expires — read expires_in rather than assuming a lifetime, and
request a new token shortly before it runs out. Requesting one per API call will get you rate limited
by the authorization server.
Call the API
Send the token as a bearer token and name your tenant:
curl -X GET 'https://api.staging.korint.io/policies/{policyId}' \
--header 'Authorization: Bearer <access_token>' \
--header 'tenant: <your-tenant>'
Environments
| Host | Use |
|---|---|
https://api.staging.korint.io | Build and test your integration. Credentials are issued per environment, so your staging client is not your production client. |
https://api.korint.io | Production. |
Examples throughout this guide use the staging host. Korint also runs internal environments that are not part of the published surface; if you have been pointed at one, treat its host as given to you rather than inferred.
Send the tenant header on every call, reads and lookups included. Without it the request fails with
400 MISSING_TENANT or 401 INVALID_CREDENTIALS, even when your token is valid. Leave the header out
only where the route exists to find your tenant, as
Get a tenant's public config by domain
does.
Scopes
Ask only for the scopes your integration needs. Every scope you request must be one your client was
granted when it was provisioned: the authorization server rejects the whole token request with
invalid_scope if any requested scope is not allowed, rather than issuing a token with the rest.
| Scope | Grants access to |
|---|---|
korint.io/account | Account information for the caller |
korint.io/customers | Customer endpoints |
korint.io/policies | Policy endpoints |
korint.io/assets | Asset endpoints |
korint.io/branches | Branch endpoints |
korint.io/quotes | Quote endpoints |
korint.io/documents | Document endpoints |
korint.io/signature | Signature endpoints |
korint.io/billing | Billing endpoints |
korint.io/payments | Payment endpoints |
korint.io/claims | Claim endpoints |
korint.io/invitations | Invitation and anonymous-session endpoints |
korint.io/permissions | Permission management endpoints |
korint.io/broker | Broker endpoints |
korint.io/reportings | Reporting endpoints |
korint.io/analytics | Analytics endpoints |
korint.io/metrics | Metrics endpoints |
korint.io/external | External lookups (vehicle, company, address) |
Those are the scopes an integration client is normally granted; check the scope claim of a token you
have been issued to see what yours actually carries. A few scopes exist only for Korint's own
applications and are never granted to integration clients.
A new-business integration typically needs:
korint.io/customers korint.io/policies korint.io/assets korint.io/quotes
korint.io/branches korint.io/documents korint.io/signature korint.io/payments
Add korint.io/billing to read invoices or balances, and korint.io/invitations to run anonymous
quoting sessions.
The scope table above is what a client-credentials token must carry. For a user token, what the scope check accepts depends on how the user signed in:
- Password sign-in through the sign-in API issues an access token that the API passes on every scope it publishes.
- The hosted sign-in page, which single sign-on goes through, issues an access token carrying the
scopes your front end requests at sign-in, among those its client allows. That token passes the
scope check on the scopes it carries, so request the ones covering the operations your front end
calls, from the table above. A front end that requests only
openid email profileis refused with403on every route that declares a scope.
What an anonymous session may do is listed in Anonymous quoting. Which token identifies whom, and what each may act on, is covered in Authentication.
What needs no credentials at all
A few routes take no Authorization header, and they are exactly the ones a public funnel needs before
it has an actor:
POST /anonymous-session— start a session. Rate limited to 100 per hour.GET /configandGET /config/{productId}— read the tenant and product configuration.
The tenant header is still required. Everything else needs one of the three tokens above.
Calling the API from a browser
Whether your funnel needs a backend comes down to CORS, and the answer is not "any origin works".
The API allows a configured list of origins per environment. That list holds Korint's own
https://*.korint.io subdomains, an entry per partner front end, and — in the staging and development
environments only — localhost. So:
- Developing locally against staging: your
localhostdev server is already allowed. This is why a browser-only funnel appears to work from the start. - Deploying your own front end: your production origin is not allowed until it is added. Ask Korint to allowlist it, exactly, before you ship — a browser request from an unlisted origin is refused by the browser regardless of whether your token is valid.
Allowed requests may send authorization, tenant and content-type.
If you would rather not depend on an allowlist, put a thin server of your own in front: it holds no secrets for the unauthenticated routes above, and it removes the origin question entirely.
Troubleshooting
401 on every request
The token is missing, malformed, expired, or was issued by a different tenant's authorization server
than the tenant header names. Confirm you requested it from the token URL issued for the tenant you
are calling.
MISSING_TENANT
The tenant header is absent. Send it on every call, reads included.
403 although the token is valid
Either the token lacks the scope for that area, or the identity behind it has no permission on the record you named. Compare the scopes you requested against the table above first — that is the cheaper of the two to rule out. Which check refused you, and in what order they run, is in How a request is checked.
403 on a policy operation with a client-credentials token
Your token is valid, but record-level permissions resolve against a user, and your client holds no role, so an operation that checks a role can refuse it. Widening scopes does not help: act as a signed-in user who holds the role, or ask your Korint contact about your client's access. See The three kinds of token.
invalid_scope from the token endpoint
You requested a scope your client is not allowed. Request only the scopes your integration needs, or ask your Korint contact to widen the client.