Complete API Reference

Complete API reference for the DotPassport SDK client.

Table of Contents

Installation

npm install @dotpassport/sdk

Client 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:

Prefix
Environment
Usage

live_

Production

Real user data

test_

Testing

Test data only

Getting an API Key:

  1. Navigate to API Keys section

  2. Generate a new key for your application

  3. 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:

Status
Error
Description

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:

Key
Title
Description

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 user

  • categoryKey (string): Category identifier (e.g., "longevity")

Returns: Promise resolving to SpecificCategoryScore object

Example:

Response Type:

Errors:

Status
Error
Description

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 user

  • badgeKey (string): Badge identifier (e.g., "relay_chain_initiate")

Returns: Promise resolving to SpecificUserBadge object

Example:

Response Type:

Common Badge Keys:

Key
Title
Tier

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:

Status
Error
Description

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:

Property
Type
Description

message

string

Error message

statusCode

number

HTTP status code

response

any

Full error response from API

Error Codes

Status Code
Error
Description
Solution

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

Tier
Hourly Limit
Daily Limit
Monthly Limit

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

  1. Cache Responses: Store frequently accessed data

  2. Batch Requests: Combine multiple requests when possible

  3. Implement Backoff: Use exponential backoff for retries

  4. Monitor Usage: Track remaining requests

  5. Upgrade When Needed: Switch to higher tier if hitting limits

Caching Example:


Additional Resources

Need Help?

Last updated