In this tutorial, you'll learn how to programmatically access Vidos Universal Resolver using API keys. You'll create and configure an API key with appropriate permissions, then use it to resolve Decentralized Identifiers (DIDs) from the command line. By the end of this tutorial, you'll have hands-on experience with secure, API-based DID resolution that you can integrate into your applications.
API-based resolution is essential for building applications that need to verify identities and resolve DIDs without direct dashboard access. This approach enables you to integrate secure DID resolution into your services while maintaining proper access controls.
Before you begin, make sure you have:
Before creating API keys, it's helpful to understand how Vidos manages API access. This follows the principles outlined in the IAM documentation:
The Vidos access model separates:
This separation gives you fine-grained control over who can access your resolver instances and what they can do with them.
Policies determine what your API keys can do within Vidos. Let's explore the pre-defined policies. For detailed information on policies, see the Policy Documents documentation:
Access to the resolver service
: Allows DID resolution but no management operationsResolver administrator
: Provides management capabilities for resolver instances
Policies follow the principle of least privilege. Choose policies that grant only the permissions your application needs. For most resolution-only use cases, the Access to the resolver service
policy is sufficient.
Now you'll create an API key that your application will use to authenticate with the resolver service. For more detailed steps, you can also follow the Create API Key guide:
Access to the resolver service
policyYour API key is a security credential. Treat it like a password:
To make API calls, you need the specific endpoint for your resolver instance:
https://YOUR_RESOLVER_ID}.resolver.service.{region}.vidos.id
This endpoint is where you'll send your DID resolution requests, authenticated with your API key.
Now let's put everything together and resolve a DID using your API key:
did
value in the request bodyThe response includes a full DID Document containing verification methods, services, and metadata associated with the identifier. These elements are critical for establishing trust in decentralized systems.
When you resolve a DID via the API, the response follows a standard structure:
Understanding this structure is important when you integrate DID resolution into your applications:
didResolutionMetadata
: Contains information about the resolution process itselfdidDocument
: The actual resolved document with verification methods and servicesdidDocumentMetadata
: Additional information about the DID and its methodTo understand how permissions affect API access, you can experiment with changing the policy attached to your API key:
Access to the resolver service
policyResolver administrator
policy insteadThis demonstrates how Vidos enforces access controls at the API level. The Resolver administrator
policy grants management capabilities but not resolution capabilities.
Remember to revert these changes by re-selecting the Access to the resolver service
policy before continuing, or your API resolution calls will continue to fail.
Now that you understand how to resolve DIDs using the API, you can integrate this functionality into your application:
Here's a simplified example in JavaScript:
If you encounter issues during this tutorial, check these common problems and solutions:
Problem | Possible Cause | Solution |
---|---|---|
401 Unauthorized | Invalid API key | Verify you're using the correct API key and it's properly formatted in the Authorization header |
403 Forbidden | Insufficient permissions | Check that your API key has the Access to the resolver service policy attached |
404 Not Found | Incorrect resolver ID or endpoint | Verify the resolver ID in your API URL matches your instance |
Resolution errors | Invalid DID or unsupported method | Confirm the DID is correctly formatted and uses a method supported by your resolver |
Timeout errors | Network issues or resource constraints | Try again later or check your network connection |
Congratulations! In this tutorial, you've:
This knowledge enables you to build applications that programmatically resolve DIDs while maintaining proper security and access controls.
To continue advancing your knowledge of Vidos and DID resolution: