Overview
Nurosentrix uses token-based authentication. You can create API tokens in the dashboard and use them to authenticate API requests.
Creating API Tokens
- Log in to the Nurosentrix dashboard
- Go to Settings → API Keys
- Click "Create API Key"
- Give your token a descriptive name
- Select the permissions for this token
- Click "Create"
The full token is only shown once when created. Store it securely - you cannot retrieve it later.
Using API Tokens
Include your token in the Authorization header of every request:
Authorization: Bearer nsx_live_abc123...
Example Request
curl -X GET "https://app.nurosentrix.com/api/v1/servers" \ -H "Authorization: Bearer nsx_live_abc123..." \ -H "Content-Type: application/json"
Token Types
Live Tokens
Live tokens (prefixed with nsx_live_) have full access to your production resources. Use these in your production applications.
Test Tokens
Test tokens (prefixed with nsx_test_) are for development and testing. They have the same permissions but operate in a sandboxed environment.
Token Permissions
When creating a token, you can restrict its permissions:
| Permission | Description |
|---|---|
servers:read | View servers |
servers:write | Create, update, delete servers |
instances:read | View instances |
instances:write | Create, update, delete instances |
instances:actions | Start, stop, restart instances |
backups:read | View backups |
backups:write | Create, delete backups |
backups:restore | Restore backups |
settings:read | View account settings |
settings:write | Update account settings |
Error Responses
401 Unauthorized
Returned when no token is provided or the token is invalid:
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or missing authentication token"
}
}403 Forbidden
Returned when the token doesn't have permission for the requested action:
{
"success": false,
"error": {
"code": "FORBIDDEN",
"message": "Token does not have permission: servers:write"
}
}Session Authentication
For the web dashboard, Nurosentrix uses session-based authentication with JWT tokens. This is handled automatically when you log in through the web interface.
Login
POST /auth/login{
"email": "user@example.com",
"password": "your-password"
}Response
{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIs...",
"expires_at": "2024-01-16T10:30:00Z",
"user": {
"id": "usr_abc123",
"email": "user@example.com",
"name": "John Doe"
}
}
}Security Best Practices
- Never expose tokens in client-side code - API tokens should only be used server-side
- Use environment variables - Store tokens in environment variables, not in code
- Rotate tokens regularly - Create new tokens and revoke old ones periodically
- Use minimal permissions - Only grant the permissions each token needs
- Monitor token usage - Review API logs for unusual activity
Revoking Tokens
To revoke an API token:
- Go to Settings → API Keys
- Find the token you want to revoke
- Click the delete icon
- Confirm the revocation
Revoked tokens are immediately invalidated and cannot be used for any API requests.