A Rust API service using Unkey for API key validation with the Actix framework.
This example shows how to secure a Rust + Actix Web API using Unkey for API key management. You'll learn how to protect public and private routes with minimal setup and start authenticating users quickly.
12git clone <repo-url>3cd /path/to/repo4
.env.example
file and rename it to .env
.12cp .env.example .env3
Replace your API key in the .env
file.
Start the server.
12cargo run3
12curl http://localhost:3000/api/v1/public3
12curl http://localhost:3000/api/v1/public -H "Authorization: Bearer <YOUR_API_KEY>"3
12curl http://localhost:3000/api/v1/protected -H "Authorization: Bearer <YOUR_API_KEY>"3
2500 verifications and 100K successful rate‑limited requests per month. No CC required.