Call your API
An api node sends case data to your server and lets the workflow branch on your reply, for example on a risk score you compute.
api nodes are not yet available on the production API. Build against a development environment until they are announced.Connections
A connection is an endpoint of yours in one workspace and one environment. Workspace owners and administrators manage them.
| Method and path | Purpose |
|---|---|
GET /workflow-connections | List the connections of the selected environment. |
POST /workflow-connections | Create a connection. The response shows the signing secret once. |
GET, PATCH, DELETE /workflow-connections/{id} | Read, edit or delete a connection. Deleting returns 409 while a draft or the latest version of an active workflow uses it. |
POST /workflow-connections/{id}/rotate-secret | Replace the signing secret. The response shows the new secret once. |
POST /workflow-connections/{id}/test | Send a signed test call. |
Field Value nameUp to 80 characters. urlYour endpoint. It must pass the destination checks. auth_headerOptional header name, such as Authorization or X-Api-Key. auth_valueOptional value sent in that header. Responses return auth_value_set instead of the value.
Credflare waits for your reply for the workspace's API wait setting, 5 seconds unless an administrator changes it in workspace settings, up to 10.
The signing secret is whsec_ followed by 64 hex characters. It and the auth value are stored encrypted. Keep the secret on your server.
The test call sends {"type":"connection.test"}, signed like a node call, and returns your status, the duration and up to 1 KB of your reply:
{
"success": true,
"message": "Operation successful",
"data": {
"status": 200,
"duration_ms": 16,
"response_excerpt": "{\"decision\":\"review\",\"score\":71}"
}
}
The api node
Add an api node with the connection_id, the IDs of the nodes whose outputs to send in include (up to 50), a label and ordered rules. It has exactly two outgoing edges: a plain edge taken on success and an edge with on: "failed". See the full graph in Workflows.
The request
When a case reaches the node, Credflare sends a POST with a JSON body. data holds the output of each node in include, keyed by node ID. form is present when the form requirement is included. This call included a location check node:
{
"event_id": "35090eeb-ef1a-5b46-97bf-6e45f5e6c22a",
"type": "workflow.node",
"case_id": "2lN-54xX0KdME7Q8pmYT2",
"node_id": "call_api",
"environment": "sandbox",
"workflow_version_id": "01a20028-b46c-7382-ab70-6d03a68e35f7",
"data": {
"location_verification_checks": {
"location_checks": {
"accuracy_m": 10,
"max_accuracy_m": 100,
"fix_age_s": 5,
"max_age_s": 60,
"is_mock": false,
"mock_location": "reject",
"ip_country": {
"mode": "off",
"result": "not_checked",
"reason": "disabled",
"ip_country": null,
"location_country": null,
"nearby_countries": []
}
},
"reference": {
"outcome": "not_configured",
"accuracy": 10
}
}
}
}
Header Value Content-Typeapplication/json User-AgentCredflare-Workflows/1 X-Credflare-Event-IdThe event_id of the body. X-Credflare-TimestampUnix time in seconds when the request was signed. X-Credflare-Signaturev1= followed by the hex HMAC SHA-256 of the timestamp, a period and the raw body, keyed with the signing secret. Your auth_header Your auth_value, when the connection has one.
event_id is derived from the case, the node and the data sent. Every retry sends the same body with the same event_id, so store it and ignore repeats.
Verify the signature
- Read the raw body before parsing it as JSON. Parsing and serializing again changes the bytes.
- Compute the HMAC SHA-256 of
<X-Credflare-Timestamp>.<raw body> with the whole secret, including whsec_, and prefix it with v1=. - Compare it with
X-Credflare-Signature in constant time. - Reject timestamps more than five minutes from your clock.
Node.js:
import {createHmac, timingSafeEqual} from 'node:crypto';
export function verifyCredflareCall(rawBody, timestamp, signature, secret, now = Date.now() / 1000) {
const expected = 'v1=' + createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex');
const fresh = Math.abs(now - Number(timestamp)) < 300;
const received = Buffer.from(String(signature ?? ''));
return fresh && received.length === expected.length && timingSafeEqual(received, Buffer.from(expected));
}
Python:
import hashlib
import hmac
import time
def verify_credflare_call(raw_body: bytes, timestamp: str, signature: str, secret: str, now: float | None = None) -> bool:
now = time.time() if now is None else now
expected = "v1=" + hmac.new(secret.encode(), timestamp.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return abs(now - int(timestamp)) < 300 and hmac.compare_digest(expected, signature or "")
PHP:
<?php
function verifyCredflareCall(string $rawBody, string $timestamp, string $signature, string $secret, ?int $now = null): bool
{
$expected = 'v1='.hash_hmac('sha256', $timestamp.'.'.$rawBody, $secret);
return abs(($now ?? time()) - (int) $timestamp) < 300 && hash_equals($expected, $signature);
}
Pass the raw body, the two headers and your secret. In Express, read the body with express.raw({type: 'application/json'}) and pass req.body.toString(). In PHP, read file_get_contents('php://input'). Answer 401 when the check fails.
These functions were run against a request sent by the Credflare connection client and its secret. They return true for it, and false when one byte of the body changes, when the secret is wrong, or when the timestamp is more than five minutes old.
Your reply
Reply with a 2xx status and a JSON object of at most 64 KB. The object becomes nodes.<id>.output.body, next to status and duration_ms, so rules and branches can read values such as nodes.risk.output.body.decision or nodes.risk.output.status.
{"decision": "review", "score": 71}
Retries and the failed path
A timeout, a connection error or a 5xx is retried twice, 5 and then 30 seconds later. These fail at once, without a retry: any 3xx or 4xx, a body that is not a JSON object, a body larger than 64 KB, and a refused destination. Redirects are never followed.
A node that fails takes its failed edge, with output {status, error_code}:
error_codeWhen timeoutNo reply within the timeout, after the retries. connection_failedThe connection failed, after the retries. http_<status>Your server answered with a status outside 2xx, such as http_404. invalid_jsonThe reply is not a JSON object. too_largeThe reply is larger than 64 KB. blocked_destinationThe URL failed the destination checks.
Each attempt is an api_called event in the case timeline, with attempt, status, duration_ms, error_code and response_sha256. Reply bodies stay out of events; only the node run keeps the final body.
Blocked destinations
Connection and webhook URLs are checked when they are saved and again on every request.
- Live needs
https. Sandbox also accepts http. - Every address the host resolves to must be public. Private, loopback, link local, shared (CGNAT), multicast, documentation, benchmarking and reserved ranges are refused, in IPv4 and IPv6, including IPv4 mapped, NAT64 and 6to4 forms.
- Cloud metadata addresses
169.254.169.254 and fd00:ec2::254 are always refused. - The request goes to the address that was checked, so a host cannot switch to another address between the check and the call.