API keys authenticate your applications when making requests to Swig services. This guide walks you through creating an API key in the Developer Portal.Documentation Index
Fetch the complete documentation index at: https://build.onswig.com/llms.txt
Use this file to discover all available pages before exploring further.
What API Keys Are Used For
API keys are required for:- Fetching policy details via the REST API
- Creating Swig wallets programmatically
- Accessing paymaster services for transaction sponsorship
Prerequisites
Before creating an API key, ensure you have:- A Swig account at dashboard.onswig.com
- Access to an project
Creating an API Key
Step 1: Navigate to API Keys
- Log in to the Developer Portal
- Select your project from the sidebar
- Click API Keys in the navigation menu
Step 2: Create New Key
- Click the Create API Key button
- Enter a name for your key (required, 1-100 characters)
- Use descriptive names like
production-backendordev-testing
- Use descriptive names like
- Optionally set an expiration date
- Leave empty for keys that never expire
- Click Create
Step 3: Copy Your Key
After creation, the portal displays your full API key. Copy it and store it in a secure location such as:- Environment variables
- A secrets manager (AWS Secrets Manager, HashiCorp Vault, etc.)
- Your CI/CD platform’s secret storage
API Key Format
Swig API keys follow this format:sk_ prefix identifies it as a Swig API key.
Subscription Limits
API key limits depend on your subscription tier:| Tier | API Keys Allowed |
|---|---|
| Free | 1 |
| Paid | Unlimited |
Using Your API Key
In HTTP Requests
Include your API key in theAuthorization header:
With the SDK
Pass your API key when initializing the client:Best Practices
Security
- Never commit API keys to version control
- Use environment variables to store keys in your application
- Rotate keys periodically, especially if you suspect compromise
- Use separate keys for development and production environments
Naming Conventions
Use descriptive names that indicate:- The environment (
dev-,staging-,prod-) - The service or application using the key
- The purpose (
backend-api,mobile-app,testing)
prod-backend-servicedev-local-testingstaging-mobile-app
Expiration
Consider setting expiration dates for:- Temporary access (contractors, testing)
- Compliance requirements
- Regular rotation schedules
Managing API Keys
Viewing Keys
The API Keys page shows all your keys with:- Name
- Creation date
- Expiration date (if set)
- Usage count
- Last used timestamp
Deleting Keys
To revoke an API key:- Find the key in the API Keys table
- Click the Delete action
- Confirm deletion
Next Steps
Now that you have an API key, you can:- Create a policy to define wallet permissions
- Fetch policies programmatically
- Create Swig wallets via the API

