API Secrets provide a secure, permanent way to authenticate with the WaterrAI API. Unlike JWT tokens which expire, API secrets never expire and can be revoked or reactivated as needed. They are ideal for server-to-server communication and automation.
Security: API secrets are hashed using bcrypt and never stored in plain text. The plain secret is only shown once during creation - make sure to save it immediately!
{ "status": "success", "message": "API secret created successfully", "data": { "id": 1, "name": "Production API Key", "secret": "wai_abc123def456789012345678901234567890123456789012345678901234567890", "secret_prefix": "wai_abc123de", "created_at": "2024-01-19T19:37:07.000Z", "warning": "Save this secret now. You won't be able to see it again!" }}
Important: The plain secret (secret field) is only returned once during creation. If you lose it, you’ll need to create a new API secret. The secret cannot be retrieved later.
Store API secrets in environment variables or secure secret management systems. Never commit them to version control.
Use Descriptive Names
Give your API secrets descriptive names (e.g., “Production”, “Staging”, “CI/CD”) to easily identify their purpose.
Rotate Regularly
Periodically rotate your API secrets, especially if they may have been compromised.
Revoke Unused Keys
Revoke API secrets that are no longer needed instead of deleting them, in case you need to reactivate them later.
Multiple Secrets: You can create multiple API secrets for different environments or services. Each secret is independent and can be managed separately.