Complete API reference for the DotPassport SDK client.
Table of Contents
Copy npm install @dotpassport/sdk Client Initialization
DotPassportClient
Main client class for interacting with the DotPassport API.
Constructor Parameters:
Example:
All API requests require authentication via API key. Include your API key when initializing the client:
API Key Types:
Getting an API Key:
Navigate to API Keys section
Generate a new key for your application
Store securely (never commit to version control)
Profile Methods
Retrieves a user's complete profile information.
Parameters:
address (string): Polkadot address of the user
Returns: Promise resolving to UserProfile object
Example:
Response Type:
Errors:
API key is invalid or missing
Retrieves all reputation scores for a user.
Parameters:
address (string): Polkadot address of the user
Returns: Promise resolving to UserScores object
Example:
Response Type:
Available Categories:
On-chain transaction volume
On-chain identity verification
getCategoryScore()
Retrieves a specific category score for a user.
Parameters:
address (string): Polkadot address of the user
categoryKey (string): Category identifier (e.g., "longevity")
Returns: Promise resolving to SpecificCategoryScore object
Example:
Response Type:
Errors:
User doesn't have this category score
Retrieves all badges earned by a user.
Parameters:
address (string): Polkadot address of the user
Returns: Promise resolving to UserBadges object
Example:
Response Type:
Note: All badges in the badges array are earned badges. The badge level system allows users to progress through multiple levels within each badge type.
Retrieves a specific badge for a user.
Parameters:
address (string): Polkadot address of the user
badgeKey (string): Badge identifier (e.g., "relay_chain_initiate")
Returns: Promise resolving to SpecificUserBadge object
Example:
Response Type:
Common Badge Keys:
Errors:
User doesn't have this badge
Badge definition not found
getBadgeDefinitions()
Retrieves all badge definitions.
Parameters: None
Returns: Promise resolving to BadgeDefinitions object
Example:
Response Type:
Use Cases:
Display all available badges in UI
Show badge requirements to users
Create badge progress indicators
getCategoryDefinitions()
Retrieves all category definitions.
Parameters: None
Returns: Promise resolving to CategoryDefinitions object
Example:
Response Type:
Use Cases:
Display all scoring categories
Show detailed scoring breakdown
Provide improvement advice to users
Success Response
All successful API calls return data directly:
All errors throw DotPassportError:
DotPassportError
Custom error class for all API errors.
Properties:
Full error response from API
Status Code
Error
Description
Solution
Invalid request parameters
Invalid or missing API key
API key lacks permissions
Verify address/key exists
Error Handling Patterns
Basic Error Handling:
Specific Error Handling:
Retry Logic:
Rate Limit Tiers
Tier
Hourly Limit
Daily Limit
Monthly Limit
Rate Limit Headers
All API responses include rate limit information in headers:
Monitoring Rate Limits
Extract from Error Response:
Implement Rate Limit Tracking:
Cache Responses : Store frequently accessed data
Batch Requests : Combine multiple requests when possible
Implement Backoff : Use exponential backoff for retries
Monitor Usage : Track remaining requests
Upgrade When Needed : Switch to higher tier if hitting limits
Caching Example:
Additional Resources