
What are Service Bridges?
A service bridge creates a proxy endpoint within the Kodexa platform that forwards requests to an external API. This provides:- Centralized authentication — API credentials are managed as organization secrets, not embedded in modules. The platform supports automatic OAuth token management.
- Request routing — Modules reference a bridge endpoint rather than external URLs directly
- Caching — Responses can be cached per-endpoint with configurable TTL
- Request/response transformation — JavaScript hooks can modify requests before sending and responses before returning
- Monitoring — All requests through bridges are logged and can be monitored
Managing Service Bridges
Creating a Service Bridge
Configure Endpoint
Set the bridge name, target URL, authentication method, and any required headers.

Service bridges use organization secrets for authentication credentials. Make sure the required secrets are configured before creating a bridge that needs them.
YAML Configuration Reference
Service bridges are defined in YAML and deployed withkdx sync. Here is the full structure:
Secret References
Use${secrets.SECRET_NAME} to reference organization secrets in your bridge configuration. The platform resolves these at request time. This works in:
baseUrlauth.clientId,auth.clientSecret,auth.tokenUrl- Header values
Authentication
OAuth 2.0 Client Credentials
The platform can automatically manage OAuth 2.0 client credentials token lifecycle — acquiring tokens, caching them, and refreshing on expiry. This eliminates the need for external token rotation.- Fetch a token from the token endpoint on the first request
- Cache the token until near expiry
- Automatically refresh when the token expires
- Retry once with a fresh token if the upstream API returns 401 or 403
Standard vs Custom Token Requests
Most OAuth providers use the standard form-encoded format (RFC 6749). The platform uses this by default:requestFormat: custom:
${auth.clientId} and ${auth.clientSecret} placeholders in requestBody are substituted with the resolved values from the auth block.
Custom Response Mapping
If the token endpoint returns non-standard field names, useresponseMapping:
Full Auth Configuration Reference
| Field | Type | Default | Description |
|---|---|---|---|
type | string | required | Authentication type. Currently oauth2_client_credentials. |
tokenUrl | string | required | Token endpoint URL. Relative paths are resolved against baseUrl. |
clientId | string | required | OAuth client ID. Supports ${secrets.X}. |
clientSecret | string | required | OAuth client secret. Supports ${secrets.X}. |
requestFormat | string | "standard" | "standard" (form-encoded) or "custom" (JSON body). |
requestBody | object | — | Custom JSON body template when requestFormat is "custom". |
responseMapping | object | — | Maps non-standard token response field names. |
tokenCacheBufferSeconds | integer | 60 | Seconds before expiry to refresh the token. |
headerName | string | "Authorization" | HTTP header for the token. |
headerPrefix | string | "Bearer" | Prefix prepended to the token value. |
Static API Key / Bearer Token
For APIs that use a static API key or pre-generated token, set it directly in headers using a secret reference:Endpoints
Each endpoint defines a path on the external API that the bridge exposes.Request and Response Schemas
Optionally document the expected request and response shapes using JSON Schema:Script Hooks
Endpoints support JavaScript hooks for request/response transformation:| Hook | Runs | Input | Can Return |
|---|---|---|---|
initScript | Once per request (when no client context) | {headers, config} | {headers, context} |
preSendScript | Before each outbound call | {headers, body, context} | {headers, body} |
postReplyScript | After each response | {statusCode, body} | {body} |
Using Service Bridges from Script Steps
Service bridges that are added as project resources can be called directly from script steps in plan workflows. Scripts can discover available bridges withserviceBridge.list() and make HTTP requests with serviceBridge.call().
Using Service Bridges from Data Forms
Data forms can call service bridge endpoints both declaratively and from scripts:Declarative (Selection Options)
In taxonomy definitions, useselectionOptionFormula to populate dropdowns:

