[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75KHGQ26SWPPF80GQSXZETM":3,"skill-same:01M75KHGQ26SWPPF80GQSXZETM":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M75KHGQ26SWPPF80GQSXZETM","eln-elabftw",null,"eLabFTW open-source electronic lab notebook via REST API. Self-hosted ELN\u002FLIMS alternative to Benchling and LabArchives: experiments, database entries, inventory, equipment booking, experiments linking. Use for free, open lab notebook management. For chemistry-focused work use eln-chemotion; for assay\u002FLIMS-heavy pipelines use eln-openbis.","pradyumnasagar\u002Fopen-research-skills","pradyumnasagar","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F10559871?v=4","01M75K78MYCCVKRTYGT8KKC380","Pradyumna Jayaram","01M75K78NTNE41F2PE1XBVFHAS",8,"MIT","https:\u002F\u002Fgithub.com\u002Fpradyumnasagar\u002Fopen-research-skills\u002Fblob\u002Fmain\u002Fskills\u002Flab-automation\u002Feln-elabftw\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\n\nname: eln-elabftw\ndescription: \"eLabFTW open-source electronic lab notebook via REST API. Self-hosted ELN\u002FLIMS alternative to Benchling and LabArchives: experiments, database entries, inventory, equipment booking, experiments linking. Use for free, open lab notebook management. For chemistry-focused work use eln-chemotion; for assay\u002FLIMS-heavy pipelines use eln-openbis.\"\nlicense: MIT\n---\n\u003C!-- metadata:\n  category: lab-automation\n  oversight: low\n  version: 1.0.0\n  author: Pradyumna Jayaram\n  tags: [lab-automation, research]\n  difficulty: intermediate\n-->\n\n# eLabFTW Electronic Lab Notebook\n\n## Hard rules\n\n1. **No fabricated citations.** Every cited work must resolve to a verifiable\n2. **No claim without provenance.** Every quantitative or factual claim\n3. **No silent failure.** Every script invocation, API call, or tool use must declare its exit status and what to do on non-zero. A skill that silently swallows errors is a violation.\n\n## Overview\n\neLabFTW is a free, self-hostable electronic lab notebook with a complete REST API. It is the standard open-source alternative to Benchling and LabArchives for academic and small-industry labs. eLabFTW stores experiments, database entries (reagents, plasmids, cells, antibodies, equipment), inventory with locations and barcodes, equipment bookings, and inter-experiment links — all in a single instance your group controls. Authentication is by API key or email\u002Fpassword; users can sign in with local accounts or institutional SSO via LDAP\u002FOIDC. The API exposes every UI action, so the full lab-notebook workflow is scriptable from Python.\n\nAuthor: Pradyumna Jayaram.\n\n## When to Use\n\n- Replacing or supplementing paper lab notebooks with a free, self-hosted ELN\n- Tracking experiments with linked reagents, cells, and protocols without paying for Benchling or LabArchives seats\n- Building a small group inventory system (boxes, locations, freezer maps) tied to experiments\n- Booking shared equipment (qPCR machines, microscopes, FACS) with an open scheduler\n- Scripting experiment creation from Opentrons runs, plate readers, or imaging pipelines\n- Bulk-importing legacy experiments or reagents from spreadsheets\n- Auditing a lab notebook's chain of custody (locked entries, signatures, timestamps)\n- For **chemistry-specific** molecule and reaction handling, use `eln-chemotion` instead — eLabFTW has no built-in molecule editor\n- For **large LIMS workflows** (sample tracking across a facility, multi-user permissions, integration with instruments), use `eln-openbis` instead\n\n## Prerequisites\n\n- **eLabFTW instance**: self-hosted (Docker recommended) or shared server. See https:\u002F\u002Fwww.elabftw.net\n- **API key**: generated in user profile (`Profile → API keys`); or use email + password\n- **Python packages**: `requests`, `pandas`\n- **Network**: HTTPS access to the eLabFTW host\n- **Optional**: `pyelabftw` — official community Python wrapper (currently thin; many workflows still use plain `requests`)\n\n```bash\npip install requests pandas\n# Optional community wrapper\n# pip install pyelabftw\n```\n\n## Quick Start\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\"\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\", \"Accept\": \"application\u002Fjson\"}\n\n# Create a new experiment\nr = requests.post(\n    f\"{API}\u002Fexperiments\",\n    headers=headers,\n    auth=auth,\n    json={\"title\": \"CRISPR screen — 2026-06-10 — replicate 1\"},\n)\nr.raise_for_status()\nexp = r.json()\nprint(f\"Created experiment id={exp['id']} title={exp['title']}\")\n```\n\n## Authentication\n\neLabFTW supports three authentication modes for the API. Choose based on your security posture.\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\n\n# Option 1: API key (preferred for scripts)\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\n\n# Option 2: email + password (only for one-off scripts; do not commit creds)\nauth = HTTPBasicAuth(\"jane@example.org\", os.environ[\"ELN_PASSWORD\"])\n\n# Option 3: Bearer token (when SSO\u002FOIDC is configured)\nheaders = {\"Authorization\": f\"Bearer {os.environ['ELN_BEARER']}\"}\n# requests.get(API + \"\u002Fexperiments\", headers=headers)\n```\n\nAPI keys inherit the user's permissions. Generate a separate key per script, and rotate when a student or postdoc leaves the lab.\n\n## Core API\n\n### Module 1: Experiments (the lab notebook)\n\nExperiments are the core ELN entity. They have rich-text bodies, attached files, links to database items, and a lock-on-signature workflow.\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\"}\n\n# Create an experiment\nbody = \"\"\"\u003Ch2>Goal\u003C\u002Fh2>\u003Cp>Test three gRNA designs for BRCA1 knockout.\u003C\u002Fp>\n\u003Ch2>Protocol\u003C\u002Fh2>\u003Cp>Lipofect Cas9 RNP into HEK293T; harvest at 72h.\u003C\u002Fp>\"\"\"\nr = requests.post(f\"{API}\u002Fexperiments\", headers=headers, auth=auth,\n                  json={\"title\": \"BRCA1 gRNA screen 2026-06-10\", \"body\": body})\nexp = r.json()\nprint(f\"Created: id={exp['id']} url=https:\u002F\u002Feln.example.org\u002Fexperiments.php?mode=view&id={exp['id']}\")\n\n# Append to an experiment body\nr = requests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\", headers=headers, auth=auth,\n                  json={\"bodyappend\": \"\u003Ch2>2026-06-11\u003C\u002Fh2>\u003Cp>Transfected; cells look healthy.\u003C\u002Fp>\"})\n\n# Add a comment (visible to all users with read access)\nrequests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\u002Fcomments\", headers=headers, auth=auth,\n              json={\"comment\": \"Lysis buffer ran out — reordered NEB B7203.\"})\n\n# Lock the experiment (prevents further edits; recorded in the audit log)\nrequests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\", headers=headers, auth=auth,\n              json={\"action\": \"lock\"})\n```\n\n```python\n# Read experiment with linked items\nr = requests.get(f\"{API}\u002Fexperiments\u002F{exp_id}\", auth=auth)\ndata = r.json()\nprint(f\"Title: {data['title']}\")\nprint(f\"Status: {data['category_title']} | Date: {data['date']}\")\nprint(f\"Linked items: {len(data.get('items_links', []))}\")\nprint(f\"Tags: {data.get('tags', [])}\")\n```\n\n### Module 2: Database items (reagents, plasmids, cells, antibodies)\n\nDatabase items are typed records (your lab can define custom types) that get linked into experiments. Use them for everything reusable: plasmid stocks, antibody lots, cell lines, primers.\n\n```python\n# Create a plasmid database item\npayload = {\n    \"category_id\": 4,  # find via GET \u002Fitems_types\n    \"title\": \"pX330-BRCA1-g1\",\n    \"body\": \"\u003Cp>Cas9 + BRCA1 gRNA #1 from Addgene #XXXXX.\u003C\u002Fp>\",\n    \"metadata\": {\"resistance\": \"AmpR\", \"insert\": \"BRCA1 gRNA #1\", \"promoter\": \"U6\"},\n    \"tags\": [\"crispr\", \"brca1\"],\n}\nr = requests.post(f\"{API}\u002Fitems\", headers=headers, auth=auth, json=payload)\nitem = r.json()\nprint(f\"Plasmid id={item['id']} title={item['title']}\")\n\n# Link a database item to an experiment\nrequests.post(f\"{API}\u002Fexperiments\u002F{exp_id}\u002Flinks\", headers=headers, auth=auth,\n              json={\"item_id\": item[\"id\"]})\n\n# Search database items\nr = requests.get(f\"{API}\u002Fitems\", auth=auth,\n                 params={\"q\": \"BRCA1\", \"limit\": 20})\nhits = r.json()\nprint(f\"Found {len(hits)} items matching 'BRCA1'\")\nfor h in hits[:5]:\n    print(f\"  id={h['id']} {h['title']}\")\n```\n\n```python\n# Update metadata (e.g., add a qc result to a plasmid item)\nr = requests.patch(f\"{API}\u002Fitems\u002F{item['id']}\", headers=headers, auth=auth,\n                   json={\"metadata\": {\"resistance\": \"AmpR\", \"qc_sanger\": \"passed 2026-06-12\"}})\n```\n\n### Module 3: Inventory (storage locations and containers)\n\neLabFTW tracks physical locations (freezers, shelves, rooms) and the containers (boxes, plates, tubes) inside them. Every container has a barcode string and a parent location.\n\n```python\n# List storage locations\nr = requests.get(f\"{API}\u002Fstorage\", auth=auth)\nlocations = r.json()\nfor loc in locations[:5]:\n    print(f\"  {loc['id']}: {loc['name']} ({loc['location_type']})\")\n```\n\n```python\n# Create a container (e.g., a 96-well plate in a freezer box)\ncontainer_payload = {\n    \"title\": \"Plate 2026-06-10 BRCA1 screen\",\n    \"location_id\": 3,                # parent storage location\n    \"container_type\": \"96-well plate\",\n    \"barcode\": \"PLT-2026-06-10-A\",\n    \"metadata\": {\"assay\": \"BRCA1 CRISPR screen\", \"date\": \"2026-06-10\"},\n}\nr = requests.post(f\"{API}\u002Fcontainers\", headers=headers, auth=auth, json=container_payload)\nc = r.json()\nprint(f\"Container id={c['id']} barcode={c['barcode']}\")\n\n# Add stored items (e.g., each well = a sample database item)\nrequests.post(f\"{API}\u002Fcontainers\u002F{c['id']}\u002Fitems\", headers=headers, auth=auth,\n              json={\"item_id\": item[\"id\"], \"position\": \"A1\"})\n```\n\n### Module 4: Equipment and bookings\n\neLabFTW has a built-in scheduler for shared equipment with conflict detection.\n\n```python\n# List bookable equipment\nr = requests.get(f\"{API}\u002Fteam_events\u002Fresources\", auth=auth)\nfor r_ in r.json():\n    print(f\"  {r_['id']}: {r_['name']} (category {r_['category_id']})\")\n\n# Book a 2-hour window on the qPCR machine\nfrom datetime import datetime, timedelta\nstart = datetime.utcnow().replace(microsecond=0).isoformat() + \"Z\"\nend   = (datetime.utcnow() + timedelta(hours=2)).isoformat() + \"Z\"\n\nr = requests.post(f\"{API}\u002Fteam_events\", headers=headers, auth=auth,\n                  json={\n                      \"item_id\": 7,           # the equipment database item id\n                      \"title\": \"qPCR — BRCA1 screen validation\",\n                      \"start\": start,\n                      \"end\": end,\n                      \"book_is_full\": False,\n                  })\nprint(\"Booking response:\", r.status_code, r.text[:120])\n```\n\n### Module 5: Files (uploads to experiments and items)\n\nAttach images, PDFs, plate-reader output, gel images, and sequence files. eLabFTW handles long-term storage and offers per-file access control.\n\n```python\n# Upload a file to an experiment\nwith open(\"gel_image.jpg\", \"rb\") as f:\n    r = requests.post(\n        f\"{API}\u002Fexperiments\u002F{exp_id}\u002Fuploads\",\n        auth=auth,\n        files={\"file\": (\"gel_image.jpg\", f, \"image\u002Fjpeg\")},\n        data={\"comment\": \"Agarose gel — BRCA1 PCR products\"},\n    )\nprint(\"Upload status:\", r.status_code, r.json().get(\"real_name\", \"\"))\n\n# Long-term storage: eLabFTW supports archive mode where files are checksummed\n# and signed; verify via GET \u002Fexperiments\u002F{id}\u002Fuploads\nr = requests.get(f\"{API}\u002Fexperiments\u002F{exp_id}\u002Fuploads\", auth=auth)\nfor u in r.json():\n    print(f\"  {u['real_name']} sha256={u.get('hash', 'n\u002Fa')[:16]}…\")\n```\n\n### Module 6: Search, tags, and audit log\n\n```python\n# Full-text search across experiments and items\nr = requests.get(f\"{API}\u002Fexperiments\", auth=auth,\n                 params={\"q\": \"BRCA1\", \"limit\": 20})\nfor e in r.json():\n    print(f\"  exp {e['id']}: {e['title']} (tags: {e.get('tags', [])})\")\n\n# Audit log (who did what, when) — for compliance\nr = requests.get(f\"{API}\u002Fexperiments\u002F{exp_id}\u002Frevisions\", auth=auth)\nfor rev in r.json():\n    print(f\"  {rev['created_at']} by user {rev['userid']}: {rev['body_diff'][:80]}\")\n```\n\n## Key Concepts\n\n### Permission tiers\n\n| Role | Can read | Can write | Can lock | Can administer |\n|------|---------|-----------|---------|----------------|\n| Anonymous (if enabled) | yes | no | no | no |\n| User | yes | yes | own experiments | no |\n| Admin | yes | yes | any | yes |\n\nAPI keys inherit the role of the user that issued them. For shared automations, create a service account with the minimum role needed.\n\n### Locking and signing\n\nOnce an experiment is locked, its body cannot be edited. A timestamp and a SHA-256 hash of the body are recorded. Use this to anchor an experiment to a point in time, satisfying electronic-signature requirements (FDA 21 CFR Part 11 in regulated contexts). The `lock` and `timestamp` actions are exposed via the API.\n\n### Tags vs categories\n\n- **Category** (status): one of the lab-defined statuses — e.g., \"Running\", \"Completed\", \"Abandoned\". Drives workflow reporting.\n- **Tags**: free-form labels for search and grouping — e.g., \"crispr\", \"screen-2026\".\n\n```python\n# Set category and tags\nrequests.patch(f\"{API}\u002Fexperiments\u002F{exp_id}\", headers=headers, auth=auth,\n               json={\"category_id\": 5, \"tags\": [\"crispr\", \"screen-2026\", \"priority-high\"]})\n```\n\n## Common Workflows\n\n### Workflow 1: Record an Opentrons run\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\"}\n\n# Create the experiment\nr = requests.post(f\"{API}\u002Fexperiments\", headers=headers, auth=auth,\n                  json={\n                      \"title\": \"Opentrons OT-2 run — 2026-06-10 — plate reformat\",\n                      \"body\": \"\u003Ch2>Run\u003C\u002Fh2>\u003Cp>96->96 plate stamp, fresh tips.\u003C\u002Fp>\",\n                      \"tags\": [\"opentrons\", \"plate-reformat\"],\n                  })\nexp = r.json()\n\n# Link the source and destination plate database items\nfor item_id in (12, 13):\n    requests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\u002Flinks\", headers=headers,\n                  auth=auth, json={\"item_id\": item_id})\n\n# Append the run log\nlog_path = \"opentrons_run_log.txt\"\nwith open(log_path) as f:\n    log = f.read()\nrequests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\", headers=headers, auth=auth,\n              json={\"bodyappend\": f\"\u003Ch2>Run log\u003C\u002Fh2>\u003Cpre>{log}\u003C\u002Fpre>\"})\n\n# Upload the run log file\nwith open(log_path, \"rb\") as f:\n    requests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\u002Fuploads\", auth=auth,\n                  files={\"file\": (log_path, f, \"text\u002Fplain\")})\n\nprint(f\"Run recorded: https:\u002F\u002Feln.example.org\u002Fexperiments.php?mode=view&id={exp['id']}\")\n```\n\n### Workflow 2: Bulk import reagents from a CSV\n\n```python\nimport csv\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\"}\n\ndef get_or_create_item_type(name, color=\"#3366CC\"):\n    \"\"\"Return id of an item type, creating it if it does not exist.\"\"\"\n    types = requests.get(f\"{API}\u002Fitems_types\", auth=auth).json()\n    for t in types:\n        if t[\"title\"] == name:\n            return t[\"id\"]\n    r = requests.post(f\"{API}\u002Fitems_types\", headers=headers, auth=auth,\n                      json={\"title\": name, \"color\": color})\n    return r.json()[\"id\"]\n\nreagent_type = get_or_create_item_type(\"Reagents\")\ncreated = []\nwith open(\"reagents.csv\") as f:\n    for row in csv.DictReader(f):\n        r = requests.post(f\"{API}\u002Fitems\", headers=headers, auth=auth, json={\n            \"category_id\": reagent_type,\n            \"title\": row[\"name\"],\n            \"metadata\": {\"vendor\": row[\"vendor\"], \"catalog\": row[\"catalog\"], \"lot\": row[\"lot\"]},\n            \"tags\": [t.strip() for t in row.get(\"tags\", \"\").split(\";\") if t.strip()],\n        })\n        if r.ok:\n            created.append(r.json()[\"id\"])\nprint(f\"Imported {len(created)} reagents\")\n```\n\n### Workflow 3: Generate an experiment summary report\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\nimport pandas as pd\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\n\nr = requests.get(f\"{API}\u002Fexperiments\", auth=auth, params={\"limit\": 200})\nexps = r.json()\ndf = pd.DataFrame([{\n    \"id\": e[\"id\"],\n    \"title\": e[\"title\"],\n    \"status\": e.get(\"category_title\", \"\"),\n    \"date\": e.get(\"date\", \"\"),\n    \"tags\": \";\".join(e.get(\"tags\", [])),\n} for e in exps])\ndf.to_csv(\"experiment_summary.csv\", index=False)\nprint(f\"Wrote {len(df)} experiments to experiment_summary.csv\")\n```\n\n## Key Parameters\n\n| Parameter | Endpoint | Default | Range \u002F Options | Effect |\n|-----------|----------|---------|-----------------|--------|\n| `category_id` | experiments, items | required | int | Status \u002F item type id; use `GET \u002Fitems_types` to list |\n| `tags` | experiments, items | `[]` | list of strings | Free-form labels for search |\n| `body` | experiments, items | `\"\"` | HTML string | Long-form rich-text content |\n| `bodyappend` | experiments | — | HTML string | Append HTML to existing body |\n| `metadata` | items | `{}` | JSON object | Typed fields for the item type |\n| `limit` | list endpoints | `50` | `1`–`100` | Page size |\n| `offset` | list endpoints | `0` | int | Pagination offset |\n| `q` | list endpoints | — | string | Full-text search query |\n| `barcode` | containers | optional | string | Physical barcode; unique per container |\n\n## Best Practices\n\n1. **Treat the API key as a password.** Use environment variables, never commit. Rotate when a user leaves the lab.\n\n2. **Lock experiments only when truly done.** Locking is irreversible without admin intervention. Use the lock as the boundary between \"in progress\" and \"archived\".\n\n3. **Use database items, not free-text bodies, for reusable reagents.** A well-typed reagent item with metadata (vendor, lot, storage location) is searchable, linkable, and version-controlled across all your experiments.\n\n4. **Tag with a project prefix.** A consistent tag scheme like `screen-2026`, `gfp-trap`, `screen-2026-q2` makes group-wide queries simple.\n\n5. **Backup before bulk operations.** `POST \u002Fitems\u002Fbulk` and `PATCH \u002Fexperiments\u002F{id}` are fast; an `items_types` table wipe is faster. Snapshot the database before any large migration.\n\n6. **Prefer `PATCH` over repeated `POST`.** Some endpoints accept an `action` field (e.g., `lock`); others require `PATCH` for partial updates. Check the API docs for each resource.\n\n7. **Link early.** Linking a database item to an experiment at creation time (not after) keeps your inventory map accurate.\n\n8. **Use the audit log for compliance.** eLabFTW records every edit; for regulated work, the `revisions` endpoint gives a tamper-evident timeline of who changed what.\n\n## Common Recipes\n\n### Recipe: Find all experiments using a specific reagent\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\n\nreagent_id = 4711\n# eLabFTW stores link tables; query the link endpoint for the item\nr = requests.get(f\"{API}\u002Fitems\u002F{reagent_id}\u002Fexperiments\", auth=auth)\nprint(f\"Reagent {reagent_id} used in {len(r.json())} experiments\")\nfor e in r.json():\n    print(f\"  exp {e['id']} {e['title']}\")\n```\n\n### Recipe: Lock and sign an experiment\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\"}\n\nexp_id = 12345\n# Lock creates a SHA-256 hash of the body, recorded with timestamp and user\nr = requests.post(f\"{API}\u002Fexperiments\u002F{exp_id}\", headers=headers, auth=auth,\n                  json={\"action\": \"lock\"})\nprint(\"Lock response:\", r.status_code, r.json().get(\"locked_at\", \"\"))\n```\n\n### Recipe: Book a microscope for a time block\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\nfrom datetime import datetime, timedelta\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\"}\n\nstart = datetime.utcnow().replace(microsecond=0, second=0, minute=0)\nend   = start + timedelta(hours=2)\nr = requests.post(f\"{API}\u002Fteam_events\", headers=headers, auth=auth, json={\n    \"item_id\": 9,                          # microscope database item\n    \"title\": \"Confocal — BRCA1 screen imaging\",\n    \"start\": start.isoformat() + \"Z\",\n    \"end\":   end.isoformat() + \"Z\",\n})\nprint(\"Booking:\", r.status_code, r.json().get(\"id\", r.text))\n```\n\n## Expected Outputs\n\n- A web URL for each created experiment: `https:\u002F\u002F\u003Chost>\u002Fexperiments.php?mode=view&id=\u003Cid>`\n- Database item URLs: `https:\u002F\u002F\u003Chost>\u002Fdatabase.php?mode=view&id=\u003Cid>`\n- File attachments stored on the eLabFTW instance filesystem; downloadable from the experiment page\n- JSON responses from the API; the same data is visible in the eLabFTW web UI\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `401 Unauthorized` | Wrong credentials, expired API key | Regenerate the key in user profile; check `ELN_USERNAME` and `ELN_API_KEY` env vars |\n| `403 Forbidden` | User lacks write access | Ask the lab admin to elevate the user role; or use a different API key |\n| `404 Not Found` | Wrong id, or resource is in another team | Confirm the experiment\u002Fitem id; eLabFTW scopes by team — check that the API key belongs to the right team |\n| `400` on body content | Invalid HTML or oversized body | Strip `\u003Cscript>` tags; eLabFTW sanitizes but rejects malformed HTML; check the body size limit in your config |\n| Files fail to upload | Filesystem full, or wrong perms | Check the eLabFTW `ELABFTW_UPLOAD_DIR`; default `\u002Fvar\u002Felabftw\u002Fuploads\u002F` |\n| Search returns nothing | Index not built | Run `bin\u002Fconsole experimpent-types:update` (or the v5 equivalent) to rebuild the search index |\n| Locked experiment edits fail | Locked state | Locked experiments are read-only by design. Re-open requires admin; the API does not expose a clean \"unlock\" for compliance reasons |\n\n## References\n\n- [eLabFTW official documentation](https:\u002F\u002Fdoc.elabftw.net\u002F) — install, configure, API\n- [eLabFTW API reference (v2)](https:\u002F\u002Fdoc.elabftw.net\u002Fapi\u002F) — full endpoint catalog\n- [eLabFTW GitHub repository](https:\u002F\u002Fgithub.com\u002Felabftw\u002Felabftw) — source code and releases\n- [eLabFTW Docker image](https:\u002F\u002Fhub.docker.com\u002Fr\u002Felabftw\u002Felabftw) — quick self-host\n- [eLabFTW community forum](https:\u002F\u002Fgithub.com\u002Felabftw\u002Felabftw\u002Fdiscussions) — Q&A and announcements\n\n## Related Skills\n\n- `eln-chemotion` — open chemistry ELN with built-in molecule editor and reaction handling\n- `eln-openbis` — open LIMS\u002FELN designed for high-throughput assay and sample tracking\n- `protocolsio-protocol-repository` — search and import published protocols\n- `opentrons-ot2-protocols` — automated liquid-handling protocols; record runs in eLabFTW\n- `plannotate-plasmid-annotation` — annotate plasmid database items before linking to experiments\n\n## Cross-references\n\nOther skills in this category:\n\n- eln-chemotion\n- eln-openbis\n- opentrons-ot2-protocols\n- protocolsio-protocol-repository\n- pylabrobot-vendor-agnostic\n\n## Changelog\n\n- **1.1.0** (migration) — Bulk-migrated to v0.4.0 schema: canonical\n  metadata block, base Hard rules, Cross-references. Body content\n  unchanged; author should review and fill in any domain-specific\n  extensions to the Hard rules.\n- **1.0.0** — Initial release.\n\n","\u003C!-- metadata:\n  category: lab-automation\n  oversight: low\n  version: 1.0.0\n  author: Pradyumna Jayaram\n  tags: [lab-automation, research]\n  difficulty: intermediate\n-->\n\n# eLabFTW Electronic Lab Notebook\n\n## Hard rules\n\n1. **No fabricated citations.** Every cited work must resolve to a verifiable\n2. **No claim without provenance.** Every quantitative or factual claim\n3. **No silent failure.** Every script invocation, API call, or tool use must declare its exit status and what to do on non-zero. A skill that silently swallows errors is a violation.\n\n## Overview\n\neLabFTW is a free, self-hostable electronic lab notebook with a complete REST API. It is the standard open-source alternative to Benchling and LabArchives for academic and small-industry labs. eLabFTW stores experiments, database entries (reagents, plasmids, cells, antibodies, equipment), inventory with locations and barcodes, equipment bookings, and inter-experiment links — all in a single instance your group controls. Authentication is by API key or email\u002Fpassword; users can sign in with local accounts or institutional SSO via LDAP\u002FOIDC. The API exposes every UI action, so the full lab-notebook workflow is scriptable from Python.\n\nAuthor: Pradyumna Jayaram.\n\n## When to Use\n\n- Replacing or supplementing paper lab notebooks with a free, self-hosted ELN\n- Tracking experiments with linked reagents, cells, and protocols without paying for Benchling or LabArchives seats\n- Building a small group inventory system (boxes, locations, freezer maps) tied to experiments\n- Booking shared equipment (qPCR machines, microscopes, FACS) with an open scheduler\n- Scripting experiment creation from Opentrons runs, plate readers, or imaging pipelines\n- Bulk-importing legacy experiments or reagents from spreadsheets\n- Auditing a lab notebook's chain of custody (locked entries, signatures, timestamps)\n- For **chemistry-specific** molecule and reaction handling, use `eln-chemotion` instead — eLabFTW has no built-in molecule editor\n- For **large LIMS workflows** (sample tracking across a facility, multi-user permissions, integration with instruments), use `eln-openbis` instead\n\n## Prerequisites\n\n- **eLabFTW instance**: self-hosted (Docker recommended) or shared server. See https:\u002F\u002Fwww.elabftw.net\n- **API key**: generated in user profile (`Profile → API keys`); or use email + password\n- **Python packages**: `requests`, `pandas`\n- **Network**: HTTPS access to the eLabFTW host\n- **Optional**: `pyelabftw` — official community Python wrapper (currently thin; many workflows still use plain `requests`)\n\n```bash\npip install requests pandas\n# Optional community wrapper\n# pip install pyelabftw\n```\n\n## Quick Start\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\"\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\", \"Accept\": \"application\u002Fjson\"}\n\n# Create a new experiment\nr = requests.post(\n    f\"{API}\u002Fexperiments\",\n    headers=headers,\n    auth=auth,\n    json={\"title\": \"CRISPR screen — 2026-06-10 — replicate 1\"},\n)\nr.raise_for_status()\nexp = r.json()\nprint(f\"Created experiment id={exp['id']} title={exp['title']}\")\n```\n\n## Authentication\n\neLabFTW supports three authentication modes for the API. Choose based on your security posture.\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\n\n# Option 1: API key (preferred for scripts)\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\n\n# Option 2: email + password (only for one-off scripts; do not commit creds)\nauth = HTTPBasicAuth(\"jane@example.org\", os.environ[\"ELN_PASSWORD\"])\n\n# Option 3: Bearer token (when SSO\u002FOIDC is configured)\nheaders = {\"Authorization\": f\"Bearer {os.environ['ELN_BEARER']}\"}\n# requests.get(API + \"\u002Fexperiments\", headers=headers)\n```\n\nAPI keys inherit the user's permissions. Generate a separate key per script, and rotate when a student or postdoc leaves the lab.\n\n## Core API\n\n### Module 1: Experiments (the lab notebook)\n\nExperiments are the core ELN entity. They have rich-text bodies, attached files, links to database items, and a lock-on-signature workflow.\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\"}\n\n# Create an experiment\nbody = \"\"\"\u003Ch2>Goal\u003C\u002Fh2>\u003Cp>Test three gRNA designs for BRCA1 knockout.\u003C\u002Fp>\n\u003Ch2>Protocol\u003C\u002Fh2>\u003Cp>Lipofect Cas9 RNP into HEK293T; harvest at 72h.\u003C\u002Fp>\"\"\"\nr = requests.post(f\"{API}\u002Fexperiments\", headers=headers, auth=auth,\n                  json={\"title\": \"BRCA1 gRNA screen 2026-06-10\", \"body\": body})\nexp = r.json()\nprint(f\"Created: id={exp['id']} url=https:\u002F\u002Feln.example.org\u002Fexperiments.php?mode=view&id={exp['id']}\")\n\n# Append to an experiment body\nr = requests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\", headers=headers, auth=auth,\n                  json={\"bodyappend\": \"\u003Ch2>2026-06-11\u003C\u002Fh2>\u003Cp>Transfected; cells look healthy.\u003C\u002Fp>\"})\n\n# Add a comment (visible to all users with read access)\nrequests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\u002Fcomments\", headers=headers, auth=auth,\n              json={\"comment\": \"Lysis buffer ran out — reordered NEB B7203.\"})\n\n# Lock the experiment (prevents further edits; recorded in the audit log)\nrequests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\", headers=headers, auth=auth,\n              json={\"action\": \"lock\"})\n```\n\n```python\n# Read experiment with linked items\nr = requests.get(f\"{API}\u002Fexperiments\u002F{exp_id}\", auth=auth)\ndata = r.json()\nprint(f\"Title: {data['title']}\")\nprint(f\"Status: {data['category_title']} | Date: {data['date']}\")\nprint(f\"Linked items: {len(data.get('items_links', []))}\")\nprint(f\"Tags: {data.get('tags', [])}\")\n```\n\n### Module 2: Database items (reagents, plasmids, cells, antibodies)\n\nDatabase items are typed records (your lab can define custom types) that get linked into experiments. Use them for everything reusable: plasmid stocks, antibody lots, cell lines, primers.\n\n```python\n# Create a plasmid database item\npayload = {\n    \"category_id\": 4,  # find via GET \u002Fitems_types\n    \"title\": \"pX330-BRCA1-g1\",\n    \"body\": \"\u003Cp>Cas9 + BRCA1 gRNA #1 from Addgene #XXXXX.\u003C\u002Fp>\",\n    \"metadata\": {\"resistance\": \"AmpR\", \"insert\": \"BRCA1 gRNA #1\", \"promoter\": \"U6\"},\n    \"tags\": [\"crispr\", \"brca1\"],\n}\nr = requests.post(f\"{API}\u002Fitems\", headers=headers, auth=auth, json=payload)\nitem = r.json()\nprint(f\"Plasmid id={item['id']} title={item['title']}\")\n\n# Link a database item to an experiment\nrequests.post(f\"{API}\u002Fexperiments\u002F{exp_id}\u002Flinks\", headers=headers, auth=auth,\n              json={\"item_id\": item[\"id\"]})\n\n# Search database items\nr = requests.get(f\"{API}\u002Fitems\", auth=auth,\n                 params={\"q\": \"BRCA1\", \"limit\": 20})\nhits = r.json()\nprint(f\"Found {len(hits)} items matching 'BRCA1'\")\nfor h in hits[:5]:\n    print(f\"  id={h['id']} {h['title']}\")\n```\n\n```python\n# Update metadata (e.g., add a qc result to a plasmid item)\nr = requests.patch(f\"{API}\u002Fitems\u002F{item['id']}\", headers=headers, auth=auth,\n                   json={\"metadata\": {\"resistance\": \"AmpR\", \"qc_sanger\": \"passed 2026-06-12\"}})\n```\n\n### Module 3: Inventory (storage locations and containers)\n\neLabFTW tracks physical locations (freezers, shelves, rooms) and the containers (boxes, plates, tubes) inside them. Every container has a barcode string and a parent location.\n\n```python\n# List storage locations\nr = requests.get(f\"{API}\u002Fstorage\", auth=auth)\nlocations = r.json()\nfor loc in locations[:5]:\n    print(f\"  {loc['id']}: {loc['name']} ({loc['location_type']})\")\n```\n\n```python\n# Create a container (e.g., a 96-well plate in a freezer box)\ncontainer_payload = {\n    \"title\": \"Plate 2026-06-10 BRCA1 screen\",\n    \"location_id\": 3,                # parent storage location\n    \"container_type\": \"96-well plate\",\n    \"barcode\": \"PLT-2026-06-10-A\",\n    \"metadata\": {\"assay\": \"BRCA1 CRISPR screen\", \"date\": \"2026-06-10\"},\n}\nr = requests.post(f\"{API}\u002Fcontainers\", headers=headers, auth=auth, json=container_payload)\nc = r.json()\nprint(f\"Container id={c['id']} barcode={c['barcode']}\")\n\n# Add stored items (e.g., each well = a sample database item)\nrequests.post(f\"{API}\u002Fcontainers\u002F{c['id']}\u002Fitems\", headers=headers, auth=auth,\n              json={\"item_id\": item[\"id\"], \"position\": \"A1\"})\n```\n\n### Module 4: Equipment and bookings\n\neLabFTW has a built-in scheduler for shared equipment with conflict detection.\n\n```python\n# List bookable equipment\nr = requests.get(f\"{API}\u002Fteam_events\u002Fresources\", auth=auth)\nfor r_ in r.json():\n    print(f\"  {r_['id']}: {r_['name']} (category {r_['category_id']})\")\n\n# Book a 2-hour window on the qPCR machine\nfrom datetime import datetime, timedelta\nstart = datetime.utcnow().replace(microsecond=0).isoformat() + \"Z\"\nend   = (datetime.utcnow() + timedelta(hours=2)).isoformat() + \"Z\"\n\nr = requests.post(f\"{API}\u002Fteam_events\", headers=headers, auth=auth,\n                  json={\n                      \"item_id\": 7,           # the equipment database item id\n                      \"title\": \"qPCR — BRCA1 screen validation\",\n                      \"start\": start,\n                      \"end\": end,\n                      \"book_is_full\": False,\n                  })\nprint(\"Booking response:\", r.status_code, r.text[:120])\n```\n\n### Module 5: Files (uploads to experiments and items)\n\nAttach images, PDFs, plate-reader output, gel images, and sequence files. eLabFTW handles long-term storage and offers per-file access control.\n\n```python\n# Upload a file to an experiment\nwith open(\"gel_image.jpg\", \"rb\") as f:\n    r = requests.post(\n        f\"{API}\u002Fexperiments\u002F{exp_id}\u002Fuploads\",\n        auth=auth,\n        files={\"file\": (\"gel_image.jpg\", f, \"image\u002Fjpeg\")},\n        data={\"comment\": \"Agarose gel — BRCA1 PCR products\"},\n    )\nprint(\"Upload status:\", r.status_code, r.json().get(\"real_name\", \"\"))\n\n# Long-term storage: eLabFTW supports archive mode where files are checksummed\n# and signed; verify via GET \u002Fexperiments\u002F{id}\u002Fuploads\nr = requests.get(f\"{API}\u002Fexperiments\u002F{exp_id}\u002Fuploads\", auth=auth)\nfor u in r.json():\n    print(f\"  {u['real_name']} sha256={u.get('hash', 'n\u002Fa')[:16]}…\")\n```\n\n### Module 6: Search, tags, and audit log\n\n```python\n# Full-text search across experiments and items\nr = requests.get(f\"{API}\u002Fexperiments\", auth=auth,\n                 params={\"q\": \"BRCA1\", \"limit\": 20})\nfor e in r.json():\n    print(f\"  exp {e['id']}: {e['title']} (tags: {e.get('tags', [])})\")\n\n# Audit log (who did what, when) — for compliance\nr = requests.get(f\"{API}\u002Fexperiments\u002F{exp_id}\u002Frevisions\", auth=auth)\nfor rev in r.json():\n    print(f\"  {rev['created_at']} by user {rev['userid']}: {rev['body_diff'][:80]}\")\n```\n\n## Key Concepts\n\n### Permission tiers\n\n| Role | Can read | Can write | Can lock | Can administer |\n|------|---------|-----------|---------|----------------|\n| Anonymous (if enabled) | yes | no | no | no |\n| User | yes | yes | own experiments | no |\n| Admin | yes | yes | any | yes |\n\nAPI keys inherit the role of the user that issued them. For shared automations, create a service account with the minimum role needed.\n\n### Locking and signing\n\nOnce an experiment is locked, its body cannot be edited. A timestamp and a SHA-256 hash of the body are recorded. Use this to anchor an experiment to a point in time, satisfying electronic-signature requirements (FDA 21 CFR Part 11 in regulated contexts). The `lock` and `timestamp` actions are exposed via the API.\n\n### Tags vs categories\n\n- **Category** (status): one of the lab-defined statuses — e.g., \"Running\", \"Completed\", \"Abandoned\". Drives workflow reporting.\n- **Tags**: free-form labels for search and grouping — e.g., \"crispr\", \"screen-2026\".\n\n```python\n# Set category and tags\nrequests.patch(f\"{API}\u002Fexperiments\u002F{exp_id}\", headers=headers, auth=auth,\n               json={\"category_id\": 5, \"tags\": [\"crispr\", \"screen-2026\", \"priority-high\"]})\n```\n\n## Common Workflows\n\n### Workflow 1: Record an Opentrons run\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\"}\n\n# Create the experiment\nr = requests.post(f\"{API}\u002Fexperiments\", headers=headers, auth=auth,\n                  json={\n                      \"title\": \"Opentrons OT-2 run — 2026-06-10 — plate reformat\",\n                      \"body\": \"\u003Ch2>Run\u003C\u002Fh2>\u003Cp>96->96 plate stamp, fresh tips.\u003C\u002Fp>\",\n                      \"tags\": [\"opentrons\", \"plate-reformat\"],\n                  })\nexp = r.json()\n\n# Link the source and destination plate database items\nfor item_id in (12, 13):\n    requests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\u002Flinks\", headers=headers,\n                  auth=auth, json={\"item_id\": item_id})\n\n# Append the run log\nlog_path = \"opentrons_run_log.txt\"\nwith open(log_path) as f:\n    log = f.read()\nrequests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\", headers=headers, auth=auth,\n              json={\"bodyappend\": f\"\u003Ch2>Run log\u003C\u002Fh2>\u003Cpre>{log}\u003C\u002Fpre>\"})\n\n# Upload the run log file\nwith open(log_path, \"rb\") as f:\n    requests.post(f\"{API}\u002Fexperiments\u002F{exp['id']}\u002Fuploads\", auth=auth,\n                  files={\"file\": (log_path, f, \"text\u002Fplain\")})\n\nprint(f\"Run recorded: https:\u002F\u002Feln.example.org\u002Fexperiments.php?mode=view&id={exp['id']}\")\n```\n\n### Workflow 2: Bulk import reagents from a CSV\n\n```python\nimport csv\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\"}\n\ndef get_or_create_item_type(name, color=\"#3366CC\"):\n    \"\"\"Return id of an item type, creating it if it does not exist.\"\"\"\n    types = requests.get(f\"{API}\u002Fitems_types\", auth=auth).json()\n    for t in types:\n        if t[\"title\"] == name:\n            return t[\"id\"]\n    r = requests.post(f\"{API}\u002Fitems_types\", headers=headers, auth=auth,\n                      json={\"title\": name, \"color\": color})\n    return r.json()[\"id\"]\n\nreagent_type = get_or_create_item_type(\"Reagents\")\ncreated = []\nwith open(\"reagents.csv\") as f:\n    for row in csv.DictReader(f):\n        r = requests.post(f\"{API}\u002Fitems\", headers=headers, auth=auth, json={\n            \"category_id\": reagent_type,\n            \"title\": row[\"name\"],\n            \"metadata\": {\"vendor\": row[\"vendor\"], \"catalog\": row[\"catalog\"], \"lot\": row[\"lot\"]},\n            \"tags\": [t.strip() for t in row.get(\"tags\", \"\").split(\";\") if t.strip()],\n        })\n        if r.ok:\n            created.append(r.json()[\"id\"])\nprint(f\"Imported {len(created)} reagents\")\n```\n\n### Workflow 3: Generate an experiment summary report\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\nimport pandas as pd\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\n\nr = requests.get(f\"{API}\u002Fexperiments\", auth=auth, params={\"limit\": 200})\nexps = r.json()\ndf = pd.DataFrame([{\n    \"id\": e[\"id\"],\n    \"title\": e[\"title\"],\n    \"status\": e.get(\"category_title\", \"\"),\n    \"date\": e.get(\"date\", \"\"),\n    \"tags\": \";\".join(e.get(\"tags\", [])),\n} for e in exps])\ndf.to_csv(\"experiment_summary.csv\", index=False)\nprint(f\"Wrote {len(df)} experiments to experiment_summary.csv\")\n```\n\n## Key Parameters\n\n| Parameter | Endpoint | Default | Range \u002F Options | Effect |\n|-----------|----------|---------|-----------------|--------|\n| `category_id` | experiments, items | required | int | Status \u002F item type id; use `GET \u002Fitems_types` to list |\n| `tags` | experiments, items | `[]` | list of strings | Free-form labels for search |\n| `body` | experiments, items | `\"\"` | HTML string | Long-form rich-text content |\n| `bodyappend` | experiments | — | HTML string | Append HTML to existing body |\n| `metadata` | items | `{}` | JSON object | Typed fields for the item type |\n| `limit` | list endpoints | `50` | `1`–`100` | Page size |\n| `offset` | list endpoints | `0` | int | Pagination offset |\n| `q` | list endpoints | — | string | Full-text search query |\n| `barcode` | containers | optional | string | Physical barcode; unique per container |\n\n## Best Practices\n\n1. **Treat the API key as a password.** Use environment variables, never commit. Rotate when a user leaves the lab.\n\n2. **Lock experiments only when truly done.** Locking is irreversible without admin intervention. Use the lock as the boundary between \"in progress\" and \"archived\".\n\n3. **Use database items, not free-text bodies, for reusable reagents.** A well-typed reagent item with metadata (vendor, lot, storage location) is searchable, linkable, and version-controlled across all your experiments.\n\n4. **Tag with a project prefix.** A consistent tag scheme like `screen-2026`, `gfp-trap`, `screen-2026-q2` makes group-wide queries simple.\n\n5. **Backup before bulk operations.** `POST \u002Fitems\u002Fbulk` and `PATCH \u002Fexperiments\u002F{id}` are fast; an `items_types` table wipe is faster. Snapshot the database before any large migration.\n\n6. **Prefer `PATCH` over repeated `POST`.** Some endpoints accept an `action` field (e.g., `lock`); others require `PATCH` for partial updates. Check the API docs for each resource.\n\n7. **Link early.** Linking a database item to an experiment at creation time (not after) keeps your inventory map accurate.\n\n8. **Use the audit log for compliance.** eLabFTW records every edit; for regulated work, the `revisions` endpoint gives a tamper-evident timeline of who changed what.\n\n## Common Recipes\n\n### Recipe: Find all experiments using a specific reagent\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\n\nreagent_id = 4711\n# eLabFTW stores link tables; query the link endpoint for the item\nr = requests.get(f\"{API}\u002Fitems\u002F{reagent_id}\u002Fexperiments\", auth=auth)\nprint(f\"Reagent {reagent_id} used in {len(r.json())} experiments\")\nfor e in r.json():\n    print(f\"  exp {e['id']} {e['title']}\")\n```\n\n### Recipe: Lock and sign an experiment\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\"}\n\nexp_id = 12345\n# Lock creates a SHA-256 hash of the body, recorded with timestamp and user\nr = requests.post(f\"{API}\u002Fexperiments\u002F{exp_id}\", headers=headers, auth=auth,\n                  json={\"action\": \"lock\"})\nprint(\"Lock response:\", r.status_code, r.json().get(\"locked_at\", \"\"))\n```\n\n### Recipe: Book a microscope for a time block\n\n```python\nimport os\nimport requests\nfrom requests.auth import HTTPBasicAuth\nfrom datetime import datetime, timedelta\n\nAPI = \"https:\u002F\u002Feln.example.org\u002Fapi\u002Fv2\"\nauth = HTTPBasicAuth(os.environ[\"ELN_USERNAME\"], os.environ[\"ELN_API_KEY\"])\nheaders = {\"Content-Type\": \"application\u002Fjson\"}\n\nstart = datetime.utcnow().replace(microsecond=0, second=0, minute=0)\nend   = start + timedelta(hours=2)\nr = requests.post(f\"{API}\u002Fteam_events\", headers=headers, auth=auth, json={\n    \"item_id\": 9,                          # microscope database item\n    \"title\": \"Confocal — BRCA1 screen imaging\",\n    \"start\": start.isoformat() + \"Z\",\n    \"end\":   end.isoformat() + \"Z\",\n})\nprint(\"Booking:\", r.status_code, r.json().get(\"id\", r.text))\n```\n\n## Expected Outputs\n\n- A web URL for each created experiment: `https:\u002F\u002F\u003Chost>\u002Fexperiments.php?mode=view&id=\u003Cid>`\n- Database item URLs: `https:\u002F\u002F\u003Chost>\u002Fdatabase.php?mode=view&id=\u003Cid>`\n- File attachments stored on the eLabFTW instance filesystem; downloadable from the experiment page\n- JSON responses from the API; the same data is visible in the eLabFTW web UI\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `401 Unauthorized` | Wrong credentials, expired API key | Regenerate the key in user profile; check `ELN_USERNAME` and `ELN_API_KEY` env vars |\n| `403 Forbidden` | User lacks write access | Ask the lab admin to elevate the user role; or use a different API key |\n| `404 Not Found` | Wrong id, or resource is in another team | Confirm the experiment\u002Fitem id; eLabFTW scopes by team — check that the API key belongs to the right team |\n| `400` on body content | Invalid HTML or oversized body | Strip `\u003Cscript>` tags; eLabFTW sanitizes but rejects malformed HTML; check the body size limit in your config |\n| Files fail to upload | Filesystem full, or wrong perms | Check the eLabFTW `ELABFTW_UPLOAD_DIR`; default `\u002Fvar\u002Felabftw\u002Fuploads\u002F` |\n| Search returns nothing | Index not built | Run `bin\u002Fconsole experimpent-types:update` (or the v5 equivalent) to rebuild the search index |\n| Locked experiment edits fail | Locked state | Locked experiments are read-only by design. Re-open requires admin; the API does not expose a clean \"unlock\" for compliance reasons |\n\n## References\n\n- [eLabFTW official documentation](https:\u002F\u002Fdoc.elabftw.net\u002F) — install, configure, API\n- [eLabFTW API reference (v2)](https:\u002F\u002Fdoc.elabftw.net\u002Fapi\u002F) — full endpoint catalog\n- [eLabFTW GitHub repository](https:\u002F\u002Fgithub.com\u002Felabftw\u002Felabftw) — source code and releases\n- [eLabFTW Docker image](https:\u002F\u002Fhub.docker.com\u002Fr\u002Felabftw\u002Felabftw) — quick self-host\n- [eLabFTW community forum](https:\u002F\u002Fgithub.com\u002Felabftw\u002Felabftw\u002Fdiscussions) — Q&A and announcements\n\n## Related Skills\n\n- `eln-chemotion` — open chemistry ELN with built-in molecule editor and reaction handling\n- `eln-openbis` — open LIMS\u002FELN designed for high-throughput assay and sample tracking\n- `protocolsio-protocol-repository` — search and import published protocols\n- `opentrons-ot2-protocols` — automated liquid-handling protocols; record runs in eLabFTW\n- `plannotate-plasmid-annotation` — annotate plasmid database items before linking to experiments\n\n## Cross-references\n\nOther skills in this category:\n\n- eln-chemotion\n- eln-openbis\n- opentrons-ot2-protocols\n- protocolsio-protocol-repository\n- pylabrobot-vendor-agnostic\n\n## Changelog\n\n- **1.1.0** (migration) — Bulk-migrated to v0.4.0 schema: canonical\n  metadata block, base Hard rules, Cross-references. Body content\n  unchanged; author should review and fill in any domain-specific\n  extensions to the Hard rules.\n- **1.0.0** — Initial release.\n\n",{"name":5,"license":15,"description":7},"main","9c0b41e2036cc5588c699f06e658ea6dc3b9685d","skills\u002Flab-automation\u002Feln-elabftw",2,"https:\u002F\u002Fgithub.com\u002Fpradyumnasagar\u002Fopen-research-skills","https:\u002F\u002Fgithub.com\u002Fpradyumnasagar","PhD Scholar,\r\nManipal School Of Life Sciences, Manipal\r\n #OpenSourceDeveloper #LifeSciences #ComputationalBiology","2026-10-30 01:30:52",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add pradyumnasagar\u002Fopen-research-skills --skill eln-elabftw",{"tool":38,"command":39},"bunx","bunx skills add pradyumnasagar\u002Fopen-research-skills --skill eln-elabftw",{"tool":41,"command":42},"pnpm","pnpm dlx skills add pradyumnasagar\u002Fopen-research-skills --skill eln-elabftw","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fpradyumnasagar\u002Fopen-research-skills\u002Fblob\u002Fmain\u002Fskills\u002Flab-automation\u002Feln-elabftw\u002FSKILL.md",true,[],[47,54,60,67,74,81],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M75KTS5K9QNX8FQBTJW2GQSH","good-skill","A well-formed test fixture for the validation script.","https:\u002F\u002Fgithub.com\u002Fpradyumnasagar\u002Fopen-research-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fgood-skill\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M75KTR7FAT0MMMED2EGC9WZZ","BadSkill","https:\u002F\u002Fgithub.com\u002Fpradyumnasagar\u002Fopen-research-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fbad-skill\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M75KTN949EDF77GJDS8H6VR8","my-new-skill","One sentence (max 200 chars) — what the skill does and when to use it.","https:\u002F\u002Fgithub.com\u002Fpradyumnasagar\u002Fopen-research-skills\u002Fblob\u002Fmain\u002Ftemplate\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M75KTHTFS121SSF1Q5X2FXDA","thesis-structure","Use when planning or checking the architecture of a PhD \u002F MPhil thesis in the life sciences or bioinformatics — monograph vs article-based, chapter sequence, IMRaD-based chapters, abstract-to-conclusion flow, and the examiner expectations that the structure must meet.","https:\u002F\u002Fgithub.com\u002Fpradyumnasagar\u002Fopen-research-skills\u002Fblob\u002Fmain\u002Fskills\u002Fthesis-writing\u002Fthesis-structure\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M75KTE3WKW46FXFHQ579H8YP","thesis-methods-reproducibility","Use when writing or checking the Methods, figures, data, and code of a bioinformatics \u002F microbiology \u002F life-science PhD thesis — the FAIR data, versioned code, report-generation, figure-and-table discipline, and the reproducibility expectations that examiners probe at viva.","https:\u002F\u002Fgithub.com\u002Fpradyumnasagar\u002Fopen-research-skills\u002Fblob\u002Fmain\u002Fskills\u002Fthesis-writing\u002Fthesis-methods-reproducibility\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M75KTA033ZQCJY3DC8P5VQET","thesis-defense-viva","Use when preparing for the viva voce \u002F oral thesis defense — building the examiner's question set, rehearsing the presentation, and the pre-defense polish (slides, summary, the 'what if I'm stuck' responses) for a life-science or bioinformatics PhD.","https:\u002F\u002Fgithub.com\u002Fpradyumnasagar\u002Fopen-research-skills\u002Fblob\u002Fmain\u002Fskills\u002Fthesis-writing\u002Fthesis-defense-viva\u002FSKILL.md",[],[]]