Complete API Reference
Complete API reference for the DotPassport SDK client.
Table of Contents
Installation
npm install @dotpassport/sdkClient Initialization
DotPassportClient
Main client class for interacting with the DotPassport API.
Constructor Parameters:
Example:
Authentication
All API requests require authentication via API key. Include your API key when initializing the client:
API Key Types:
live_
Production
Real user data
test_
Testing
Test data only
Getting an API Key:
Sign up at dotpassport.com/developers
Navigate to API Keys section
Generate a new key for your application
Store securely (never commit to version control)
Profile Methods
getProfile()
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:
404
User not found
Address has no profile
401
Invalid API key
API key is invalid or missing
Scores Methods
getScores()
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:
longevity
Account Longevity
Account age and history
tx_count
Transaction Count
On-chain transaction volume
governance
Governance
Governance participation
identity
Identity
On-chain identity verification
unique_interactions
Unique Interactions
Network diversity
technical_contributions
Technical Contributions
Developer activity
getCategoryScore()
Retrieves a specific category score for a user.
Parameters:
address(string): Polkadot address of the usercategoryKey(string): Category identifier (e.g., "longevity")
Returns: Promise resolving to SpecificCategoryScore object
Example:
Response Type:
Errors:
404
Category score not found
User doesn't have this category score
404
Category not found
Invalid category key
Badges Methods
getBadges()
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.
getBadge()
Retrieves a specific badge for a user.
Parameters:
address(string): Polkadot address of the userbadgeKey(string): Badge identifier (e.g., "relay_chain_initiate")
Returns: Promise resolving to SpecificUserBadge object
Example:
Response Type:
Common Badge Keys:
relay_chain_initiate
Relay Chain Initiate
Bronze
governance_voter
Governance Voter
Silver
parachain_explorer
Parachain Explorer
Gold
identity_verified
Identity Verified
Silver
staking_champion
Staking Champion
Platinum
Errors:
404
Badge not found
User doesn't have this badge
404
Badge definition not found
Invalid badge key
Metadata Methods
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
Response Types
Success Response
All successful API calls return data directly:
Error Response
All errors throw DotPassportError:
Error Handling
DotPassportError
Custom error class for all API errors.
Properties:
message
string
Error message
statusCode
number
HTTP status code
response
any
Full error response from API
Error Codes
400
Bad Request
Invalid request parameters
Check request format
401
Unauthorized
Invalid or missing API key
Verify API key
403
Forbidden
API key lacks permissions
Check key permissions
404
Not Found
Resource doesn't exist
Verify address/key exists
429
Too Many Requests
Rate limit exceeded
Implement rate limiting
500
Internal Server Error
Server error
Retry with backoff
503
Service Unavailable
API is down
Retry later
Error Handling Patterns
Basic Error Handling:
Specific Error Handling:
Retry Logic:
Rate Limiting
Rate Limit Tiers
Free
100
1,000
10,000
Pro
1,000
10,000
100,000
Enterprise
10,000
100,000
1,000,000
Rate Limit Headers
All API responses include rate limit information in headers:
Monitoring Rate Limits
Extract from Error Response:
Implement Rate Limit Tracking:
Best Practices
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
Need Help?
Documentation: docs.dotpassport.com
GitHub Issues: github.com/dotpassport/sdk/issues
Discord: discord.gg/dotpassport
Email: [email protected]
Last updated
