The SDK targets the base URL
https://app.refold.ai and sends your API key in the x-api-key header for you. Run it only on your server.Prerequisites
- An API key. Copy it from Settings > Credentials in the Refold Console. See Developer app and API keys.
- A Node.js backend. The examples below use the Node.js SDK.
Install the SDK
Install the package
Add the Refold Node.js SDK to your backend.
TODO: confirm the published npm package name and import for the Refold-branded server SDK. The current package on npm is
@cobaltio/cobalt and the client class is Cobalt. Verify whether a renamed Refold package exists before publishing.Initialize the client
Create the client once at startup and read the API key from your environment.
Node.js
Where the API key lives
Keep one rule: the API key stays on the server, and the browser only ever sees a session token.- Read the key from an environment variable, never a literal in source. The examples use
process.env.REFOLD_API_KEY. - Use the test key in non-production environments and the live key in production. The key selects the environment. See Test vs production credentials.
- Initialize one client per environment and reuse it across requests rather than constructing a new client per call.
Prefer the API directly?
The SDK is optional. Every operation is a plain HTTP call you can make from any backend with the base URLhttps://app.refold.ai and the x-api-key header.
cURL
Output
Next steps
Create linked accounts
Create one account per customer and mint a session token for the frontend.
Node.js SDK reference
Every method, parameter, and return shape.
Trigger events
Start workflows from your backend when something happens in your app.
Make API proxy calls
Call a connected app’s API with the customer’s stored credentials.