SDK reference
Client
new DidConnect(options) — key, project, base URL, timeouts and errors.
const dc = new DidConnect({
apiKey: process.env.DIDCONNECT_API_KEY!,
project: 'consumer',
timeoutMs: 15_000,
});| Option | Type | Default | |
|---|---|---|---|
apiKey | string | — | dc_test_… or dc_live_… |
project | string | the default project | Sent as DidConnect-Project |
baseUrl | string | https://api.didconnect.xyz | |
timeoutMs | number | 30000 | |
fetch | typeof fetch | global fetch | For tests or a custom agent |
dc.withProject(slug) returns a client bound to another project.
Errors
Every answer outside 2xx throws a DidConnectError:
import { DidConnectError } from '@didconnect/sdk';
try {
await dc.verify.sessions.decide(id, { decision: 'approved' });
} catch (err) {
if (err instanceof DidConnectError && err.code === 'VERIFY_INVALID_TRANSITION') {
// the session was decided meanwhile
}
}| Property | |
|---|---|
status | HTTP status |
code, type, param | From the envelope |
requestId | Quote it to support |
A network error or a timeout throws a DidConnectError with status 0 and code
NETWORK_ERROR or TIMEOUT.

