Registry / communication / sipgate-rest-api-client-v2

sipgate-rest-api-client-v2

JSON →
library5.30.1jsnpmunverified

Official client library for the sipgate REST API v2. Current stable version 5.30.1. Maintained actively by sipgate. Key differentiators: native Promise-based API with built-in error handling for non-2xx responses (since 5.0.0, breaking change), configurable response interceptor, and support for legacy error handling opt-out. Covers all sipgate API endpoints (users, calls, SMS, contacts, etc.) with automatic authentication via API token. No external HTTP dependencies.

npm install sipgate-rest-api-client-v2
INSTALL
IMPORT
SIG · SIPGATE-REST-API-C
S
sipgate-rest-api-client-v2
communicationjavascriptv5.30.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createClient
import createClient from 'sipgate-rest-api-client-v2'
const createClient = require('sipgate-rest-api-client-v2')
Package is ESM-only. Use import syntax. Default export only.
ResponseErrorPayload
import type { ResponseErrorPayload } from 'sipgate-rest-api-client-v2'
import { ResponseErrorPayload } from 'sipgate-rest-api-client-v2'
ResponseErrorPayload is a TypeScript interface, not a runtime value. Use `import type` for type-only imports.
createClient (CommonJS)
const createClient = (await import('sipgate-rest-api-client-v2')).default
const createClient = require('sipgate-rest-api-client-v2')
If using CommonJS, you must use dynamic import or set module resolution. require() not supported.

Create a client instance and fetch all users, handling errors with the ResponseErrorPayload interface.

import createClient from 'sipgate-rest-api-client-v2'; const client = createClient('https://api.sipgate.com', process.env.API_TOKEN ?? ''); client.getUsers() .then(users => console.log('Users:', users)) .catch(({ payload }) => { console.error(`Error ${payload.status}: ${payload.statusText}`, payload.body); });
Debug
Known issues
breakingSince version 5.0.0, non-2xx HTTP responses reject the promise instead of fulfilling it with the error body.
fix
Wrap calls in .catch() and access error details via error.payload. For old behavior, set skipResponseErrorHandling to true.
affects: >=5.0.0
deprecatedUsing onPromiseResolved parameter (third argument) for custom error handling is superseded by built-in error rejection.
fix
Rely on catch() handler. Only use onPromiseResolved if you need to process successful responses.
affects: >=5.0.0
gotchaThe package is ESM-only. Attempting to use require() will cause a runtime error.
fix
Use import syntax or dynamic import. For CommonJS projects, set type: "module" or use .mjs extension.
affects: >=1.0.0
gotchaAPI token is passed in cleartext as second argument. Ensure token is kept secret and not committed to version control.
fix
Use environment variables and never hardcode tokens.
affects: >=1.0.0
Errors
Common errors & fixes
SyntaxError: Cannot use import statement outside a module
Trying to use ESM import in a CommonJS project without proper configuration.
fix
Add "type": "module" to package.json or rename file to .mjs. Alternatively use dynamic import.
TypeError: createClient is not a function
Using default import incorrectly, e.g., importing named export or misconfiguring bundler.
fix
Ensure you use: import createClient from 'sipgate-rest-api-client-v2' (default import).
TypeError: Cannot read properties of undefined (reading 'payload')
Trying to access error.payload in a catch block, but the error does not have a payload property (likely a network error or pre-5.0.0 version).
fix
Check version >=5.0.0 and ensure catch() receives the correct error shape. For non-HTTP errors, payload is undefined.
Upgrade
Version history
5.30.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
sipgate-rest-api-client-v2 — npm install sipgate-rest-api-client-v2 · libregistry