API Authentication

The SDK supports API key authentication for backend services and server-side applications. When an API key is provided, it will be automatically included in all HTTP requests to v1 API endpoints.

Environment Setup

First, set up your environment variables in a .env file:

# Copy the example file
cp .env.example .env

# Edit .env and add your API key
SDK_API_KEY=your-directus-jwt-token-or-static-api-key