# Cvent REST API SDKs The Cvent REST API SDKs provide official, typed access to Cvent's platform APIs for event management, contacts, attendees, sessions, exhibitors, housing, surveys, and more. The SDKs are available for TypeScript, Java, and C# and are generated from a single OpenAPI specification (`cvent-public-spec/openapi.yaml`). All SDKs authenticate via OAuth2 (Client Credentials or Authorization Code) and communicate with the Cvent API server at `https://api-platform.cvent.com/ea` (US) or `https://api-platform-eur.cvent.com/ea` (EU). The SDKs are designed for developers building integrations with Cvent's event management platform. The core functionality spans 30+ resource namespaces covering the full event lifecycle: creating and managing events, registering attendees, organizing sessions and speakers, handling exhibitors, booking housing, running bulk data imports, sending emails, processing surveys, streaming webcasts, managing contacts, and administering users. All list operations use async cursor-based pagination. The TypeScript SDK additionally exposes every method as a tree-shakable standalone function via `@cvent/sdk/funcs/*`, making it suitable for serverless and browser environments. --- ## SDK Installation Install the SDK for your preferred language. ```bash # TypeScript npm add @cvent/sdk # Java (Gradle) implementation 'com.cvent:sdk:1.2.3' ``` ```xml com.cvent sdk 1.2.3 ``` ```bash # C# dotnet add package Cvent.SDK ``` --- ## Authentication — OAuth2 Client Credentials All SDK calls require OAuth2 authentication. Initialize the client with your `clientID`, `clientSecret`, `tokenURL`, and `scopes`; the SDK handles token acquisition and refresh automatically. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/events:read event/attendees:read contacts/contacts:read", }, }, }); ``` --- ## Authentication — Per-Operation OAuth2 Token Exchange Some operations (e.g., the `/oauth2/token` endpoint itself) require passing security credentials directly at the call site rather than at SDK initialization. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK(); async function run() { const result = await sdk.authentication.oauth2Token( { username: "", password: "" }, { grantType: "client_credentials", clientId: "djc98u3jiedmi283eu928", scope: "event/events:read event/attendees:read", redirectUri: "https://example.com/redirect", refreshToken: "dn43ud8uj32nk2je", code: "AUTHORIZATION_CODE", } ); console.log(result); // { access_token: "...", expires_in: 3600, token_type: "Bearer" } } run(); ``` --- ## Events — List and Get Events Events are the central entity in Cvent. Use `getEvents` to retrieve a paginated list with filter support, or `getEventById` to fetch a specific event by its UUID. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/events:read", }, }, }); async function run() { // List events with filtering const pages = await sdk.events.getEvents({ filter: "status eq 'Active'", token: "cursor-token-from-previous-page", }); for await (const page of pages) { for (const event of page.data ?? []) { console.log(event.id, event.title, event.status); } } // Get a single event const event = await sdk.events.getEventById({ id: "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3" }); console.log(event); } run(); ``` --- ## Events — Create Event Asynchronously Creating an event is an async operation — submit the create request, then poll the returned job ID until the status is `Completed`. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/events:write", }, }, }); async function run() { const job = await sdk.events.createEventAsync({ title: "Annual Tech Summit 2025", startDate: "2025-09-15T09:00:00Z", endDate: "2025-09-17T18:00:00Z", timezone: "America/New_York", }); // Poll until done let status; do { await new Promise((r) => setTimeout(r, 2000)); status = await sdk.events.getEventAsyncStatus({ id: job.id! }); console.log("Status:", status.status); } while (status.status !== "Completed" && status.status !== "Failed"); if (status.status === "Completed") { console.log("Created event ID:", status.eventId); } } run(); ``` --- ## Events — Event Check-In and Session Check-In Record that an attendee checked in to an event or a specific session. Both operations accept the event ID, attendee ID, and an optional timestamp. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/attendees:write", }, }, }); async function run() { // Event check-in await sdk.events.eventCheckIn({ id: "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3", // event ID attendeeId: "a1b2c3d4-0000-0000-0000-000000000001", checkInDate: "2025-09-15T09:30:00Z", }); console.log("Event check-in recorded"); // Session check-in await sdk.events.sessionCheckIn({ id: "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3", // event ID sessionId: "5faa1111-0dc3-487b-953e-86d6abbdf7d3", attendeeId: "a1b2c3d4-0000-0000-0000-000000000001", checkInDate: "2025-09-15T10:00:00Z", }); console.log("Session check-in recorded"); } run(); ``` --- ## Attendees — List, Create, and Update Attendees The Attendees API manages the people registered for an event, including reading their data, registering new attendees, and updating existing records. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/attendees:read event/attendees:write", }, }, }); async function run() { // Create a new attendee const newAttendee = await sdk.attendees.createAttendee({ eventId: "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3", firstName: "Jane", lastName: "Smith", email: "jane.smith@example.com", admissionItem: { id: "adm-item-uuid" }, }); console.log("Created attendee:", newAttendee.id); // List attendees for an event const pages = await sdk.attendees.listAttendees({ filter: "event.id eq '04ca6ae2-0dc3-487b-953e-86d6abbdf7d3' and status eq 'Accepted'", }); for await (const page of pages) { console.log(page.data?.length, "attendees on this page"); } // Get a single attendee const attendee = await sdk.attendees.getAttendeeById({ id: newAttendee.id! }); console.log(attendee); // Update attendee await sdk.attendees.updateAttendee({ id: newAttendee.id!, firstName: "Janet", }); } run(); ``` --- ## Attendees — Attendance Durations Retrieve how long attendees were engaged with sessions, appointments, or videos — useful for calculating participation metrics. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/attendees:read", }, }, }); async function run() { const pages = await sdk.attendees.listDurations({ filter: "firstSeen gt '2025-09-15T09:00:00.000Z' and session.id eq '5faa1111-0dc3-487b-953e-86d6abbdf7d3'", sort: "start:DESC", }); for await (const page of pages) { for (const d of page.data ?? []) { console.log(`Attendee ${d.attendeeId}: ${d.durationSeconds}s in session`); } } } run(); ``` --- ## Sessions — Create and Manage Sessions Sessions are presentations or activities within an event. This API covers creating sessions, updating their details, managing speaker assignments, and attaching documents. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/sessions:write event/sessions:read", }, }, }); async function run() { // Create session const session = await sdk.sessions.createSession({ event: { id: "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3" }, name: "Keynote: Future of AI", startDate: "2025-09-15T10:00:00Z", endDate: "2025-09-15T11:00:00Z", capacity: 500, isOpenForRegistration: true, }); console.log("Session created:", session.id); // List sessions for an event const pages = await sdk.sessions.listSessions({ filter: "event.id eq '04ca6ae2-0dc3-487b-953e-86d6abbdf7d3'", }); for await (const page of pages) { page.data?.forEach((s) => console.log(s.name, s.startDate)); } // Add speaker to session await sdk.sessions.addSpeakerToSession({ id: session.id!, speakerId: "spk-uuid-1234", }); } run(); ``` --- ## Speakers — Create and Assign Speakers Speakers are individuals presenting at sessions. Use this API to create speaker profiles, assign them to sessions, and manage their documents and images. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/speakers:write", }, }, }); async function run() { // Create speaker const speaker = await sdk.speakers.createSpeaker({ event: { id: "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3" }, firstName: "Dr. Ada", lastName: "Lovelace", title: "Chief AI Officer", company: "TechCorp", biography: "Pioneer of modern computing and AI.", }); console.log("Speaker created:", speaker.id); // List speakers filtered by session const pages = await sdk.speakers.getSessionProgramSpeakers({ filter: "session.id in ('5faa1111-0dc3-487b-953e-86d6abbdf7d3', '34ca65e2-1dc3-487b-589e-839d8bbdf7d3')", }); for await (const page of pages) { page.data?.forEach((sp) => console.log(`Speaker ${sp.speakerId} → Session ${sp.sessionId}`) ); } } run(); ``` --- ## Contacts — Create, Update, and Manage Contacts Contacts represent individuals in your Cvent account's address book. The Contacts API supports full CRUD, bulk operations, group management, merging duplicates, and GDPR obfuscation. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "contacts/contacts:write contacts/contacts:read", }, }, }); async function run() { // Create contacts const created = await sdk.contacts.createContacts([ { firstName: "Alice", lastName: "Johnson", email: "alice@example.com", phone: "555-0101", }, { firstName: "Bob", lastName: "Williams", email: "bob@example.com", }, ]); console.log("Created:", created.map((c) => c.id)); // Get a contact by ID const contact = await sdk.contacts.getContactById({ id: created[0].id! }); console.log(contact); // Create a contact group const group = await sdk.contacts.createContactGroup({ name: "VIP Attendees", shortDescription: "Top-tier contacts", description: "Contacts designated as VIPs for premium events", distributionListInfo: { internalNote: "Internal VIP tracking list" }, }); // Add contact to group await sdk.contacts.addContactToContactGroup({ id: group.id!, contactId: created[0].id!, }); // Merge duplicate contacts await sdk.contacts.mergeContacts({ sourceId: created[1].id!, targetId: created[0].id!, }); } run(); ``` --- ## Exhibitors — Manage Exhibitors and Categories Exhibitors are organizations sponsoring or exhibiting at an event. Use this API to manage exhibitor profiles, assign them to categories, manage sponsorship levels, and update their content (logos, banners, weblinks). ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/exhibitors:write event/exhibitors:read", }, }, }); async function run() { const eventId = "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3"; // Create exhibitor category const category = await sdk.exhibitor.createExhibitorCategory({ id: eventId, name: "Gold Sponsors", description: "Premier gold-level sponsors", }); // Create exhibitor const exhibitor = await sdk.exhibitor.createExhibitor({ event: { id: eventId }, name: "Acme Corp", website: "https://acme.example.com", category: { id: category.id! }, }); console.log("Exhibitor created:", exhibitor.id); // List exhibitors for the event const pages = await sdk.exhibitor.getExhibitors({ filter: `event.id eq '${eventId}'`, }); for await (const page of pages) { page.data?.forEach((ex) => console.log(ex.name, ex.id)); } // List sponsorship levels const levels = await sdk.exhibitor.getSponsorshipLevels({ id: eventId }); console.log("Sponsorship levels:", levels); } run(); ``` --- ## Housing — Manage Hotel Reservations via Passkey The Housing API (RegLink) integrates with Cvent Passkey to sync attendee data, check hotel availability, and manage room reservations. Requires a Passkey connection established with an access code. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "housing:read housing:write", }, }, }); async function run() { // Connect to Passkey event await sdk.housing.createConnection({ cventAccessCode: "PASSKEY-ACCESS-CODE" }); // Get housing event info const housingEvent = await sdk.housing.getHousingEventInfo({ eventId: "passkey-event-id" }); console.log("Hotels:", housingEvent.hotels?.length); // Check hotel availability const availability = await sdk.housing.getHousingEventHotelAvailability({ eventId: "passkey-event-id", hotelId: "hotel-uuid", checkIn: "2025-09-14", checkOut: "2025-09-17", }); console.log("Available rooms:", availability); // Create a reservation request (syncs attendee to Passkey) const request = await sdk.housing.createReservationRequest({ eventId: "passkey-event-id", attendeeId: "attendee-uuid", firstName: "Jane", lastName: "Smith", email: "jane.smith@example.com", checkIn: "2025-09-14", checkOut: "2025-09-17", }); console.log("Reservation request ID:", request.id); } run(); ``` --- ## Surveys — Create Respondents and Collect Responses The Surveys API covers both event-linked surveys and standalone surveys. It supports listing surveys and questions, managing respondents, and reading or submitting responses. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "surveys:read surveys:write", }, }, }); async function run() { const eventId = "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3"; // List event surveys const surveys = await sdk.surveys.getEventSurveys({ eventId }); const surveyId = surveys.data?.[0]?.id!; // List survey questions const questions = await sdk.surveys.getEventSurveyQuestions({ eventId, surveyId }); console.log("Questions:", questions.data?.map((q) => q.question)); // Create a respondent for the survey const respondent = await sdk.surveys.createEventSurveyRespondent({ eventId, surveyId, contactId: "contact-uuid", }); // Submit responses await sdk.surveys.createEventSurveyResponses({ eventId, surveyId, respondentId: respondent.id!, responses: [ { questionId: questions.data?.[0]?.id!, answer: "Very Satisfied" }, ], }); console.log("Survey response submitted"); // Retrieve all event survey responses const allResponses = await sdk.surveys.getAllEventSurveyResponses({ filter: `event.id eq '${eventId}'`, }); for await (const page of allResponses) { console.log("Responses on this page:", page.data?.length); } } run(); ``` --- ## Webcasts — Create and Manage Virtual Events The Webcasts API integrates external virtual event platforms (Zoom, etc.) into Cvent events and sessions, manages webcast lifecycle, and provides attendee join links. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/webcasts:write event/webcasts:read", }, }, }); async function run() { // Create webcast for a session const webcast = await sdk.webcasts.createWebcast({ event: { id: "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3" }, session: { id: "5faa1111-0dc3-487b-953e-86d6abbdf7d3" }, type: "Meeting", provider: "Zoom", format: "Live", playerType: "Cvent Video Player", title: "Keynote Live Stream", meetingId: "123ERt", links: { join: { href: "https://cvent.zoom.us/j/7566652259", code: "1456ZS78" }, host: { href: "https://cvent.zoom.us/j/7566652259", code: "HOST-CODE" }, }, }); console.log("Webcast created:", webcast.id); // Create attendee links (one per attendee) await sdk.webcasts.createAttendeeLinks({ webcastId: webcast.id!, attendeeId: "a1b2c3d4-0000-0000-0000-000000000001", joinLink: "https://cvent.zoom.us/j/7566652259?attendee=a1b2c3d4", }); // List all webcasts for an event const pages = await sdk.webcasts.listWebcasts({ filter: "event.id eq '04ca6ae2-0dc3-487b-953e-86d6abbdf7d3'", }); for await (const page of pages) { page.data?.forEach((w) => console.log(w.title, w.provider, w.status)); } } run(); ``` --- ## Bulk — Import Large Datasets The Bulk API allows uploading large volumes of data asynchronously. Create a job with the target endpoint and HTTP method, upload records as JSON, run the job, then poll for completion and retrieve per-item results. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "contacts/contacts:write", }, }, }); async function run() { // Create a bulk job (with inline data) const job = await sdk.bulk.createBulkJob({ description: "Q1 Contact Import", url: "/contacts/{id}", operation: "PUT", data: [ { pathParams: { id: "11111111-0dc3-487b-953e-86d6abbdf7d3" }, body: { firstName: "Alice", lastName: "Johnson", email: "alice@example.com" }, }, { pathParams: { id: "22222222-0dc3-487b-953e-86d6abbdf7d3" }, body: { firstName: "Bob", lastName: "Williams", email: "bob@example.com" }, }, ], }); console.log("Bulk job created:", job.id, "Status:", job.status); // Poll until complete let status; do { await new Promise((r) => setTimeout(r, 3000)); status = await sdk.bulk.getBulkJobById({ id: job.id! }); console.log("Job status:", status.status); } while (status.status !== "Completed" && status.status !== "Failed"); // Retrieve results const results = await sdk.bulk.listBulkJobResult({ id: job.id! }); for await (const page of results) { page.data?.forEach((r) => console.log(`Item ${r.index}: ${r.statusCode} ${r.message}`) ); } } run(); ``` --- ## Hooks — Contact Webhooks Contact hooks notify your service when contact data changes. Create hooks pointing to your endpoint URL, and Cvent will send a request with updated contact data when changes occur. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "contacts/hooks:write contacts/hooks:read", }, }, }); async function run() { // Create a contact hook const hook = await sdk.hooks.createContactHook({ name: "My Contact Sync Integration", url: "https://my-service.example.com/webhooks/cvent-contacts", events: ["contact.created", "contact.updated", "contact.deleted"], active: true, }); console.log("Hook created:", hook.id); // List all hooks const pages = await sdk.hooks.listContactHooks({ filter: "name ne 'OldIntegration'", }); for await (const page of pages) { page.data?.forEach((h) => console.log(h.name, h.url, h.active)); } // Update a hook await sdk.hooks.updateContactHook({ id: hook.id!, active: false }); // Delete a hook await sdk.hooks.deleteContactHook({ id: hook.id! }); console.log("Hook deleted"); } run(); ``` --- ## Audience Segments — Group Attendees Dynamically Audience segments allow event planners to group attendees for targeted communications or features. Use this API to create segments, manage their membership, and associate or disassociate individual attendees. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/attendees:write", }, }, }); async function run() { const eventId = "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3"; // Create segment const segment = await sdk.audienceSegments.createAudienceSegment({ eventId, name: "VIP Attendees", description: "Premium registrants with access to exclusive sessions", }); console.log("Segment created:", segment.id); // Associate an attendee to the segment await sdk.audienceSegments.associateAttendeeToSegment({ segmentId: segment.id!, attendeeId: "a1b2c3d4-0000-0000-0000-000000000001", }); // List attendees in segment const attendees = await sdk.audienceSegments.listSegmentAssociatedAttendees({ segmentId: segment.id!, }); for await (const page of attendees) { console.log("Segment members:", page.data?.length); } // Disassociate attendee await sdk.audienceSegments.disassociateAttendeeFromAudienceSegment({ segmentId: segment.id!, attendeeId: "a1b2c3d4-0000-0000-0000-000000000001", }); } run(); ``` --- ## Users — SCIM User and Group Management The UserSCIM API provides SCIM 2.0-compliant user provisioning. The Users API manages account-level user groups, including creating groups, assigning users, and listing group memberships. ```typescript import { CventSDK } from "@cvent/sdk"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "account/users:write account/users:read", }, }, }); async function run() { // Create a user group const group = await sdk.users.createAccountUserGroup({ name: "Event Planners", description: "Staff who manage event logistics", }); console.log("Group created:", group.id); // Add a user to the group await sdk.users.addUserToAccountUserGroup({ id: group.id!, userId: "user-uuid-1234", }); // List all user groups with pagination const pages = await sdk.users.getAccountUserGroups({ filter: "name eq 'Event Planners'", }); for await (const page of pages) { page.data?.forEach((g) => console.log(g.name, g.id)); } // SCIM: Provision a new user const user = await sdk.userSCIM.createUser({ userName: "jane.smith@example.com", name: { givenName: "Jane", familyName: "Smith" }, emails: [{ value: "jane.smith@example.com", primary: true }], active: true, }); console.log("SCIM user created:", user.id); } run(); ``` --- ## Error Handling All SDK methods throw `CventSDKError` (or a subclass) on HTTP errors. Structured error details are available on the `data$` property of `ErrorResponse` instances. ```typescript import { CventSDK } from "@cvent/sdk"; import * as errors from "@cvent/sdk/models/errors"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/events:read", }, }, }); async function run() { try { const event = await sdk.events.getEventById({ id: "non-existent-uuid" }); console.log(event); } catch (error) { if (error instanceof errors.CventSDKError) { console.error("HTTP Status:", error.statusCode); // e.g. 404 console.error("Message:", error.message); console.error("Body:", error.body); if (error instanceof errors.ErrorResponse) { console.error("Error Code:", error.data$.code); console.error("Error Details:", error.data$.details); } } else { throw error; } } } run(); ``` --- ## Retries — Per-Call and Global Retry Configuration Configure exponential backoff retries on individual calls or globally at SDK initialization to handle transient network errors automatically. ```typescript import { CventSDK } from "@cvent/sdk"; // Global retry strategy const sdk = new CventSDK({ retryConfig: { strategy: "backoff", backoff: { initialInterval: 500, maxInterval: 30000, exponent: 1.5, maxElapsedTime: 120000, }, retryConnectionErrors: true, }, security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/events:read", }, }, }); async function run() { // Per-call override const pages = await sdk.events.getEvents( { filter: "status eq 'Active'" }, { retries: { strategy: "backoff", backoff: { initialInterval: 1000, maxInterval: 60000, exponent: 2, maxElapsedTime: 300000 }, retryConnectionErrors: false, }, } ); for await (const page of pages) { console.log(page.data?.length, "events"); } } run(); ``` --- ## File Uploads — Stream Files to Cvent Upload files to Cvent using the File API. Use streaming to avoid loading large files into memory. ```typescript import { CventSDK } from "@cvent/sdk"; import { openAsBlob } from "node:fs"; const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "files:write", }, }, }); async function run() { // Upload a file as a stream (avoids loading entire file into memory) const result = await sdk.file.uploadFile({ file: await openAsBlob("./event-agenda.pdf"), }); console.log("File location:", result.location); // Retrieve file metadata / CDN URL const fileInfo = await sdk.file.getFile({ id: result.id! }); console.log("Download URL:", fileInfo.url); } run(); ``` --- ## Java SDK — Synchronous and Async Usage The Java SDK supports synchronous pagination via `callAsStream()` and reactive (Project Reactor) async via `callAsPublisher()`. ```java import com.cvent.CventSDK; import com.cvent.AsyncCventSDK; import com.cvent.models.components.SchemeOAuth2ClientCredentials; import com.cvent.models.components.Security; import com.cvent.models.operations.GetAccountUserGroupsRequest; import com.cvent.models.operations.GetAccountUserGroupsResponse; import java.util.List; import reactor.core.publisher.Flux; public class CventExample { public static void main(String[] args) { // Synchronous (streaming pages) CventSDK sdk = CventSDK.builder() .security(Security.builder() .oAuth2ClientCredentials(SchemeOAuth2ClientCredentials.builder() .clientID(System.getenv("CVENT_CLIENT_ID")) .clientSecret(System.getenv("CVENT_CLIENT_SECRET")) .tokenURL("https://api-platform.cvent.com/ea/oauth2/token") .scopes(List.of("event/events:read", "contacts/contacts:read")) .build()) .build()) .build(); GetAccountUserGroupsRequest req = GetAccountUserGroupsRequest.builder() .token("1a2b3c4d5e6f7g8h9i10j11k") .filter("name eq 'My User Group'") .build(); sdk.users().getAccountUserGroups().callAsStream() .forEach((GetAccountUserGroupsResponse page) -> System.out.println(page)); // Asynchronous (Project Reactor) AsyncCventSDK asyncSdk = sdk.async(); Flux.from(asyncSdk.users().getAccountUserGroups().callAsPublisher()) .subscribe( page -> System.out.println("Page: " + page), error -> error.printStackTrace(), () -> System.out.println("All pages loaded") ); } } ``` --- ## C# SDK — Paginated Calls The C# SDK exposes async methods that return paginated responses using a `Next()` delegate pattern. ```csharp using Cvent.SDK; using Cvent.SDK.Models.Components; using Cvent.SDK.Models.Requests; var sdk = new CventSDK(security: new Security() { OAuth2ClientCredentials = new SchemeOAuth2ClientCredentials() { ClientID = Environment.GetEnvironmentVariable("CVENT_CLIENT_ID"), ClientSecret = Environment.GetEnvironmentVariable("CVENT_CLIENT_SECRET"), TokenURL = "https://api-platform.cvent.com/ea/oauth2/token", Scopes = "event/events:read contacts/contacts:read", }, }); // Paginate through all user groups var req = new GetAccountUserGroupsRequest { Token = "1a2b3c4d5e6f7g8h9i10j11k", Filter = "name eq 'My User Group'", }; GetAccountUserGroupsResponse? res = await sdk.Users.GetAccountUserGroupsAsync(req); while (res != null) { foreach (var group in res.Data ?? new List()) { Console.WriteLine($"Group: {group.Name} (ID: {group.Id})"); } res = await res.Next!(); } // Create a contact group in C# var groupReq = new CreateContactGroupRequest { Name = "Premium Members", ShortDescription = "VIP contacts for premium events", }; var groupRes = await sdk.Contacts.CreateContactGroupAsync(groupReq); Console.WriteLine($"Created contact group: {groupRes.Id}"); ``` --- ## Standalone Functions — Tree-Shaking for Browsers and Serverless The TypeScript SDK exposes every method as a standalone function importable from `@cvent/sdk/funcs/*`, enabling optimal tree-shaking for browser or serverless deployments. Use `CventSDKCore` as a lightweight shared client. ```typescript import { CventSDKCore } from "@cvent/sdk/core.js"; import { eventsGetEvents } from "@cvent/sdk/funcs/eventsGetEvents.js"; import { attendeesCreateAttendee } from "@cvent/sdk/funcs/attendeesCreateAttendee.js"; import { surveysGetAllEventSurveyResponses } from "@cvent/sdk/funcs/surveysGetAllEventSurveyResponses.js"; const sdk = new CventSDKCore({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/events:read event/attendees:write surveys:read", }, }, }); async function run() { // List events const eventsRes = await eventsGetEvents(sdk, { filter: "status eq 'Active'" }); if (!eventsRes.ok) { console.error("Failed to list events:", eventsRes.error); return; } for await (const page of eventsRes.value) { console.log("Events:", page.data?.length); } // Create attendee const attendeeRes = await attendeesCreateAttendee(sdk, { eventId: "04ca6ae2-0dc3-487b-953e-86d6abbdf7d3", firstName: "Jane", lastName: "Doe", email: "jane@example.com", }); if (attendeeRes.ok) { console.log("New attendee:", attendeeRes.value.id); } // Survey responses const responsesRes = await surveysGetAllEventSurveyResponses(sdk, { filter: "event.id eq '04ca6ae2-0dc3-487b-953e-86d6abbdf7d3'", }); if (responsesRes.ok) { for await (const page of responsesRes.value) { console.log("Survey responses:", page.data?.length); } } } run(); ``` --- ## Custom HTTP Client — Proxies, Timeouts, and Hooks The TypeScript SDK's `HTTPClient` wraps the native Fetch API and exposes `beforeRequest` and `requestError` hooks for adding headers, setting timeouts, routing through proxies, or logging. ```typescript import { CventSDK } from "@cvent/sdk"; import { HTTPClient } from "@cvent/sdk/lib/http"; import { ProxyAgent } from "undici"; const dispatcher = new ProxyAgent("http://proxy.example.com:8080"); const httpClient = new HTTPClient({ fetcher: (input, init) => fetch(input, { ...init, dispatcher } as RequestInit), }); // Add a 10-second timeout and a custom trace header to every request httpClient.addHook("beforeRequest", (request) => { const next = new Request(request, { signal: request.signal || AbortSignal.timeout(10_000), }); next.headers.set("x-trace-id", crypto.randomUUID()); return next; }); // Log all request errors httpClient.addHook("requestError", (error, request) => { console.error(`[${request.method}] ${request.url} failed:`, error.message); }); const sdk = new CventSDK({ httpClient, debugLogger: process.env.NODE_ENV === "development" ? console : undefined, security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "event/events:read", }, }, }); ``` --- ## Server Selection — US and EU Regions The SDK defaults to the US API endpoint. Switch to the EU endpoint by index (`serverIdx: 1`) or by providing the full URL string. ```typescript import { CventSDK } from "@cvent/sdk"; // EU region by index const sdkEU = new CventSDK({ serverIdx: 1, // https://api-platform-eur.cvent.com/ea security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform-eur.cvent.com/ea/oauth2/token", scopes: "event/events:read", }, }, }); // EU region by URL string const sdkEUbyURL = new CventSDK({ serverURL: "https://api-platform-eur.cvent.com/ea", security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform-eur.cvent.com/ea/oauth2/token", scopes: "event/events:read", }, }, }); // Per-operation server override (e.g., for card tokenization) const sdk = new CventSDK({ security: { oAuth2ClientCredentials: { clientID: process.env["CVENTSDK_CLIENT_ID"] ?? "", clientSecret: process.env["CVENTSDK_CLIENT_SECRET"] ?? "", tokenURL: "https://api-platform.cvent.com/ea/oauth2/token", scopes: "payments:write", }, }, }); const token = await sdk.cardTokens.createCardTokens( { creditCard: { accountHolderName: "John Doe", expMonth: 11, expYear: 2026, cvv: "123", number: "4111111111111111", addressCity: "McLean", addressStateProvince: "VA", addressPostalCode: "12345", addressCountry: "USA", }, }, { serverURL: "https://secure-ecommerce.api-platform.cvent.com/ea" } ); console.log("Card token:", token); ``` --- The Cvent REST API SDKs are purpose-built for enterprise event management integrations. The primary use cases include: automating event creation and attendee registration from external CRM or HR systems; synchronizing contact and attendee data bidirectionally between Cvent and external databases via the Contacts, Attendees, and Bulk APIs; building custom attendee portals that retrieve session schedules, speaker bios, and exhibitor directories; integrating housing and hotel reservations with the Passkey RegLink API; and monitoring engagement metrics via attendance durations, survey responses, and attendee insights. Integration patterns follow a consistent structure across all three SDKs: OAuth2 credentials are set once at client initialization, all list endpoints return async paginated iterators (TypeScript `for await`, Java `callAsStream()`, C# `Next()`), and mutation operations (create/update/delete) are single-call async methods. For high-throughput data migrations, the Bulk API is the recommended pattern — create a job, upload batches of records, run the job, then poll for results. For real-time event-driven architectures, the Hooks API delivers contact change notifications to any publicly accessible HTTPS endpoint. All SDKs support configurable retry strategies and custom HTTP middleware, making them suitable for both serverless microservices and long-running backend applications.