Service accounts are machine users for server-to-server communication. Unlike human users who authenticate with passkeys, service accounts use a keypair to sign API requests.
When to use a service account
Use a service account when you need to:- Call the Dfns API from your backend server
- Run automated processes (scheduled transfers, batch operations)
- Build applications that create wallets or manage users on behalf of your organization
Create the service account
Generate a keypair
Your service account needs a keypair to sign its API requests. Generate one using OpenSSL:Keep the private key (
service-account.pem) secure - you’ll need it to sign requests.Create the service account in the dashboard
- Navigate to Settings > Developers > Service Accounts (direct link: https://app.dfns.io/settings/service-accounts)
- Click New Service Account
- Enter a name (e.g., “Backend Server” or “Trading Bot”)
- Paste the contents of your public key file (including the
-----BEGIN PUBLIC KEY-----and-----END PUBLIC KEY-----lines) - Click Create and sign with your passkey
Save the authentication token
After creation, you’ll see the service account token. Copy it immediately - it won’t be shown again.Store both the token and private key securely. Dfns recommends using a secrets manager like AWS Secrets Manager, HashiCorp Vault, or your cloud provider’s equivalent.
Review permissions
By default, a service account inherits all permissions from the user who creates it. If your user has full admin access, the service account will too.To follow the principle of least privilege, create a dedicated role with only the permissions your service account needs, and assign it:
See the full list of permissions for all available options.
- Navigate to Settings > Roles and create a new role with only the required permissions
- Go back to Settings > Developers > Service Accounts and click on your service account
- Replace the inherited permissions by assigning the dedicated role
| Use case | Permissions needed |
|---|---|
| Create and manage wallets | Wallets:Create, Wallets:Read |
| Transfer assets | Wallets:Read, Wallets:Sign |
| Register end users | Auth:Users:Create, Auth:Users:Read |
| Full wallet management | Wallets:Create, Wallets:Read, Wallets:Sign, Wallets:Update |
Service account limitations
Service accounts can perform most operations, but some actions require human interaction:| Operation | Service Account | Notes |
|---|---|---|
| Create wallets | Yes | |
| Transfer assets | Yes | Subject to policies |
| Sign transactions | Yes | Subject to policies |
| Create end users | Yes | For delegated wallets |
| Approve policy requests | No | Requires human passkey |
| Create other service accounts | No | Requires human passkey |
| Modify policies | Yes | But approval may require humans |
When a policy triggers
RequestApproval, a human user must approve the request using their passkey. Service accounts cannot approve policy requests.Using your service account
You now have everything needed to make API calls:| Credential | Purpose |
|---|---|
| Token | Used in the Authorization: Bearer <token> header |
| Private key | Used to sign user action challenges for POST/PUT/DELETE requests |
