---
title: "Change a Biocompile project through the API"
description: "Draft new hypotheses, links and record updates in a Biocompile workbench through the API, then contribute them to the project, where they merge at once."
url: https://www.biocompile.com/docs/api-workbenches/
section: "API and integrations"
last_updated: 2026-11-20
app_url: https://app.biocompile.com/workbenches
---

# Change a Biocompile project through the API

> Draft new hypotheses, links and record updates in a Biocompile workbench through the API, then contribute them to the project, where they merge at once.

Source: https://www.biocompile.com/docs/api-workbenches/. Index of all Biocompile documentation: https://www.biocompile.com/docs/index.md

The Biocompile API changes a research project the way you do in the app. You open a
workbench bound to one project, draft changes in it, and contribute the drafts you choose.
The contribution merges into the project at once and raises the project's version by one.
It is recorded as your decision.

Drafting needs `entities:write`. Contributing needs `contributions:write`, which only a
person's own credential carries: a personal access token, or an app acting for you. A service
account can draft, and a person contributes.

## Find what you can draft

`GET .../action-types` lists the kinds of change a workbench accepts, called ActionTypes,
with the input each one takes. `GET .../action-types/{action_type_id}` returns one. Paths
start with `/api/v1/organizations/{organization_id}`.

You draft a change as an intent with these fields:

| Field | Meaning |
|---|---|
| `operation` | `create`, `update`, `supersede`, `link`, `delete` or `unlink` |
| `collection` | The kind of record, for example `hypotheses` or `relationships` |
| `target_uri` | The record an `update`, `supersede` or `delete` acts on |
| `payload` | The input the ActionType takes. Name other drafts and records by their identifier. |
| `rationale` | Why, kept with the change |
| `source_refs` | The evidence the change rests on |

## Open a workbench

`POST .../workbenches` opens a workbench, optionally bound to a project you can change:

```bash
curl -s --request POST "https://app.biocompile.com/api/v1/organizations/$ORG_ID/workbenches" \
  -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
  -d '{"project_slug": "rp_a7x3", "name": "Import from the March screen"}'
```

The answer holds the `workbench_id` (`wbk_…`) and the project's current `project_version`.
`GET .../workbenches` lists the workbenches your credential reaches. A workbench belongs to the
person who opened it, and only credentials of the same kind reach it: a personal access token
reaches workbenches your personal access tokens opened, and an app only its own.

## Draft changes

`POST .../workbenches/{workbench_id}/drafts` drafts one or more intents:

```bash
curl -s --request POST "https://app.biocompile.com/api/v1/organizations/$ORG_ID/workbenches/$WORKBENCH_ID/drafts" \
  -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
  -H "Idempotency-Key: march-screen-batch-1" \
  -d '{
        "intents": [
          {"operation": "create", "collection": "hypotheses",
           "payload": {"statement": "MAPK14 inhibition reduces IL-6 release in THP-1 cells."},
           "rationale": "Seen in three independent plate runs."}
        ]
      }'
```

Each draft gets the identifier of the record it creates (`hyp_ab12`) at once, and is checked
against the project when you draft it. `GET .../workbenches/{workbench_id}/drafts` lists every
draft with its status: `ready`, `conflict`, `blocked` or `unsupported`.

Send an `Idempotency-Key` header to make a retry safe. Repeating a call with the same key
returns the first result and drafts nothing new.

## Contribute

`POST .../workbenches/{workbench_id}/contributions/prepare` shows what contributing would take
in, what stays behind and what conflicts, writing nothing. Then contribute:

```bash
curl -s --request POST "https://app.biocompile.com/api/v1/organizations/$ORG_ID/workbenches/$WORKBENCH_ID/contributions" \
  -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \
  -d '{"title": "Import from the March screen", "summary": "Three hypotheses from the kinase screen.",
       "include": ["hyp_ab12"], "expected_project_version": 12}'
```

The answer holds the `contribution_id`, the status `applied`, the new `project_version` and a
`url` that opens the contribution in the project's history. Drafts you did not include stay in
the workbench for the next contribution.

## Who a change is attributed to

Every draft and contribution records who made it and that it came through the API:

| Credential | Recorded as |
|---|---|
| Personal access token | You, through your token |
| Service account | The service account (drafts only) |
| AI assistant or partner app | The app, acting for you. The workbench and the contribution belong to you, and the decision is yours. |

## Errors when changing a project

| Status | Code | Meaning |
|---|---|---|
| 403 | `project_read_only` | The project's change policy is observe only. |
| 403 | `contribution_requires_person` | Only a personal access token or an app acting for you can contribute. |
| 404 | `not_found` | No such project or workbench for you. |
| 409 | `PROJECT_VERSION_MOVED` | The project took another contribution since you prepared. Prepare again. |
| 409 | `CONTRIBUTION_NOT_READY` | Drafts conflict with the latest version or are blocked. |
| 409 | `conflict` | An `Idempotency-Key` was reused for a different request. |

## Common questions

### Does drafting change the project?

No. Drafts stay in your workbench. The project changes when you contribute them, and then at
once.

### Can a service account contribute?

No. A service account can draft in its workbenches and read contributions, but contributing is a
person's decision.

### What happens when two scripts contribute to the same project?

The second one gets `409 PROJECT_VERSION_MOVED` with the version the project is at now. It
prepares again and updates any drafts the newer version touched.

## Related

- [Read a project's history through the API](https://www.biocompile.com/docs/api-contributions.md)
- [API for projects and research records](https://www.biocompile.com/docs/api-projects.md)
- [Connect AI assistants over MCP](https://www.biocompile.com/docs/mcp-ai-assistants.md)
- [Biocompile API reference](https://www.biocompile.com/docs/api-reference.md)

## Get access to Biocompile

Biocompile is used in the browser at https://app.biocompile.com. It is free to start and no payment method is required: sign up at https://app.biocompile.com/signup?mc_cta=docs-md&mc_path=/docs/api-workbenches.md. If your team already uses Biocompile, ask an organization admin to invite you. Research teams that want hands-on setup can apply for the founder-led pilot at https://www.biocompile.com/pilot/. Questions: https://www.biocompile.com/contact/.
