API Keys¶
API keys authenticate your application to Nivatio's API for order-related operations.
Overview¶
Each Project in your merchant account has its own API key. Use this key in the x-api-key header for:
- Creating orders
- Retrieving order details
- Updating order metadata
Creating an API Key¶
- Log in to Dashboard
- Navigate to Projects → Your Project
- Click API Keys tab
- Click Generate New Key
- Set permissions and expiration
- Copy the key immediately - it won't be shown again!
Secure Your Keys
- Never commit API keys to version control
- Use environment variables to store keys
- Rotate keys regularly
- Restrict keys with minimal permissions
API Key Permissions¶
When creating a key, you can assign these permissions:
| Permission | Can Do |
|---|---|
read |
GET /v1/orders/* |
write |
POST /v1/orders, PATCH /v1/orders/* |
admin |
All order operations + webhook config |
Using API Keys¶
Creating an Order¶
curl -X POST https://api.nivat.io/v1/orders \
-H "x-api-key: nv_sk_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"amount": 50000,
"currency": "NUSD",
"description": "Order #12345"
}'
Retrieving an Order¶
curl https://api.nivat.io/v1/orders/order_abc123 \
-H "x-api-key: nv_sk_live_abc123..."
Environment Variables¶
Store your API key securely:
# .env
NIVATIO_API_KEY=nv_sk_live_abc123...
// Using in your app
const response = await fetch('https://api.nivat.io/v1/orders', {
headers: {
'x-api-key': process.env.NIVATIO_API_KEY,
'Content-Type': 'application/json'
},
// ...
});
Key Rotation¶
Rotate your API keys regularly for security:
- Generate a new key in the dashboard
- Update your application with the new key
- Test the integration works with new key
- Wait 24 hours for any cached requests
- Delete the old key from dashboard
Zero-Downtime Rotation
Generate the new key first, update your app, then delete the old key after confirming everything works.
Managing Multiple Environments¶
Use separate API keys for each environment:
| Environment | Key Prefix | Base URL |
|---|---|---|
| Production | nv_sk_live_ |
https://api.nivat.io |
| Sandbox | nv_sk_test_ |
https://sandbox.nivat.io |