Adapter: Generic REST API
Connect to any REST API with custom configuration.
On this page
Purpose
Call any HTTP API: GET, POST, PUT, PATCH and DELETE with a body built from the step or its input. It also sends outbound webhooks.
Auth
none,basic,bearer,apikey(a header,X-API-Keyby default),oauth2oroauth2-private-key-jwt. Both OAuth2 types use the client credentials grant, cache the token until it expires, and fetch a new one once after a 401. See OAuth2.- It takes the shared connection options: a client certificate for mutual TLS, a private CA, a minimum TLS version and a proxy. They apply to its token requests too.
Settings
Auth is chosen with authType: none, basic, bearer, apikey, oauth2, oauth2-private-key-jwt (default none). Dotted names are fields inside an object setting. Secret settings are encrypted at rest, never returned by a read, and shown masked in the console and in exports; their defaults are not shown.
| Setting | Type | Required | Default | Secret | Description |
|---|---|---|---|---|---|
baseUrl | url | Yes | No | API base URL. | |
authType | enum: none, basic, bearer, apikey, oauth2, oauth2-private-key-jwt | No | none | No | Authentication method. oauth2: client credentials with a client secret. oauth2-private-key-jwt: client credentials with a client assertion signed by your private key (RFC 7523). |
credentials | object | No | |||
credentials.username | string | No | No | Used when authType is basic. | |
credentials.password | string | No | Yes | Used when authType is basic. | |
credentials.token | string | No | Yes | Used when authType is bearer. | |
credentials.apiKey | string | No | Yes | Used when authType is apikey. | |
credentials.apiKeyHeader | string | No | X-API-Key | No | Used when authType is apikey. |
credentials.clientId | string | No | No | Used when authType is oauth2 or oauth2-private-key-jwt. | |
credentials.clientSecret | string | No | Yes | Used when authType is oauth2. | |
credentials.tokenUrl | url | No | No | Used when authType is oauth2 or oauth2-private-key-jwt. | |
credentials.scopes | string | No | No | Used when authType is oauth2 or oauth2-private-key-jwt. | |
credentials.privateKeyPEM | string | No | Yes | PEM RSA private key that signs the client assertion (oauth2-private-key-jwt). Used when authType is oauth2-private-key-jwt. | |
credentials.keyId | string | No | No | kid of the registered public key (oauth2-private-key-jwt). Used when authType is oauth2-private-key-jwt. | |
oauth2ClientAuth | enum: client_secret_basic, client_secret_post | No | No | oauth2: how the client secret reaches the token endpoint. client_secret_basic (default): an Authorization header. client_secret_post: in the form body. Used when authType is oauth2. | |
oauth2Audience | string | No | No | oauth2: the audience parameter of the token request (Auth0, Okta). Used when authType is oauth2 or oauth2-private-key-jwt. | |
oauth2Resource | string | No | No | oauth2: the resource parameter of the token request (RFC 8707, Azure AD v1). Used when authType is oauth2 or oauth2-private-key-jwt. | |
oauth2AssertionAlgorithm | enum: RS384, RS256 | No | No | oauth2-private-key-jwt: the client assertion's signing algorithm (default RS384). Used when authType is oauth2-private-key-jwt. | |
defaultContentType | string | No | No | Content-Type for writes when the step sets none (default: text/plain for a string body, else application/json). | |
defaultHeaders | map | No | Yes | Default headers for all requests. | |
timeout | number | No | 30000 | No | Request timeout in milliseconds. |
correlationHeader | string | No | X-Request-Id | No | Header that carries the run's correlation id: the inbound x-request-id, else the execution id. Empty: none. |
signDeliveries | boolean | No | true | No | Sign each request (Standard Webhooks: webhook-id, webhook-timestamp, webhook-signature) so the receiver can verify it came from this engine. Applies once the profile has a signing secret. |
signingSecret | string | No | Yes | whsec_ signing secret. Leave empty to have one generated when you save; it is shown once. | |
tlsCaPem | string | No | Yes | PEM CA certificate(s) to verify the server against. See tlsCaMode. | |
tlsCaMode | enum: replace, add | No | No | Trust: replace = only this CA (default), add = the system CAs plus this CA. Needs tlsCaPem. | |
tlsClientCertPem | string | No | Yes | PEM client certificate, for servers that require mutual TLS. Set with tlsClientKeyPem. | |
tlsClientKeyPem | string | No | Yes | PEM private key for the client certificate (encrypted at rest). | |
tlsClientPfx | string | No | Yes | Client certificate and key as a base64 PKCS#12 (.p12 / .pfx) bundle, instead of the PEM pair. | |
tlsClientPassphrase | string | No | Yes | Passphrase of the PKCS#12 bundle. | |
tlsMinVersion | enum: TLSv1.2, TLSv1.3 | No | No | Lowest TLS version to accept (default TLSv1.2). | |
proxyUrl | url | No | No | HTTP(S) proxy, e.g. http://proxy.example.test:3128 (opens in a new tab). The proxy host must pass the SSRF rules (SSRF_ALLOWLIST for a private one). | |
proxyUsername | string | No | No | Proxy user (Basic auth). | |
proxyPassword | string | No | Yes | Proxy password. | |
noProxy | array of string | No | No | Hosts sent direct, not through the proxy: a name (and its subdomains), .suffix, host:port or *. |
Actions
A trailing ? marks an optional step parameter. A message can supply only the keys in the last column; everything else comes from the step.
| Action | What it does | Step parameters | Keys a message may supply |
|---|---|---|---|
get | HTTP GET request. | endpoint?, query?, headers?, response?, answerStatuses?, urlTemplate?, pagination? | None |
post | HTTP POST request. | endpoint?, body?, headers?, response?, answerStatuses?, urlTemplate?, contentType? | body |
put | HTTP PUT request. | endpoint?, body?, headers?, response?, answerStatuses?, urlTemplate? | body |
delete | HTTP DELETE request. | endpoint?, headers?, response?, answerStatuses?, urlTemplate? | None |
patch | HTTP PATCH request. | endpoint?, body?, headers?, response?, answerStatuses?, urlTemplate? | body |
Minimal example
The smallest profile the engine accepts: the required settings only, with synthetic values. Create it with POST /api/adapter-profiles, then test it with POST /api/adapter-profiles/{id}/test.
{
"name": "Generic REST API (example)",
"adapterType": "generic-rest",
"config": {
"baseUrl": "https://generic-rest.example.test/base"
}
}OAuth2
Both OAuth2 auth types post grant_type=client_credentials to credentials.tokenUrl and send the API the token as Authorization: Bearer.
| Setting | What it does |
|---|---|
oauth2ClientAuth | oauth2 only. client_secret_basic (default) sends the client id and secret as an HTTP Basic header; client_secret_post sends them in the form body. |
oauth2Audience | Sends audience, which Auth0 and Okta custom authorization servers need to issue a token for your API. |
oauth2Resource | Sends resource (RFC 8707; Azure AD v1 and ADFS). |
credentials.scopes | Sends scope. Azure AD v2 wants <application id URI>/.default. |
oauth2AssertionAlgorithm | oauth2-private-key-jwt only. RS384 (default, as SMART Backend Services) or RS256 (Azure AD, Okta). |
private_key_jwt. With oauth2-private-key-jwt the profile has no client secret. The engine signs an RFC 7523 client assertion with credentials.privateKeyPEM, as the FHIR REST adapter's backend services auth does: iss and sub are the client id, aud is the token URL, it expires after 5 minutes and has a unique jti, and credentials.keyId is its kid header when set. The request carries client_id, client_assertion_type (urn:ietf:params:oauth:client-assertion-type:jwt-bearer) and client_assertion. Register the matching public key, or a JWKS URL that serves it, with the authorization server.
The client secret and the private key are in the encrypted credentials and go only to the token URL, which passes the same SSRF check as the base URL. A failed token request names the endpoint's OAuth error, never the secret, the key or the token, and fails the step before anything reaches the API, so it is retried. A token is cached per profile settings, so two profiles that differ in audience, resource, scope or client authentication never share one.
URL templates
A step can build its URL from the message with urlTemplate, in place of endpoint. Reads (get) and writes (post, put, patch, delete) take one.
{ "action": "put", "config": { "urlTemplate": "/appointments/{{data.id}}" } }With baseUrl https://scheduling.example.test/api/v1 and a step input { "id": "APT-1001", ... }, the step sends PUT https://scheduling.example.test/api/v1/appointments/APT-1001 with the input as the body.
| Placeholder | Value |
|---|---|
{{data.PATH}} | A field of the step's input, such as {{data.patient.mrn}} or {{data.ids[0]}}. |
{{channel.KEY}} | A channel map value an earlier JavaScript step set ($c, channelMap, vars). |
{{sender.KEY}} | A per-sender setting. |
{{env.NAME}} | A workspace variable. At the very start of the template it is the base URL. |
{{cursor}} | Reads only: the polling trigger's cursor, or the next cursor of cursor pagination. |
The rules:
- Each value is encoded for where it lands. A path value is one segment:
/,?,#and&are escaped, and.or..are refused. A query value is one parameter value. - A relative template starts with
/or?and followsbaseUrl. An absolute template must end its host before the first placeholder. No value can change the host. - The SSRF check runs on the final URL, and on every redirect.
- A missing path value fails the step without sending anything, and the error names the placeholder, never the data. A missing query value drops that parameter.
- The template is the step's setting. A message can't set it.
- Each templated call is in the audit log (
adapter.rest.templated_readoradapter.rest.templated_write, with the method): the template as written, the placeholder names and the host, never the values. One entry per configuration per hour.
The response
A step's output is the response body: JSON when the Content-Type is application/json or any application/*+json (application/fhir+json, application/problem+json), text otherwise. A delete answered 204 outputs { "success": true }.
Set the step's response to full to output the status and headers too:
{
"status": 201,
"headers": {
"content-type": "application/fhir+json",
"location": "/api/v1/appointments/CONF-1"
},
"body": { "id": "CONF-1", "status": "booked" }
}- A condition step can then branch on the status, such as
data.status === 201(booked) ordata.status === 202(queued), and a later step can read{{data.headers.location}}in its URL template. - Header names are lower-case. Credential headers, such as
set-cookieor a token, read[redacted], as in the Delivered tab. - An empty body is
null. - A status outside 200-299 still fails the step, so retries and the error path work as before.
- The setting is the step's: a message can't set it. A paginated read outputs its items, so it refuses
full. - A write step after it that has no
bodyof its own sends thebodyfield of this output (a message may supplybody).
Correlation id
Each request a workflow step sends carries the run's correlation id in the profile's correlationHeader, X-Request-Id by default, so your team and the API's team can find the same call.
- For a run started by an HTTP request (a webhook), it is that request's
x-request-id: the sender's own, or the one the engine gave the request and answered in itsX-Request-IDheader. Otherwise (MLLP, a schedule, a poll, a manual run) it is the execution id. A step's retries keep it, and a replay of a webhook run keeps the request's id. - An inbound value that is not a plain id (letters, digits and
. _ : @ / + = -, at most 128 characters) is replaced with the execution id. - Set
correlationHeaderto another name, such asX-Correlation-ID, or to an empty string to send none. A header the step or profile sets under that name wins. - The token request of an OAuth2 profile does not carry it.
- The Delivered tab shows it as Correlation id on each request, to viewers too, and each call writes a log line (
"Generic REST call") withcorrelationId, the method, the host and the status, never the path.
Signed requests
A profile can sign every request it sends, following Standard Webhooks (opens in a new tab), so the receiver can check that the request came from your engine and was not changed or replayed.
Each signed request carries three headers:
| Header | Value |
|---|---|
webhook-id | The message id. A write uses its Idempotency-Key, so a retry of the same step for the same message keeps the same id. Other requests get a new msg_... id. |
webhook-timestamp | Unix time of this attempt, in seconds. |
webhook-signature | v1, and the base64 HMAC-SHA256 of <webhook-id>.<webhook-timestamp>.<body>, keyed with the secret. A request with no body signs an empty body. |
How to turn it on:
- New profiles. New connection has Sign deliveries on, under More settings. Leave Signing secret empty and the engine generates one (
whsec_followed by base64) when you save, and shows it once. Copy it and give it to the receiver. No read returns it again. - Existing profiles. Profiles saved before signing existed do not sign, so their receivers keep working. To start signing, call
POST /api/adapter-profiles/{id}/signing-secret. It generates a secret, turns signing on and returns the secret once. Call it again to rotate: the old secret stops working at once. - Your own secret. Set
signingSecretto a secret you and the receiver agreed on. A secret without thewhsec_prefix is used as plain text bytes and the save returns a warning, because Standard Webhooks libraries expectwhsec_and base64. - Off. Set
signDeliveriestofalse. The stored secret is kept.
A step's headers cannot set or replace the three signature headers. Signing over http:// works, with a warning: the signature proves the sender, but the body is not encrypted.
Verify on the receiver
Use a Standard Webhooks library for your language, or check it yourself. This Node.js example verifies the raw body bytes, compares in constant time, and refuses a timestamp more than five minutes from now:
import { createHmac, timingSafeEqual } from "node:crypto";
// secret: the whsec_ value the engine showed you, from your secret store.
export function verifyMedHookRequest(secret, headers, rawBody) {
const id = headers["webhook-id"];
const timestamp = headers["webhook-timestamp"];
const signatures = headers["webhook-signature"];
if (!id || !timestamp || !signatures) return false;
const now = Math.floor(Date.now() / 1000);
if (Math.abs(now - Number(timestamp)) > 5 * 60) return false;
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const expected = createHmac("sha256", key)
.update(`${id}.${timestamp}.`)
.update(rawBody)
.digest();
// The header can hold several space-separated "v1,<base64>" values.
return signatures.split(" ").some((entry) => {
const [version, value] = entry.split(",");
if (version !== "v1" || !value) return false;
const received = Buffer.from(value, "base64");
return (
received.length === expected.length && timingSafeEqual(received, expected)
);
});
}Hash the bytes you received, not a re-serialized copy of the JSON. To reject a replayed request inside the five minutes, remember each webhook-id you accepted for that long and refuse a repeat.
Header and query values from the message
A step's headers and query values can use {{data.PATH}}, {{channel.KEY}} and {{sender.KEY}}, as a URL template does. A value with no placeholder is sent as written.
{
"action": "get",
"config": {
"endpoint": "/appointments",
"headers": { "X-Patient-Id": "{{data.patient.id}}", "X-Batch": "{{channel.batchId}}" },
"query": { "mrn": "{{data.patient.mrn}}", "since": "{{channel.cursor}}" }
}
}- A header value can't hold a line break (CR, LF or NUL): the step fails without sending, so a message can't add a header. A header whose value is missing fails the step, and the error names the placeholder, never the data.
- A query value is URL-encoded into its own parameter, so
&or=in the data stay inside it. A parameter whose value is missing is left out. - The placeholders are the step's settings; a message still can't set the headers or query themselves.
- Keep PHI out of headers where you can: proxies and the receiving server may log them.
Limits
- A write with no
endpointsends tobaseUrl; with nobodyit sends the step's input. A string is sent as it is; an object is JSON, or form-encoded forapplication/x-www-form-urlencoded. - A write carries an
Idempotency-Keythat stays the same across retries of the step for the same message. - A message cannot set the endpoint, URL template, headers or method: only the
body. Its fields reach the URL, headers and query only through the step's own placeholders. - The engine refuses a URL that resolves to a private address unless the host is in
SSRF_ALLOWLIST(see Environment variables).