Authentication & Security
Authentication & Security
Secure your API requests using API Keys and OAuth2 authorization flows.
The Plant Store API provides robust authentication mechanism options depending on the type of operation and client application:
- API Key Authentication: For server-to-server store operations, inventory queries, and administrative management.
- OAuth2 Authorization: For user-delegated plant management operations and third-party app integrations.
Authentication Schemes
1. API Key Authentication
API Keys are suitable for backend servers, daemon services, and server-side applications.
Sending the API Key
Include the api_key header in all HTTP requests targeting protected store endpoints:
Keep your API Keys secret. Never check API keys into client-side code, public GitHub repositories, or mobile app bundles. Use environment variables (e.g. PLANTSTORE_API_KEY) on your server.
2. OAuth2 Authorization
For operations modifying plant records, the API supports OAuth 2.0 with the following scopes:
write:plants: Grants permission to create, edit, and update plant entries.read:plants: Grants permission to view private or draft plant catalog entries.
OAuth2 Authorization Code Flow
Error Handling & Status Codes
When authentication fails or credentials are missing, the API returns consistent JSON error payloads:
401 Unauthorized Response
403 Forbidden Response