Skip to main content

Security and auth models

These models manage user authentication, authorization, API access, and security controls in Chargeworx.

UserInvitation

Manages user invitation workflow for onboarding new team members.

Key properties

PropertyTypeDescription
IdGuidUnique invitation identifier
EmailStringInvitee email address
CompanyIdGuidAssociated company reference
InvitedByGuidUser who sent invitation
RoleStringAssigned role
StatusStringInvitation status
TokenStringUnique invitation token
ExpiresAtDateTimeInvitation expiration
CreatedAtDateTimeInvitation creation timestamp
AcceptedAtDateTime?Acceptance timestamp

Relationships

  • Belongs to a Company
  • References inviting User

Status values

StatusDescription
PendingInvitation sent, awaiting acceptance
AcceptedUser accepted and registered
ExpiredInvitation expired
CancelledInvitation cancelled by admin

WhitelistIp

Manages IP address whitelisting for enhanced API security.

Key properties

PropertyTypeDescription
IdGuidUnique identifier
CompanyIdGuidAssociated company reference
ProjectIdGuid?Optional project-specific whitelist
IpAddressStringWhitelisted IP address or CIDR range
DescriptionStringIP address description
IsActiveBooleanWhitelist entry active status
CreatedAtDateTimeCreation timestamp
CreatedByGuidUser who created entry

Relationships

  • Belongs to a Company
  • Optionally belongs to a Project

IP formats

  • Single IP: 192.168.1.100
  • CIDR range: 192.168.1.0/24
  • IPv6: 2001:0db8:85a3::8a2e:0370:7334

Key / CompanyProjectKey

Manages API keys for programmatic access to Chargeworx.

Key

Base API key entity.
PropertyTypeDescription
IdGuidUnique key identifier
KeyValueStringAPI key value (hashed)
KeyTypeStringKey type (Public, Secret)
IsActiveBooleanKey active status
CreatedAtDateTimeKey creation timestamp
ExpiresAtDateTime?Optional expiration
LastUsedAtDateTime?Last usage timestamp

CompanyProjectKey

Links API keys to specific company projects with permissions.
PropertyTypeDescription
IdGuidUnique identifier
KeyIdGuidAssociated key reference
CompanyIdGuidAssociated company
ProjectIdGuidAssociated project
PermissionsStringJSON array of permissions
EnvironmentStringEnvironment (Production, Sandbox)

Relationships

  • Key has many CompanyProjectKeys
  • CompanyProjectKey belongs to Company and Project

Key types

  • Public key - Used for client-side operations
  • Secret key - Used for server-side API calls
  • Restricted key - Limited permissions for specific operations

Usage patterns

User invitations

Admins invite new users by email. Invitations include a unique token and expire after a configured period (typically 7 days).

IP whitelisting

Companies can restrict API access to specific IP addresses or ranges. Requests from non-whitelisted IPs are rejected.

API key management

API keys are generated per project and can be scoped to specific permissions. Keys can be rotated or revoked as needed.

Key rotation

Best practice is to rotate API keys periodically:
  1. Generate new key
  2. Update applications to use new key
  3. Deactivate old key after transition period

Security best practices

  • Rotate API keys regularly (every 90 days recommended)
  • Use IP whitelisting for production environments
  • Assign minimum required permissions to API keys
  • Monitor key usage for suspicious activity
  • Expire unused keys automatically
  • Never commit API keys to source control
  • Use separate keys for different environments

Audit and monitoring

  • All API key usage is logged
  • Failed authentication attempts are tracked
  • IP whitelist violations are logged and alerted
  • Invitation acceptance is audited
  • Key rotation events are recorded