Skip to main content

Get Your API Key

First, you’ll need an API key to interact with the ZKScore platform.
1

Sign in to Builder Portal

Visit builder.onzks.com and connect your wallet
2

Create an API Key

Navigate to the API Keys section and click “Create New Key”
3

Copy Your Key

Save your API key securely - you’ll need it for authentication
Never share your API key publicly or commit it to version control. Use environment variables in production.

Installation

Initialize the SDK

Create a new SDK instance with your API key:

Your First Identity

Let’s create a ZKScore identity for a user:
Identity minting requires a wallet signature. Make sure the user’s wallet is connected and ready to sign.

Get a Reputation Score

Once an identity exists, you can fetch their reputation score:

Score-Gated Feature

Here’s a practical example of gating a feature based on reputation score:

Generate a Zero-Knowledge Proof

For privacy-preserving verification, generate a ZK proof:

List Achievements

View available achievements and user progress:

Create an Attestation

Use the Trust Layer to create attestations:

React Integration

Using React? We have hooks for that:

Complete Example

Here’s a full example combining multiple features:

Smart Contract Integration

Prefer to interact directly with contracts? Here’s a quick example:
See the Smart Contracts section for complete contract integration guides.

Next Steps

Core Concepts

Learn about identity, scoring, and trust

API Reference

Explore the complete API

SDK Documentation

Deep dive into SDK features

Use Cases

See real-world examples

Common Patterns

Error Handling

Always wrap SDK calls in try-catch blocks:

Caching Scores

Scores update in real-time but you can cache them:

Batch Operations

Fetch multiple scores efficiently:

Environment Variables

Create a .env file for your configuration:
.env
Then use them in your code:

Troubleshooting

Double-check your API key is correct and hasn’t been revoked. You can regenerate keys in the Builder Portal.
The address doesn’t have a ZKScore identity yet. Call sdk.identity.mint() to create one first.
You’ve exceeded the API rate limit. Implement caching and backoff strategies. See Rate Limiting.
Check your network connection and that the ZKScore API is accessible. Try again with exponential backoff.

Get Help

Join Discord

Ask questions in our community

GitHub Issues

Report bugs or request features

You’re all set! You now know the basics of ZKScore. Explore the docs to learn more advanced features.