API key types
Notify supports three types of API keys, each with different capabilities:- Live keys
- Team and guest list keys
- Test keys
Type:
normalDescription: Live – sends to anyoneCapabilities:- Send to any recipient
- No restrictions on who can receive notifications
- Use in production environments
- Count against service sending limits
- Not available in trial mode
- Shows disabled state with hint: “Not available because your service is in trial mode”
Creating API keys
Generate new API keys for your service through the admin interface.Navigate to API keys
From your service dashboard:
- Go to API integration
- Click API keys
- Click Create an API key
/services/{service_id}/api/keys/createEnter key details
Key name (
key_name field):- Descriptive name to identify the key’s purpose
- Example: “Production app”, “Staging environment”, “Development testing”
- Used in safe string format with underscores for spaces
key_type field):- Radio button selection between Live, Team and guest list, or Test
- Shows hints and disabled states based on service configuration
Review permissions
The form shows contextual information:Trial mode services:
- Live keys disabled with link to trial mode documentation
- Team and guest list or Test keys recommended
- Team and Test keys show “Cannot be used to send letters” hint
Key creation process
When you create a key (app/models/api_key.py:26-27):- Generates a cryptographically secure key secret
- Stores the key in the database
- Returns the secret to the admin app (only time it’s sent)
- Admin app displays it on the confirmation page
Managing API keys
View and manage all API keys for your service.API keys page
Access at/services/{service_id}/api/keys to see all keys:
Display for each key:
- Key name
- Key type with description:
- “Live – sends to anyone”
- “Team and guest list – limits who you can send to”
- “Test – pretends to send messages”
- Revoked status (if applicable) with revocation timestamp
- Revoke action (for active keys)
Key permissions required
All API key pages require themanage_api_keys permission:
- View API keys
- Create new keys
- Revoke existing keys
Revoking API keys
Remove access for compromised or unused API keys.Revocation workflow
Initiate revocation
From the API keys page, click Revoke next to the key you want to disable.URL:
/services/{service_id}/api/keys/revoke/{key_id}Confirm revocation
A flash banner appears with confirmation message:“Are you sure you want to revoke ''?”“You will not be able to use this API key to connect to GOV.UK Notify.”The API keys list remains visible below the banner.
Revoked key display
Revoked keys remain visible but show:- Revoked status with timestamp (e.g., “Revoked 12 November at 2:30pm”)
- No revoke action (already revoked)
- Greyed out appearance
Immediate effect
Revocation is immediate:- API requests with revoked key fail instantly
- No grace period for existing requests
- Applications using the key will get authentication errors
API integration page
The main API integration hub provides links to all API-related features.Access
URL:/services/{service_id}/api
Permission required: manage_api_keys
Page sections
API keys
Link to create and manage API keys for your service.Destination:
/services/{service_id}/api/keysCallbacks
Configure delivery status callbacks and inbound SMS webhooks.Destination: Varies based on
can_have_multiple_callbacks permission:- Multiple:
/services/{service_id}/api/callbacks - Single:
/services/{service_id}/api/callbacks/delivery-status-callback
Guest list
Manage the list of allowed recipients for trial mode and team keys.Destination:
/services/{service_id}/api/guest-listRecent API use
View recent notifications sent via API.Data:
APINotifications(service_id) - last 50 API notificationsGuest list management
Control which recipients can receive notifications in trial mode or with team keys.Configuring the guest list
Access guest list
Navigate to API integration → Guest listURL:
/services/{service_id}/api/guest-list(Old URL /services/{service_id}/api/whitelist redirects here)Add recipients
Enter recipients in the appropriate fields:Email addresses:
- One per line
- Validated for email format
- Used for email notifications
- One per line
- Validated for phone format
- Used for SMS notifications
Guest list validation
When sending with team keys or in trial mode:-
Recipient check: Each recipient validated against:
- Team member emails and phone numbers
- Guest list entries
- For names: Team member names
-
Validation failure: Recipients not on list are rejected with error:
- “Service is in trial mode” message
- Link to guest list configuration
- CSV uploads: Each row validated, errors shown per row
Using API keys
Once created, API keys are used to authenticate API requests.Authentication format
API keys are used in theAuthorization header:
- Key type identifier
- Service ID
- Unique key secret
Key security
Store securely
Keep API keys in secure environment variables or secrets management systems. Never commit to version control.
Use appropriate types
Use test keys for development, team keys for staging, and live keys only in production.
Rotate regularly
Create new keys periodically and revoke old ones to limit exposure from potential compromises.
Monitor usage
Check “Recent API use” section to ensure keys are being used as expected.
Trial mode restrictions
In trial mode:- Live keys: Cannot be created (disabled in UI)
- Team keys: Recommended for testing
- Test keys: Available for development
API notifications view
Monitor recent API activity from the integration page.What’s shown
The “Recent API use” section displays:- Last 50 notifications sent via API
- Template used
- Recipient (if viewable by user)
- Status
- Sent timestamp
APINotifications(service_id) model
Filtering: Only shows notifications sent via API (excludes admin-sent notifications)
Permissions
API notifications list respects user permissions:- Users with
view_activity: See all API notifications - Users with only
send_messages: Limited view
Callbacks configuration
Configure webhooks to receive delivery status updates and inbound messages.Callback types
- Delivery status
- Inbound SMS
- Returned letters
Type:
delivery_statusPurpose: Receive updates when notification status changesConfiguration:- Callback URL
- Bearer token for authentication
/services/{service_id}/api/callbacks/delivery-status-callbackManaging callbacks
For each callback type:- Create: Enter URL and bearer token, submit
- Update: Change URL or token, submit (detects change from dummy token)
- Delete: Clear URL field and submit
bearer_token_set to hide real value
Best practices
Create descriptive key names
Use names that clearly identify the purpose and environment:
- “Production web app”
- “Staging environment”
- “Development testing - Jane”
Use minimal permissions
Create keys with the least privileges needed:
- Development: Test keys
- Staging: Team and guest list keys
- Production: Live keys
Implement key rotation
Establish a rotation schedule:
- Create new API key
- Update application configuration
- Deploy application
- Verify new key works
- Revoke old key
Monitor and audit
Regularly review:
- Active API keys list
- Recent API use for unexpected activity
- Revoked keys that can be removed from the list (archived)