Overview
BlockDB uses OAuth 2.0 with JWT bearer tokens for API authentication. All requests must include a valid token in theAuthorization header. Tokens are scoped to specific datasets, chains, and rate limits.
Authentication Flow
1
Request Access
Contact [email protected] to request API access. Provide:
- Your organization name
- Intended use case
- Required datasets and chains
- Expected request volume
2
Receive Credentials
You’ll receive:
- Client ID and Client Secret for token generation
- Scopes defining your access permissions
- Rate limits based on your plan
3
Generate JWT Token
Use your credentials to request a JWT token from the UserService authentication endpoint.
4
Include in Requests
Send the token in the
Authorization header with every API request:Token Format
All tokens must be sent as Bearer tokens in the HTTPAuthorization header:
Token Scopes
Tokens are scoped to specific resources. Common scopes include:| Scope Pattern | Description | Example |
|---|---|---|
level:01 | Access to datasets level 1 (raw data) | level:01 |
level:* | Access to all datasets levels | level:* |
chain:1 | Access to Ethereum Mainnet | chain:1 |
chain:* | Access to all chains | chain:* |
Scopes are comma-separated when requesting tokens. Your token will only grant access to resources explicitly included in your scopes.
Token Expiration
- Access tokens: Configurable by the user. Default behavior is no automatic expiration, but you can define a custom TTL (time-to-live) per application or API key.
- Refresh tokens: Configurable lifetime as well. Default behavior is no automatic expiration, but you can define a custom TTL (time-to-live) per application or API key.
- Token rotation: Recommended every 24 hours for security practices.
Error Responses
401 Unauthorized
Returned when:- Token is missing
- Token is invalid or expired
- Token lacks required scopes
403 Forbidden
Returned when:- Token is valid but lacks required permissions
- Requested dataset is not included in token scopes
Best Practices
For production applications, use a token refresh mechanism that automatically renews tokens before expiration.
Testing Authentication
Verify your token is working correctly:See Also
- Rate Limiting - Understanding quotas and limits
- Error Codes - Complete error reference
- Troubleshooting: API Authentication Failures - Common auth issues