# Viewer # Studies ## Create `client.viewer.studies.create(StudyCreateParamsbody, RequestOptionsoptions?): StudyCreateResponse` **post** `/v1/viewer/studies` Creates a new study in the Viewer system with the specified DICOM Study Instance UID and metadata. The study can be optionally assigned to a user. ### Parameters - `body: StudyCreateParams` - `severity: "normal" | "high" | "stat"` Priority level of the study. 'normal' for routine, 'high' for urgent, 'stat' for immediate attention - `"normal"` - `"high"` - `"stat"` - `studyDescription: string` Description of the study/scan (e.g., 'Brain MRI with Contrast', 'Chest CT') - `studyInstanceUid: string` DICOM Study Instance UID. Must be a valid DICOM UID format (e.g., '1.2.840.10008.5.1.4.1.1.2') - `assignedTo?: string` User ID to assign the study to. Format: usr_{32-hex-chars} - `expressCustomerId?: string` Express customer ID for the study. Format: cus_{32-hex-chars} - `metadata?: Record` Custom key-value metadata for the study. Maximum 50 pairs, keys up to 100 chars, values up to 1000 chars ### Returns - `StudyCreateResponse` A study entity in the Viewer system with viewing status - `cancelledAt: string | null` Timestamp when the study was cancelled, null if not cancelled - `createdAt: string | null` Timestamp when the study was created - `isCancelled: boolean` Whether the study has been cancelled - `severity: "normal" | "high" | "stat"` Priority level of the study. 'normal' for routine, 'high' for urgent, 'stat' for immediate attention - `"normal"` - `"high"` - `"stat"` - `studyDescription: string` Description of the study/scan (e.g., 'Brain MRI with Contrast', 'Chest CT') - `studyId: string` Unique study identifier. Format: stu_{32-hex-chars} - `studyInstanceUid: string` DICOM Study Instance UID. Must be a valid DICOM UID format (e.g., '1.2.840.10008.5.1.4.1.1.2') - `studyViewerStatus: "incomplete" | "complete"` - `"incomplete"` - `"complete"` - `updatedAt: string | null` Timestamp when the study was last updated - `assignedTo?: UserReference | null` A reference to a user with basic identifying information - `email: string` User's email address - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `firstName?: string` User's first name - `lastName?: string` User's last name - `middleName?: string` User's middle name - `suffix1?: string` Name suffix (e.g., 'MD', 'Jr.') - `suffix2?: string` Additional name suffix - `createdByApiKey?: APIKeyReference | null` A reference to an API key with basic identifying information - `apiKeyId: string` Unique API key identifier (UUIDv4 format) - `description: string` Human-readable description of the API key - `isViewerEnabled?: boolean` Whether this API key has access to the Viewer product - `createdByUser?: UserReference | null` A reference to a user with basic identifying information - `email: string` User's email address - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `firstName?: string` User's first name - `lastName?: string` User's last name - `middleName?: string` User's middle name - `suffix1?: string` Name suffix (e.g., 'MD', 'Jr.') - `suffix2?: string` Additional name suffix - `expressCustomer?: ExpressCustomerReference | null` A reference to an Express customer with basic identifying information - `expressCustomerId: string` Unique Express customer identifier. Format: cus_{32-hex-chars} - `expressCustomerName: string` Name of the Express customer - `metadata?: Record` Custom key-value metadata for the study. Maximum 50 pairs, keys up to 100 chars, values up to 1000 chars ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const study = await client.viewer.studies.create({ severity: 'high', studyDescription: 'CT Chest/Abdomen/Pelvis', studyInstanceUid: '1.2.840.113619.2.55.3.604688119.868.1234567890.123', }); console.log(study.studyInstanceUid); ``` ## List `client.viewer.studies.list(StudyListParamsquery?, RequestOptionsoptions?): CursorStudies` **get** `/v1/viewer/studies` Retrieves a paginated list of studies with optional filtering by assignment, severity, description, cancellation status, and viewer status. Returns up to 100 studies per request. ### Parameters - `query: StudyListParams` - `assignedTo?: string | null` Filter by assigned user ID (null = explicitly unassigned). Format: usr_<32-hex-chars> - `cursor?: string` Base64 encoded cursor from previous response - `expressCustomerId?: string | null` Filter by Express customer ID (null = studies with no customer). Format: cus_{32-hex-chars} - `isCancelled?: boolean | null` Filter by cancellation status - `limit?: number` Number of results to return (1-100) - `severity?: "normal" | "high" | "stat"` Filter by study severity - `"normal"` - `"high"` - `"stat"` - `studyDescription?: string` Filter by study description (contains match) - `studyViewerStatus?: "incomplete" | "complete"` Filter by study viewer status - `"incomplete"` - `"complete"` ### Returns - `StudyListResponse` A study entity in the Viewer system with viewing status - `cancelledAt: string | null` Timestamp when the study was cancelled, null if not cancelled - `createdAt: string | null` Timestamp when the study was created - `isCancelled: boolean` Whether the study has been cancelled - `severity: "normal" | "high" | "stat"` Priority level of the study. 'normal' for routine, 'high' for urgent, 'stat' for immediate attention - `"normal"` - `"high"` - `"stat"` - `studyDescription: string` Description of the study/scan (e.g., 'Brain MRI with Contrast', 'Chest CT') - `studyId: string` Unique study identifier. Format: stu_{32-hex-chars} - `studyInstanceUid: string` DICOM Study Instance UID. Must be a valid DICOM UID format (e.g., '1.2.840.10008.5.1.4.1.1.2') - `studyViewerStatus: "incomplete" | "complete"` - `"incomplete"` - `"complete"` - `updatedAt: string | null` Timestamp when the study was last updated - `assignedTo?: UserReference | null` A reference to a user with basic identifying information - `email: string` User's email address - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `firstName?: string` User's first name - `lastName?: string` User's last name - `middleName?: string` User's middle name - `suffix1?: string` Name suffix (e.g., 'MD', 'Jr.') - `suffix2?: string` Additional name suffix - `createdByApiKey?: APIKeyReference | null` A reference to an API key with basic identifying information - `apiKeyId: string` Unique API key identifier (UUIDv4 format) - `description: string` Human-readable description of the API key - `isViewerEnabled?: boolean` Whether this API key has access to the Viewer product - `createdByUser?: UserReference | null` A reference to a user with basic identifying information - `email: string` User's email address - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `firstName?: string` User's first name - `lastName?: string` User's last name - `middleName?: string` User's middle name - `suffix1?: string` Name suffix (e.g., 'MD', 'Jr.') - `suffix2?: string` Additional name suffix - `expressCustomer?: ExpressCustomerReference | null` A reference to an Express customer with basic identifying information - `expressCustomerId: string` Unique Express customer identifier. Format: cus_{32-hex-chars} - `expressCustomerName: string` Name of the Express customer - `metadata?: Record` Custom key-value metadata for the study. Maximum 50 pairs, keys up to 100 chars, values up to 1000 chars ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const studyListResponse of client.viewer.studies.list()) { console.log(studyListResponse.studyInstanceUid); } ``` ## Retrieve `client.viewer.studies.retrieve(stringstudyID, RequestOptionsoptions?): StudyRetrieveResponse` **get** `/v1/viewer/studies/{studyId}` Retrieves a single study by its unique study ID. Returns the complete study object with all metadata and status information. ### Parameters - `studyID: string` Unique study identifier. Format: stu_{32-hex-chars} ### Returns - `StudyRetrieveResponse` A study entity in the Viewer system with viewing status - `cancelledAt: string | null` Timestamp when the study was cancelled, null if not cancelled - `createdAt: string | null` Timestamp when the study was created - `isCancelled: boolean` Whether the study has been cancelled - `severity: "normal" | "high" | "stat"` Priority level of the study. 'normal' for routine, 'high' for urgent, 'stat' for immediate attention - `"normal"` - `"high"` - `"stat"` - `studyDescription: string` Description of the study/scan (e.g., 'Brain MRI with Contrast', 'Chest CT') - `studyId: string` Unique study identifier. Format: stu_{32-hex-chars} - `studyInstanceUid: string` DICOM Study Instance UID. Must be a valid DICOM UID format (e.g., '1.2.840.10008.5.1.4.1.1.2') - `studyViewerStatus: "incomplete" | "complete"` - `"incomplete"` - `"complete"` - `updatedAt: string | null` Timestamp when the study was last updated - `assignedTo?: UserReference | null` A reference to a user with basic identifying information - `email: string` User's email address - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `firstName?: string` User's first name - `lastName?: string` User's last name - `middleName?: string` User's middle name - `suffix1?: string` Name suffix (e.g., 'MD', 'Jr.') - `suffix2?: string` Additional name suffix - `createdByApiKey?: APIKeyReference | null` A reference to an API key with basic identifying information - `apiKeyId: string` Unique API key identifier (UUIDv4 format) - `description: string` Human-readable description of the API key - `isViewerEnabled?: boolean` Whether this API key has access to the Viewer product - `createdByUser?: UserReference | null` A reference to a user with basic identifying information - `email: string` User's email address - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `firstName?: string` User's first name - `lastName?: string` User's last name - `middleName?: string` User's middle name - `suffix1?: string` Name suffix (e.g., 'MD', 'Jr.') - `suffix2?: string` Additional name suffix - `expressCustomer?: ExpressCustomerReference | null` A reference to an Express customer with basic identifying information - `expressCustomerId: string` Unique Express customer identifier. Format: cus_{32-hex-chars} - `expressCustomerName: string` Name of the Express customer - `metadata?: Record` Custom key-value metadata for the study. Maximum 50 pairs, keys up to 100 chars, values up to 1000 chars ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const study = await client.viewer.studies.retrieve('stu_1234567890abcdef1234567890abcdef'); console.log(study.studyInstanceUid); ``` ## Update `client.viewer.studies.update(stringstudyID, StudyUpdateParamsbody?, RequestOptionsoptions?): StudyUpdateResponse` **patch** `/v1/viewer/studies/{studyId}` Updates a study's properties including description, severity, assignment, organization, and metadata. All fields are optional - only provided fields will be updated. ### Parameters - `studyID: string` Unique study identifier. Format: stu_{32-hex-chars} - `body: StudyUpdateParams` - `assignedTo?: string` User ID to assign the study to, or null to unassign. Format: usr_{32-hex-chars} - `metadata?: Record | null` - `severity?: "normal" | "high" | "stat"` Priority level of the study. 'normal' for routine, 'high' for urgent, 'stat' for immediate attention - `"normal"` - `"high"` - `"stat"` - `studyDescription?: string` Description of the study/scan (e.g., 'Brain MRI with Contrast', 'Chest CT') - `studyViewerStatus?: "incomplete" | "complete"` - `"incomplete"` - `"complete"` ### Returns - `StudyUpdateResponse` A study entity in the Viewer system with viewing status - `cancelledAt: string | null` Timestamp when the study was cancelled, null if not cancelled - `createdAt: string | null` Timestamp when the study was created - `isCancelled: boolean` Whether the study has been cancelled - `severity: "normal" | "high" | "stat"` Priority level of the study. 'normal' for routine, 'high' for urgent, 'stat' for immediate attention - `"normal"` - `"high"` - `"stat"` - `studyDescription: string` Description of the study/scan (e.g., 'Brain MRI with Contrast', 'Chest CT') - `studyId: string` Unique study identifier. Format: stu_{32-hex-chars} - `studyInstanceUid: string` DICOM Study Instance UID. Must be a valid DICOM UID format (e.g., '1.2.840.10008.5.1.4.1.1.2') - `studyViewerStatus: "incomplete" | "complete"` - `"incomplete"` - `"complete"` - `updatedAt: string | null` Timestamp when the study was last updated - `assignedTo?: UserReference | null` A reference to a user with basic identifying information - `email: string` User's email address - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `firstName?: string` User's first name - `lastName?: string` User's last name - `middleName?: string` User's middle name - `suffix1?: string` Name suffix (e.g., 'MD', 'Jr.') - `suffix2?: string` Additional name suffix - `createdByApiKey?: APIKeyReference | null` A reference to an API key with basic identifying information - `apiKeyId: string` Unique API key identifier (UUIDv4 format) - `description: string` Human-readable description of the API key - `isViewerEnabled?: boolean` Whether this API key has access to the Viewer product - `createdByUser?: UserReference | null` A reference to a user with basic identifying information - `email: string` User's email address - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `firstName?: string` User's first name - `lastName?: string` User's last name - `middleName?: string` User's middle name - `suffix1?: string` Name suffix (e.g., 'MD', 'Jr.') - `suffix2?: string` Additional name suffix - `expressCustomer?: ExpressCustomerReference | null` A reference to an Express customer with basic identifying information - `expressCustomerId: string` Unique Express customer identifier. Format: cus_{32-hex-chars} - `expressCustomerName: string` Name of the Express customer - `metadata?: Record` Custom key-value metadata for the study. Maximum 50 pairs, keys up to 100 chars, values up to 1000 chars ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const study = await client.viewer.studies.update('stu_1234567890abcdef1234567890abcdef'); console.log(study.studyInstanceUid); ``` ## Cancel `client.viewer.studies.cancel(StudyCancelParamsbody?, RequestOptionsoptions?): StudyCancelResponse` **post** `/v1/viewer/studies/cancel` Marks a study as cancelled. Cancelled studies are preserved but flagged as inactive. Can be identified by either study ID or DICOM Study Instance UID. ### Parameters - `body: StudyCancelParams` - `studyId?: string` Unique study identifier. Format: stu_{32-hex-chars} - `studyInstanceUid?: string` DICOM Study Instance UID. Must be a valid DICOM UID format (e.g., '1.2.840.10008.5.1.4.1.1.2') ### Returns - `StudyCancelResponse` Response for cancelling a study in Viewer - `success: boolean` - `message?: string` ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const response = await client.viewer.studies.cancel(); console.log(response.success); ``` ## Uncancel `client.viewer.studies.uncancel(StudyUncancelParamsbody?, RequestOptionsoptions?): StudyUncancelResponse` **post** `/v1/viewer/studies/uncancel` Restores a cancelled study to active status. The study must have been previously cancelled. Can be identified by either study ID or DICOM Study Instance UID. ### Parameters - `body: StudyUncancelParams` - `studyId?: string` Unique study identifier. Format: stu_{32-hex-chars} - `studyInstanceUid?: string` DICOM Study Instance UID. Must be a valid DICOM UID format (e.g., '1.2.840.10008.5.1.4.1.1.2') ### Returns - `StudyUncancelResponse` Response for uncancelling a study in Viewer - `success: boolean` - `message?: string` ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const response = await client.viewer.studies.uncancel(); console.log(response.success); ``` ## Reroute URL `client.viewer.studies.rerouteURL(StudyRerouteURLParamsbody?, RequestOptionsoptions?): StudyRerouteURLResponse` **post** `/v1/viewer/studies/reroute-url` Generates a tokenized URL that redirects users directly to the Avara Viewer for the specified study. The URL includes authentication and is time-limited for security. ### Parameters - `body: StudyRerouteURLParams` - `studyId?: string` Unique study identifier. Format: stu_{32-hex-chars} - `studyInstanceUid?: string` DICOM Study Instance UID. Must be a valid DICOM UID format (e.g., '1.2.840.10008.5.1.4.1.1.2') ### Returns - `StudyRerouteURLResponse` Response containing the generated reroute URL for a study in Viewer - `url: string` ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const response = await client.viewer.studies.rerouteURL(); console.log(response.url); ``` ## Retrieve By Uid `client.viewer.studies.retrieveByUid(stringstudyInstanceUid, RequestOptionsoptions?): StudyRetrieveByUidResponse` **get** `/v1/viewer/studies/by-uid/{studyInstanceUid}` Retrieves a single study by its DICOM Study Instance UID. This is useful when you have the DICOM UID but not the Avara study ID. ### Parameters - `studyInstanceUid: string` DICOM Study Instance UID. Format: numbers and dots (e.g., 1.2.840.10008.5.1.4.1.1.2). ### Returns - `StudyRetrieveByUidResponse` A study entity in the Viewer system with viewing status - `cancelledAt: string | null` Timestamp when the study was cancelled, null if not cancelled - `createdAt: string | null` Timestamp when the study was created - `isCancelled: boolean` Whether the study has been cancelled - `severity: "normal" | "high" | "stat"` Priority level of the study. 'normal' for routine, 'high' for urgent, 'stat' for immediate attention - `"normal"` - `"high"` - `"stat"` - `studyDescription: string` Description of the study/scan (e.g., 'Brain MRI with Contrast', 'Chest CT') - `studyId: string` Unique study identifier. Format: stu_{32-hex-chars} - `studyInstanceUid: string` DICOM Study Instance UID. Must be a valid DICOM UID format (e.g., '1.2.840.10008.5.1.4.1.1.2') - `studyViewerStatus: "incomplete" | "complete"` - `"incomplete"` - `"complete"` - `updatedAt: string | null` Timestamp when the study was last updated - `assignedTo?: UserReference | null` A reference to a user with basic identifying information - `email: string` User's email address - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `firstName?: string` User's first name - `lastName?: string` User's last name - `middleName?: string` User's middle name - `suffix1?: string` Name suffix (e.g., 'MD', 'Jr.') - `suffix2?: string` Additional name suffix - `createdByApiKey?: APIKeyReference | null` A reference to an API key with basic identifying information - `apiKeyId: string` Unique API key identifier (UUIDv4 format) - `description: string` Human-readable description of the API key - `isViewerEnabled?: boolean` Whether this API key has access to the Viewer product - `createdByUser?: UserReference | null` A reference to a user with basic identifying information - `email: string` User's email address - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `firstName?: string` User's first name - `lastName?: string` User's last name - `middleName?: string` User's middle name - `suffix1?: string` Name suffix (e.g., 'MD', 'Jr.') - `suffix2?: string` Additional name suffix - `expressCustomer?: ExpressCustomerReference | null` A reference to an Express customer with basic identifying information - `expressCustomerId: string` Unique Express customer identifier. Format: cus_{32-hex-chars} - `expressCustomerName: string` Name of the Express customer - `metadata?: Record` Custom key-value metadata for the study. Maximum 50 pairs, keys up to 100 chars, values up to 1000 chars ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const response = await client.viewer.studies.retrieveByUid('1.2.840.10008.5.1.4.1.1.2'); console.log(response.studyInstanceUid); ``` # Users ## Invite `client.viewer.users.invite(UserInviteParamsbody, RequestOptionsoptions?): UserInviteResponse` **post** `/v1/viewer/users` Creates a new user in the Viewer system and sends them an invitation email. The user will have the specified permissions and access level. Dashboard access can be enabled to allow login. ### Parameters - `body: UserInviteParams` - `canManageStudies: boolean` - `clinicRole: "Radiologist" | "Cardiologist" | "Neurologist" | 18 more` User's clinical or organizational role - `"Radiologist"` - `"Cardiologist"` - `"Neurologist"` - `"Urologist"` - `"Gynecologist"` - `"Endocrinologist"` - `"Doctor"` - `"Surgeon"` - `"Physician"` - `"Physician Assistant"` - `"Nurse Practitioner"` - `"Registered Nurse"` - `"Patient Care Coordinator"` - `"Front Desk Operator"` - `"Imaging Technologist"` - `"PACS Administrator"` - `"Software Engineer"` - `"Revenue Cycle Manager"` - `"Administrative Director"` - `"Administrative Assistant"` - `"Other"` - `email: string` User's email address for login and notifications - `firstName: string` User's first name - `hasDashboardAccess: boolean` - `lastName: string` User's last name - `level: "admin" | "member"` - `"admin"` - `"member"` - `middleName?: string` User's middle name (optional) - `phoneNumber?: string` User's phone number (10-15 digits, optional) - `suffix1?: string` Name suffix (e.g., 'Jr.', 'Sr.', 'III') - optional - `suffix2?: string` Additional name suffix (optional) ### Returns - `UserInviteResponse` Response for inviting a user to Viewer. Level is restricted to admin/member since owners cannot be invited via API. - `canManageStudies: boolean` Whether the user has permission to create, update, and manage studies - `clinicRole: "Radiologist" | "Cardiologist" | "Neurologist" | 18 more` User's clinical or organizational role - `"Radiologist"` - `"Cardiologist"` - `"Neurologist"` - `"Urologist"` - `"Gynecologist"` - `"Endocrinologist"` - `"Doctor"` - `"Surgeon"` - `"Physician"` - `"Physician Assistant"` - `"Nurse Practitioner"` - `"Registered Nurse"` - `"Patient Care Coordinator"` - `"Front Desk Operator"` - `"Imaging Technologist"` - `"PACS Administrator"` - `"Software Engineer"` - `"Revenue Cycle Manager"` - `"Administrative Director"` - `"Administrative Assistant"` - `"Other"` - `createdAt: string | null` Timestamp when the user was created - `email: string` User's email address for login and notifications - `firstName: string` User's first name - `hasDashboardAccess: boolean` Whether the user can access the dashboard interface. Required for admin users - `invitedSource: "dashboard" | "api"` How the user was invited - via dashboard UI or API - `"dashboard"` - `"api"` - `lastLoginAt: string | null` Timestamp of user's last login, null if never logged in - `lastName: string` User's last name - `level: "admin" | "member"` User access level. 'admin' can manage users/settings, 'member' has standard access - `"admin"` - `"member"` - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `middleName?: string` User's middle name (optional) - `phoneNumber?: string` User's phone number (10-15 digits, optional) - `suffix1?: string` Name suffix (e.g., 'Jr.', 'Sr.', 'III') - optional - `suffix2?: string` Additional name suffix (optional) ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const response = await client.viewer.users.invite({ canManageStudies: true, clinicRole: 'Radiologist', email: 'dr.johnson@hospital.org', firstName: 'Sarah', hasDashboardAccess: true, lastName: 'Johnson', level: 'member', }); console.log(response.middleName); ``` ## List `client.viewer.users.list(UserListParamsquery?, RequestOptionsoptions?): CursorUsers` **get** `/v1/viewer/users` Retrieves a paginated list of users with optional filtering by access level, email, name, and invitation source. Returns up to 100 users per request. ### Parameters - `query: UserListParams` - `cursor?: string` Base64 encoded cursor from previous response - `email?: string` Filter by exact email match - `firstName?: string` Filter by first name (contains match) - `invitedSource?: "dashboard" | "api"` Filter by invitation source - `"dashboard"` - `"api"` - `lastName?: string` Filter by last name (contains match) - `level?: "owner" | "admin" | "member"` Filter by user level - `"owner"` - `"admin"` - `"member"` - `limit?: number` Number of results to return (1-100) ### Returns - `UserListResponse` A user in the Viewer system with study management permissions - `canManageStudies: boolean` Whether the user has permission to create, update, and manage studies - `clinicRole: "Radiologist" | "Cardiologist" | "Neurologist" | 18 more` User's clinical or organizational role - `"Radiologist"` - `"Cardiologist"` - `"Neurologist"` - `"Urologist"` - `"Gynecologist"` - `"Endocrinologist"` - `"Doctor"` - `"Surgeon"` - `"Physician"` - `"Physician Assistant"` - `"Nurse Practitioner"` - `"Registered Nurse"` - `"Patient Care Coordinator"` - `"Front Desk Operator"` - `"Imaging Technologist"` - `"PACS Administrator"` - `"Software Engineer"` - `"Revenue Cycle Manager"` - `"Administrative Director"` - `"Administrative Assistant"` - `"Other"` - `createdAt: string | null` Timestamp when the user was created - `email: string` User's email address for login and notifications - `firstName: string` User's first name - `hasDashboardAccess: boolean` Whether the user can access the dashboard interface. Required for admin users - `invitedSource: "dashboard" | "api"` How the user was invited - via dashboard UI or API - `"dashboard"` - `"api"` - `lastLoginAt: string | null` Timestamp of user's last login, null if never logged in - `lastName: string` User's last name - `level: "owner" | "admin" | "member"` User access level. 'owner' has full control, 'admin' can manage users/settings, 'member' has standard access - `"owner"` - `"admin"` - `"member"` - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `middleName?: string` User's middle name (optional) - `phoneNumber?: string` User's phone number (10-15 digits, optional) - `suffix1?: string` Name suffix (e.g., 'Jr.', 'Sr.', 'III') - optional - `suffix2?: string` Additional name suffix (optional) ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const userListResponse of client.viewer.users.list()) { console.log(userListResponse.middleName); } ``` ## Retrieve `client.viewer.users.retrieve(stringuserID, RequestOptionsoptions?): UserRetrieveResponse` **get** `/v1/viewer/users/{userId}` Retrieves a single user by their unique user ID. Returns the complete user object with all profile information, permissions, and status. ### Parameters - `userID: string` Unique user identifier. Format: usr_{32-hex-chars} ### Returns - `UserRetrieveResponse` A user in the Viewer system with study management permissions - `canManageStudies: boolean` Whether the user has permission to create, update, and manage studies - `clinicRole: "Radiologist" | "Cardiologist" | "Neurologist" | 18 more` User's clinical or organizational role - `"Radiologist"` - `"Cardiologist"` - `"Neurologist"` - `"Urologist"` - `"Gynecologist"` - `"Endocrinologist"` - `"Doctor"` - `"Surgeon"` - `"Physician"` - `"Physician Assistant"` - `"Nurse Practitioner"` - `"Registered Nurse"` - `"Patient Care Coordinator"` - `"Front Desk Operator"` - `"Imaging Technologist"` - `"PACS Administrator"` - `"Software Engineer"` - `"Revenue Cycle Manager"` - `"Administrative Director"` - `"Administrative Assistant"` - `"Other"` - `createdAt: string | null` Timestamp when the user was created - `email: string` User's email address for login and notifications - `firstName: string` User's first name - `hasDashboardAccess: boolean` Whether the user can access the dashboard interface. Required for admin users - `invitedSource: "dashboard" | "api"` How the user was invited - via dashboard UI or API - `"dashboard"` - `"api"` - `lastLoginAt: string | null` Timestamp of user's last login, null if never logged in - `lastName: string` User's last name - `level: "owner" | "admin" | "member"` User access level. 'owner' has full control, 'admin' can manage users/settings, 'member' has standard access - `"owner"` - `"admin"` - `"member"` - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `middleName?: string` User's middle name (optional) - `phoneNumber?: string` User's phone number (10-15 digits, optional) - `suffix1?: string` Name suffix (e.g., 'Jr.', 'Sr.', 'III') - optional - `suffix2?: string` Additional name suffix (optional) ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const user = await client.viewer.users.retrieve('usr_1234567890abcdef1234567890abcdef'); console.log(user.middleName); ``` ## Update `client.viewer.users.update(stringuserID, UserUpdateParamsbody?, RequestOptionsoptions?): UserUpdateResponse` **patch** `/v1/viewer/users/{userId}` Updates a user's profile information, permissions, and access level. All fields are optional - only provided fields will be updated. Email cannot be changed via API. ### Parameters - `userID: string` Unique user identifier. Format: usr_{32-hex-chars} - `body: UserUpdateParams` - `canManageStudies?: boolean` - `clinicRole?: "Radiologist" | "Cardiologist" | "Neurologist" | 18 more | null` - `"Radiologist"` - `"Cardiologist"` - `"Neurologist"` - `"Urologist"` - `"Gynecologist"` - `"Endocrinologist"` - `"Doctor"` - `"Surgeon"` - `"Physician"` - `"Physician Assistant"` - `"Nurse Practitioner"` - `"Registered Nurse"` - `"Patient Care Coordinator"` - `"Front Desk Operator"` - `"Imaging Technologist"` - `"PACS Administrator"` - `"Software Engineer"` - `"Revenue Cycle Manager"` - `"Administrative Director"` - `"Administrative Assistant"` - `"Other"` - `firstName?: string` User's first name - `hasDashboardAccess?: boolean` Whether the user can access the dashboard interface. Required for admin users - `lastName?: string` User's last name - `level?: "admin" | "member"` - `"admin"` - `"member"` - `middleName?: string | null` - `phoneNumber?: string | null` - `suffix1?: string | null` - `suffix2?: string | null` ### Returns - `UserUpdateResponse` A user in the Viewer system with study management permissions - `canManageStudies: boolean` Whether the user has permission to create, update, and manage studies - `clinicRole: "Radiologist" | "Cardiologist" | "Neurologist" | 18 more` User's clinical or organizational role - `"Radiologist"` - `"Cardiologist"` - `"Neurologist"` - `"Urologist"` - `"Gynecologist"` - `"Endocrinologist"` - `"Doctor"` - `"Surgeon"` - `"Physician"` - `"Physician Assistant"` - `"Nurse Practitioner"` - `"Registered Nurse"` - `"Patient Care Coordinator"` - `"Front Desk Operator"` - `"Imaging Technologist"` - `"PACS Administrator"` - `"Software Engineer"` - `"Revenue Cycle Manager"` - `"Administrative Director"` - `"Administrative Assistant"` - `"Other"` - `createdAt: string | null` Timestamp when the user was created - `email: string` User's email address for login and notifications - `firstName: string` User's first name - `hasDashboardAccess: boolean` Whether the user can access the dashboard interface. Required for admin users - `invitedSource: "dashboard" | "api"` How the user was invited - via dashboard UI or API - `"dashboard"` - `"api"` - `lastLoginAt: string | null` Timestamp of user's last login, null if never logged in - `lastName: string` User's last name - `level: "owner" | "admin" | "member"` User access level. 'owner' has full control, 'admin' can manage users/settings, 'member' has standard access - `"owner"` - `"admin"` - `"member"` - `userId: string` Unique user identifier. Format: usr_{32-hex-chars} - `middleName?: string` User's middle name (optional) - `phoneNumber?: string` User's phone number (10-15 digits, optional) - `suffix1?: string` Name suffix (e.g., 'Jr.', 'Sr.', 'III') - optional - `suffix2?: string` Additional name suffix (optional) ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const user = await client.viewer.users.update('usr_1234567890abcdef1234567890abcdef'); console.log(user.middleName); ``` ## Revoke Access `client.viewer.users.revokeAccess(UserRevokeAccessParamsbody, RequestOptionsoptions?): UserRevokeAccessResponse` **post** `/v1/viewer/users/revoke-access` Deactivates a user's access to the system. The user will no longer be able to log in or access resources. User data is preserved and can be reactivated later. ### Parameters - `body: UserRevokeAccessParams` - `userId: string` User ID to revoke access for. Format: usr_{32-hex-chars} ### Returns - `UserRevokeAccessResponse` Response for revoking user access in Viewer - `success: boolean` - `message?: string` ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const response = await client.viewer.users.revokeAccess({ userId: 'usr_1234567890abcdef1234567890abcdef', }); console.log(response.success); ``` ## Reactivate `client.viewer.users.reactivate(UserReactivateParamsbody, RequestOptionsoptions?): UserReactivateResponse` **post** `/v1/viewer/users/reactivate` Restores access for a previously deactivated user. The user will regain their original permissions and be able to log in again. ### Parameters - `body: UserReactivateParams` - `userId: string` User ID to reactivate. Format: usr_{32-hex-chars} ### Returns - `UserReactivateResponse` Response for reactivating a user in Viewer - `success: boolean` - `message?: string` ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const response = await client.viewer.users.reactivate({ userId: 'usr_1234567890abcdef1234567890abcdef', }); console.log(response.success); ``` # Invitations ## List `client.viewer.users.invitations.list(InvitationListParamsquery?, RequestOptionsoptions?): CursorInvitations` **get** `/v1/viewer/users/invitations` Retrieves a paginated list of user invitations with optional filtering by status, expiration, date range, and user ID. Returns up to 100 invitations per request. ### Parameters - `query: InvitationListParams` - `cursor?: string` Base64 encoded cursor from previous response - `endDate?: string` Filter invitations created on or before this date (YYYY-MM-DD) - `expired?: "all" | "expired" | "not-expired"` Filter by expiration status - `"all"` - `"expired"` - `"not-expired"` - `limit?: number` Number of results to return (1-100) - `startDate?: string` Filter invitations created on or after this date (YYYY-MM-DD) - `status?: Array<"sent" | "accepted" | "rejected" | "revoked">` Filter by invitation status(es) - `"sent"` - `"accepted"` - `"rejected"` - `"revoked"` - `userId?: string` Filter by user ID. Format: usr_{32-hex-chars} ### Returns - `InvitationListResponse` A pending user invitation in the Viewer system - `canManageStudies: boolean` Whether the invited user will have permission to manage studies - `clinicId: string` UUID of the clinic this invitation belongs to - `clinicRole: "Radiologist" | "Cardiologist" | "Neurologist" | 18 more` Clinical or organizational role for the invited user - `"Radiologist"` - `"Cardiologist"` - `"Neurologist"` - `"Urologist"` - `"Gynecologist"` - `"Endocrinologist"` - `"Doctor"` - `"Surgeon"` - `"Physician"` - `"Physician Assistant"` - `"Nurse Practitioner"` - `"Registered Nurse"` - `"Patient Care Coordinator"` - `"Front Desk Operator"` - `"Imaging Technologist"` - `"PACS Administrator"` - `"Software Engineer"` - `"Revenue Cycle Manager"` - `"Administrative Director"` - `"Administrative Assistant"` - `"Other"` - `createdAt: string | null` Timestamp when the invitation was created - `email: string` Email address the invitation was sent to - `expiry: string | null` When the invitation expires, null if no expiration - `firstName: string` Invited user's first name - `hasDashboardAccess: boolean` Whether the invited user will have dashboard access - `invitationId: string` Unique invitation identifier. Format: inv_{32-hex-chars} - `invitedSource: "dashboard" | "api"` How the invitation was created - 'dashboard' or 'api' - `"dashboard"` - `"api"` - `inviterId: string` User ID of the person who sent the invitation. Format: usr_{32-hex-chars}. Null if invited via API - `lastName: string` Invited user's last name - `level: "owner" | "admin" | "member"` Access level for the invited user. 'admin' or 'member' when created via API - `"owner"` - `"admin"` - `"member"` - `status: "sent" | "accepted" | "rejected" | "revoked"` Invitation status: 'sent', 'accepted', 'rejected', or 'revoked' - `"sent"` - `"accepted"` - `"rejected"` - `"revoked"` - `updatedAt: string | null` Timestamp when the invitation was last updated - `userId: string` Pre-generated user ID for this invitation. Format: usr_{32-hex-chars}. This ID is assigned at invitation creation and will become the user's permanent ID upon acceptance - `invitedByApiKeyId?: string` UUID of the API key used to send this invitation. Null if sent via dashboard - `middleName?: string | null` Invited user's middle name (optional) - `phoneNumber?: string | null` Invited user's phone number (optional) - `suffix1?: string | null` Name suffix (e.g., 'Jr.', 'MD') - optional - `suffix2?: string | null` Additional name suffix - optional ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const invitationListResponse of client.viewer.users.invitations.list()) { console.log(invitationListResponse.middleName); } ``` ## Retrieve `client.viewer.users.invitations.retrieve(stringinvitationID, RequestOptionsoptions?): InvitationRetrieveResponse` **get** `/v1/viewer/users/invitations/{invitationId}` Retrieves a single invitation by its unique invitation ID. Returns the complete invitation details including status, expiration, and associated user information. ### Parameters - `invitationID: string` Unique invitation identifier. Format: inv_{32-hex-chars} ### Returns - `InvitationRetrieveResponse` A pending user invitation in the Viewer system - `canManageStudies: boolean` Whether the invited user will have permission to manage studies - `clinicId: string` UUID of the clinic this invitation belongs to - `clinicRole: "Radiologist" | "Cardiologist" | "Neurologist" | 18 more` Clinical or organizational role for the invited user - `"Radiologist"` - `"Cardiologist"` - `"Neurologist"` - `"Urologist"` - `"Gynecologist"` - `"Endocrinologist"` - `"Doctor"` - `"Surgeon"` - `"Physician"` - `"Physician Assistant"` - `"Nurse Practitioner"` - `"Registered Nurse"` - `"Patient Care Coordinator"` - `"Front Desk Operator"` - `"Imaging Technologist"` - `"PACS Administrator"` - `"Software Engineer"` - `"Revenue Cycle Manager"` - `"Administrative Director"` - `"Administrative Assistant"` - `"Other"` - `createdAt: string | null` Timestamp when the invitation was created - `email: string` Email address the invitation was sent to - `expiry: string | null` When the invitation expires, null if no expiration - `firstName: string` Invited user's first name - `hasDashboardAccess: boolean` Whether the invited user will have dashboard access - `invitationId: string` Unique invitation identifier. Format: inv_{32-hex-chars} - `invitedSource: "dashboard" | "api"` How the invitation was created - 'dashboard' or 'api' - `"dashboard"` - `"api"` - `inviterId: string` User ID of the person who sent the invitation. Format: usr_{32-hex-chars}. Null if invited via API - `lastName: string` Invited user's last name - `level: "owner" | "admin" | "member"` Access level for the invited user. 'admin' or 'member' when created via API - `"owner"` - `"admin"` - `"member"` - `status: "sent" | "accepted" | "rejected" | "revoked"` Invitation status: 'sent', 'accepted', 'rejected', or 'revoked' - `"sent"` - `"accepted"` - `"rejected"` - `"revoked"` - `updatedAt: string | null` Timestamp when the invitation was last updated - `userId: string` Pre-generated user ID for this invitation. Format: usr_{32-hex-chars}. This ID is assigned at invitation creation and will become the user's permanent ID upon acceptance - `invitedByApiKeyId?: string` UUID of the API key used to send this invitation. Null if sent via dashboard - `middleName?: string | null` Invited user's middle name (optional) - `phoneNumber?: string | null` Invited user's phone number (optional) - `suffix1?: string | null` Name suffix (e.g., 'Jr.', 'MD') - optional - `suffix2?: string | null` Additional name suffix - optional ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const invitation = await client.viewer.users.invitations.retrieve( 'inv_1234567890abcdef1234567890abcdef', ); console.log(invitation.middleName); ``` ## Update `client.viewer.users.invitations.update(stringinvitationID, InvitationUpdateParamsbody?, RequestOptionsoptions?): InvitationUpdateResponse` **patch** `/v1/viewer/users/invitations/{invitationId}` Updates a pending invitation's user details and permissions before it is accepted. Only valid for invitations that have not expired or been processed. ### Parameters - `invitationID: string` Unique invitation identifier. Format: inv_{32-hex-chars} - `body: InvitationUpdateParams` - `canManageStudies?: boolean` - `clinicRole?: "Radiologist" | "Cardiologist" | "Neurologist" | 18 more | null` - `"Radiologist"` - `"Cardiologist"` - `"Neurologist"` - `"Urologist"` - `"Gynecologist"` - `"Endocrinologist"` - `"Doctor"` - `"Surgeon"` - `"Physician"` - `"Physician Assistant"` - `"Nurse Practitioner"` - `"Registered Nurse"` - `"Patient Care Coordinator"` - `"Front Desk Operator"` - `"Imaging Technologist"` - `"PACS Administrator"` - `"Software Engineer"` - `"Revenue Cycle Manager"` - `"Administrative Director"` - `"Administrative Assistant"` - `"Other"` - `firstName?: string` Invited user's first name - `hasDashboardAccess?: boolean` Whether the invited user will have dashboard access - `lastName?: string` Invited user's last name - `level?: "admin" | "member"` - `"admin"` - `"member"` - `middleName?: string | null` - `phoneNumber?: string | null` - `suffix1?: string | null` - `suffix2?: string | null` ### Returns - `InvitationUpdateResponse` A pending user invitation in the Viewer system - `canManageStudies: boolean` Whether the invited user will have permission to manage studies - `clinicId: string` UUID of the clinic this invitation belongs to - `clinicRole: "Radiologist" | "Cardiologist" | "Neurologist" | 18 more` Clinical or organizational role for the invited user - `"Radiologist"` - `"Cardiologist"` - `"Neurologist"` - `"Urologist"` - `"Gynecologist"` - `"Endocrinologist"` - `"Doctor"` - `"Surgeon"` - `"Physician"` - `"Physician Assistant"` - `"Nurse Practitioner"` - `"Registered Nurse"` - `"Patient Care Coordinator"` - `"Front Desk Operator"` - `"Imaging Technologist"` - `"PACS Administrator"` - `"Software Engineer"` - `"Revenue Cycle Manager"` - `"Administrative Director"` - `"Administrative Assistant"` - `"Other"` - `createdAt: string | null` Timestamp when the invitation was created - `email: string` Email address the invitation was sent to - `expiry: string | null` When the invitation expires, null if no expiration - `firstName: string` Invited user's first name - `hasDashboardAccess: boolean` Whether the invited user will have dashboard access - `invitationId: string` Unique invitation identifier. Format: inv_{32-hex-chars} - `invitedSource: "dashboard" | "api"` How the invitation was created - 'dashboard' or 'api' - `"dashboard"` - `"api"` - `inviterId: string` User ID of the person who sent the invitation. Format: usr_{32-hex-chars}. Null if invited via API - `lastName: string` Invited user's last name - `level: "owner" | "admin" | "member"` Access level for the invited user. 'admin' or 'member' when created via API - `"owner"` - `"admin"` - `"member"` - `status: "sent" | "accepted" | "rejected" | "revoked"` Invitation status: 'sent', 'accepted', 'rejected', or 'revoked' - `"sent"` - `"accepted"` - `"rejected"` - `"revoked"` - `updatedAt: string | null` Timestamp when the invitation was last updated - `userId: string` Pre-generated user ID for this invitation. Format: usr_{32-hex-chars}. This ID is assigned at invitation creation and will become the user's permanent ID upon acceptance - `invitedByApiKeyId?: string` UUID of the API key used to send this invitation. Null if sent via dashboard - `middleName?: string | null` Invited user's middle name (optional) - `phoneNumber?: string | null` Invited user's phone number (optional) - `suffix1?: string | null` Name suffix (e.g., 'Jr.', 'MD') - optional - `suffix2?: string | null` Additional name suffix - optional ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const invitation = await client.viewer.users.invitations.update( 'inv_1234567890abcdef1234567890abcdef', ); console.log(invitation.middleName); ``` ## Revoke `client.viewer.users.invitations.revoke(InvitationRevokeParamsbody?, RequestOptionsoptions?): InvitationRevokeResponse` **post** `/v1/viewer/users/invitations/revoke` Revokes a pending invitation, preventing it from being accepted. Can revoke by invitation ID, user ID, or both. Useful for cancelling invitations sent in error. ### Parameters - `body: InvitationRevokeParams` - `invitationId?: string` Invitation ID to revoke. Format: inv_{32-hex-chars} - `userId?: string` User ID whose pending invitation to revoke. Format: usr_{32-hex-chars} ### Returns - `InvitationRevokeResponse` Response for revoking an invitation in Viewer - `success: boolean` - `message?: string` ### Example ```typescript import Avara from 'avara'; const client = new Avara({ apiKey: process.env['AVARA_API_KEY'], // This is the default and can be omitted }); const response = await client.viewer.users.invitations.revoke(); console.log(response.success); ```