@c15t/node-sdk
v2.1.0
Published
Official Node.js SDK for c15t. Connects to the Consent Engine to read and write consent records and preferences. TypeScript-first, simple APIs, built-in auth and retries.
Readme
@c15t/node-sdk: Type-Safe Node.js API Client
A fully typed, flexible Node.js SDK for seamless interaction with the c15t consent management platform API.
Key Features
- Type-safe API client with full TypeScript support
- Flexible client configuration with authentication and custom headers
- Supports dynamic base URL and API prefix configuration
- Built on top of @orpc/client for robust API interactions
- Easy integration with Node.js applications
- Comprehensive error handling and URL validation
Prerequisites
- Node.js 18.17.0 or later
- A Hosted c15t instance (free sign-up) or self-hosted deployment
Manual Installation
pnpm add @c15t/node-sdkUsage
- Import
c15tClientfrom@c15t/node-sdk - Configure with a base URL and token, or set
C15T_API_URLandC15T_API_TOKENso the client picks them up automatically - Call API methods on
client.meta,client.subjects, etc. — every method is fully typed
// server.ts
import { c15tClient } from '@c15t/node-sdk'
// Auto-configure from C15T_API_URL + C15T_API_TOKEN env vars
const client = c15tClient()
// Or pass options explicitly
// const client = c15tClient({
// baseUrl: process.env.C15T_API_URL!,
// token: process.env.C15T_API_TOKEN!,
// })
try {
const status = await client.meta.status()
console.log('c15t API status:', status)
const subject = await client.subjects.create({
type: 'cookie_banner',
subjectId: 'sub_123',
domain: 'example.com',
preferences: { analytics: true },
givenAt: Date.now(),
})
console.log('Created subject', subject.id)
} catch (error) {
console.error('c15t request failed:', error)
}Support
- Join our Discord community
- Open an issue on our GitHub repository
- Visit inth.com and use the chat widget
- Contact our support team via email [email protected]
Contributing
- We're open to all community contributions.
- Read our Contribution Guidelines
- Review our Code of Conduct
- Fork the repository
- Create a new branch for your feature
- Submit a pull request
- All contributions, big or small, are welcome and appreciated.
Security
If you believe you have found a security vulnerability in c15t, we encourage you to responsibly disclose this and NOT open a public issue. We will investigate all legitimate reports.
Our preference is that you make use of GitHub's private vulnerability reporting feature to disclose potential security vulnerabilities in our open-source software. To do this, please visit https://github.com/c15t/c15t/security and click the "Report a vulnerability" button.
Security Policy
- Please do not share security vulnerabilities in public forums, issues, or pull requests
- Provide detailed information about the potential vulnerability
- Allow reasonable time for us to address the issue before any public disclosure
- We are committed to addressing security concerns promptly and transparently
License
Built by Inth
