Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
REST API for Programmatic Experiment Management
This PR introduces a simple REST API for Deliberate Lab, enabling programmatic access to experiment management functionality from external applications and scripts.
Summary
Adds a complete REST API (
/api/v1) for creating, reading, updating, deleting, and exporting experiments. This allows researchers to automate experiment creation, integrate with external tools, and programmatically manage their research workflows using any HTTP client.Key Features
API Endpoints
POST /v1/experiments- Create experiments with stage configurationsGET /v1/experiments- List all accessible experimentsGET /v1/experiments/:id- Get specific experiment detailsPUT /v1/experiments/:id- Update experiment metadata and stagesDELETE /v1/experiments/:id- Delete experiments with all associated dataGET /v1/experiments/:id/export- Export complete experiment data (participants, responses, chat logs, etc.)GET /v1/health- API health check (no authentication required)Authentication & Security
API Key Management
The Settings page now includes an API Keys section where users can:
Integration Testing
Comprehensive integration test suite (
experiments.api.integration.test.ts) that validates:Implementation Details
Backend Architecture (
functions/src/dl_api/)Express-based REST API (
api.endpoints.ts):Experiment Operations (
experiments.api.ts):API Key Management (
api_key.utils.ts):dlb_live_<random_string>for easy identificationShared Utilities (
api.utils.ts):Documentation
OpenAPI Specification (
docs/api/openapi.yaml):/developers/api.html